Tips for implementing MMO quest mechanics?

jmp97
  • Tips for implementing MMO quest mechanics? jmp97

    What tools, patterns, or best practices would you recommend to implement the quest mechanics given below listed requirements?

    I am talking about software architecture (how generic should you be) and choices for object wiring, event subscription, and representation of conditions. Mentioning of tools / libraries you have successfully used are welcome. Edit: If you are using scripting, what setup do you recommend?

    Requirements:

    • simple 2D mmo(rpg)
    • all the game data, including quests, is stored in a relational database
    • any event in the game could trigger a new quest for players or advancement of existing quests
    • a quest can have an arbitrary number of conditions that must be met before the quest is available to players
    • a quest can consist of an arbitrary number of sub-quests / steps with arbitrary conditions
    • quests would range from simple:

      talk to A - kill 5 B - talk to A - permanently increase health

    • to quite involved:

      use item in area X - go to area Y - a bot will spawn - kill bot without taking more than 10% damage - bot drops item - pick up item - portal unlocks - deliver item to J behind the portal - receive gold and experience - allow to pass portal once more - lock portal for this player

    • level instances are a possibility (players can complete certain quests in teams or isolation which will spawn the level location just for those participants)

    • Quests should preferably be manageable using a world editor without scripting or programming knowledge (Edit: not advocating against scripting in general though)
    • I assume C++ as the language of implementation

    I was thinking that if I could combine any chain of events and conditions we could model more complex and thus possibly more engaging quests. I experimented with rolling my own ECA (Events-Conditions-Actions) engine but that might be overkill. It has been particularly difficult to model generic conditions without using any sort of scripting.

  • First a warning, then some advice.

    Last time I needed to implement a system like this I was not using an engine originally intended for MMO-like applications. The quest system it shipped with was geared for single player endeavours, and could not be used.

    I ended up having to stuff scripts on all the objects involved with the quests more or less by hand, like this (pseudocode):

    Lever004_on_activate() {
        if isOnQuest(player, QUEST_0012) do_something();
        if isOnQuest(player, QUEST_0015) do_something_else();
    }
    

    This is a complete nightmare. There is no way to figure out how the quest works without scavenging all through the game. Do not do this.

    I would recommend creating a system where the entire quest (line) is represented as a finite state machine, with events to check for transitions and scripts to react to said transition. That makes it easy to keep track of where you are in a given quest (line) and keeps all quest state neatly encapsulated.

    If you want, you can make a library of scripts/script templates in your world editor for common occurrances (player talks to NPC, player kills mob, etc.)

    I would not worry too much about script performance, as long as you do not fire your event scripts too often. As a rule of thumb, scripts should fire at least an order of magnitude less than the "core" game logic (animation, physics etc). They should react to events, instead of firing periodically to check if a condition has been met.

  • Our system basically involves running a an expression (custom mini scripting language but tcl/lua/python would work just as well, or make something yourself) each server frame for each mission step. This is for "personal missions" that are tied to a specific player. Each substep is then part of an FSM (finite state machine) for the mission itself (which might just be a substep of another mission). There are also "map missions" which have a single FSM and are tied to the map instead of a player (think WAR's public quests), but the substeps work basically the same.

    What these expressions actually look at are events broadcast by the system like "NPC died" or "interaction complete". This means you can somewhat decouple the various parts, the gameplay systems just send out events as needed, which the mission scripts just listen to events and don't worry about where they come from. If you also layer on that you can have the mission FSMs interact with the world state (only show this contact when in mission state X) you can get a lot of power out of the system.

Tags
architecture c++ mmo scripting quests
Related questions and answers
  • that.... Allows easy setup of controls for a game Makes events like clicking and holding on an object easy to setup, as so objects can be dragged around afterward Are there any simple libraries...Sorry for the ackward title, but i don't know what to call it exactly. I'm looking for code or libraries that allow easy creation of commonly used user input devices, and code/libs that make gaming controls easy to set up (i'm using SFML and Box2D at the moment) I don't want to re-invent things like buttons, arrows being placed wherever the mouse is located, and more game specific items

  • . state_->handleEvent(event, this); } That means that I don't really ever need more than one instance of a particular entity state; doing something like entity.setState(new StandState) is therefore highly wasteful. Then again, making each entity state a singleton hardly seems appropriate. What do you suggest I do? (The same can be said about game states, so whatever the solution... changed, then it (the representation) starts having an internal state. I would much rather have it stateless so that I require only one instance of every representation (just as before). Edit

  • Hey so i just learned about the i/o part of the STL, more specifically fstream. Although I can now save binary info and classes i've made to the hard drive, i am not sure how to define how the info should be read. I saw the answer for making a file format from [this][1] post: Typically you would define a lot of records/structures, such as BITMAPINFOHEADER, and specify in what order... simply for the use of a game i would think it would be much easier though. The format should: Be traversable (i can look through it and find the start of structure and maybe check it's name Be able

  • don't need 3D, and it is quite ...a lot of work to learn. I also don't like that it is so expensive to use for different platforms and that I can only code for it through scripting. You have to buy each... people can play my game once finished). I'd like to have it available on many mobile platforms aswell. (because I love touch input for some reason) I do know the XNA framework pretty well... to someone. If I use XNA, I would have to make all the tools myself, and I'd probably have to make them with WPF. (I'd love to make tools with Adobe AIR, but unfortunately the API's for image manipulation

  • able to link published events to published actions (for example, A level activate event throws a door open action), etc... Because of this I guess my entity system should be written in a scripting...) Where should I place the messaging system for my game engine? Lua? C++? I'm tempted to just have C++ object to behave as servers, offering services to lua business logic. Things like physics system... instantiate them. All this, is what I can think of now. I know my editor can still be using game objects even if it is external, but the game am I into is for iphone using cocos2d and the editor

  • GameSubsystems) can implement registerComponent(Component*). pro. Components and GameSubystems know nothing about each other. con. In C++ it would look like ugly and slow typeid-switch. Questions: Which approach is better and mostly used in component-based design? What Practice says? Any suggestions about implementation of Approach 4? Thank you. ... pointers to some of Components. GameSubsystem is a very powerful and flexible abstraction: it represents any slice (or aspect) of the game world. There is a need in a mechanism of registering

  • Say I develop a game for mobile platform running OpenGL ES 2.0. I have done 2D part, and now I wish to import some 3D objects. The imported 3D objects must contain the following: Vertices positions Normals UVs Texturing information Animation information Collision mesh Maybe some other things... I am aware, that I could and (maybe should) create my own file format that brings these data from 3D authoring application (3ds Max, Maya, Softimage) into the game. However, doing so from scratch is going to be really be a lot of work. Therefore, is there any available solution/middleware

  • for other players should only be sent to a game client if their player is near the other players (i.e. you shouldn't get health updates for people you can't see on the other side of the map). The main problem is that if you had to compare all the players every time an update is sent, it would just take way too long as the number of players scales (think up to a few thousand players per map and each... or easier way? If it can be multithreaded that would obviously be better, and the less main-thread calculation the better. (For anyone wondering, the project is in C++).

  • that I have generated. I handle the threads by using turn-based concurrency. My problem is I worry about lag of the input events when there are fast moving objects, and I am curious to see... think about adding a bulk of data on the generic object creation, but there might be a lag between the creation and the actual event - on Java, I have to go through JNI and the generic object is always...Currently in my project, the way I handle user input events is through the OS Framework, then create a generic object - basically combines all types of input: keyboard, mouse, touch, trackball, etc

Data information