Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

When we want to design a mission sub-system like in the The Ville or Sims Social, what kind of design pattern / idea would fit the best? There may be relation between missions (first do this then this etc...) or not. What do you think sims social or the ville or any other social games is using for this?

I'm looking for a best-practise method to contruct a mission framework for tha game. How the well-known game firms do this stuff for their large scale social facebook games?

  • Giving missions to the players and wait players to complete them. when they finished the missions, providing a method to catch this mission complete events considering large user database by not using server-side not so much to prevent high-traffic / resource consumption.

how should i design the database and server-client communication to achive this design condidering this trade-off.

share|improve this question
1  
What do you mean by design pattern? in terms of code? in terms of project? The pattern used can be depend on many things,such as: What framework you are using/how much time you have/how often you update the code or if you do at all... Refine the question and i'll think you'll get more/better answers. –  LoveofSnow Jul 11 '12 at 12:06
    
I'm looking for a best-practise method to contruct a mission framework for tha game. How the well-known game firms do this stuff for their large scale social facebook games? Giving missions to the players and wait players to complete them. when they finished the missions, providing a method to catch this mission complete events considering large user database by not using server-side not so much to prevent high-traffic / resource consumption. how should i design the database and server-client communication to achive this design condidering this trade-off. –  Furkan ÇALIŞKAN Jul 11 '12 at 12:27
2  
With the given information about your game it is hard to tell, what you should do, as the mission design is strongly dependent on your game logic. Also, I don't think that there is one design pattern, that fits for every case. You should look into game design itself and then design a system, that fits your needs. But in the current state, the question could be answered on a very wide scale, without even helping you. It's like if I would ask "What is the best practice for saving a game" without giving any more information. This strongly depends on your game and your architecture... –  tom van green Aug 10 '12 at 14:44
add comment

2 Answers

Your question is general enough that there's probably no definitive answer to it. I think you could find the answer in the book Game Coding Complete though. It describes a process manager that allows you to chain processes together, so that once you achieve a step in a mission the next one would automatically activate. They discuss how you could even make a C# tool that would let you drag and drop to create mission trees in this manner. Might be the kind of architecture you're looking for.

share|improve this answer
add comment

There is not one silver bullet. You can use an event driven paradigm:

  • Whenever something happens in your game that can be relevant for a quest, raise an event.
  • Define classes for your quests with event listeners to react to these events.
  • Store the currently active quests (and their status and parameters) in a database
  • When initializing your game state, also initialize quest objects for each active quest of the player
  • Register the quest objects' event listeners at your game state object

For example:

class Character {
    function heal(amount) {
        this->hp += amount;
        event = new HealingEvent(this, amount);
        raise event;
    }
}

class PracticeYourHealingSpellQuest extends Quest (extends ActiveRecordBaseClass) {
    // property healingDone is provided by a database record
    function reactToHealingEvent(event) {
        this->healingDone += amount;
        if(this->healingDone > 1000) {
            this->state = completed;
        }
        this->update();
    }
    function registerAtCharacter(character) {
        character->onHealingEvent = this->reactToHealingEvent
    }
}

class GameController {
    function init() {
        character = DB->findMeACharacter
        quests = DB->findMeActiveQuests(character->id)
        foreach(quests as quest) {
            quest->registerAtCharacter(character);
        }
    }
}

Don't worry about database performance. Your facebook app will never have enough users playing at the same time to make this approach unviable with MySQL. (If it does, you can still use caching techniques, parallel database servers, etc.) The most important thing is to have a quest system that is flexible and that has all the quest-related code where it belongs, namely in quest classes.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.