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.

I want to learn how to develop a MVC pattern, but i can't find any site in where they focus it to Games and not to Browser / Windows calculator.

Would anyone please link me a tutorial of how to develop MVC patter for games?

Thank you very much

share|improve this question

closed as not constructive by Nicol Bolas, michael.bartnett, bummzack, Byte56, Josh Petrie Oct 19 '12 at 16:30

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
Not an answer, but this should be a very interesting read if you're interested in MVC in games gamedev.stackexchange.com/questions/3426/… –  Roy T. Sep 9 '12 at 15:35
    
I haven't used MVP in XNA yet, but its very useful for application development, and particularly unit testing of the display framework. It was designed as an improvement on the traditional MVC framework and I recommend you take a look at it at some point en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter –  Daniel Carlsson Sep 10 '12 at 3:39

1 Answer 1

Take a look at Game Coding Complete. McShaffry makes use of the MVC architecture and explains its uses well.

The basic gist of it in terms of games is usually:

Model
This is your game logic. Game state changes, scripted events, rulesets, etc.

View
This is mainly the rendering aspect of the game. If you wanted to be cross-platform and support more graphics APIs, you'd just need to change the View portion of the game without touching any of the other code.

Controller
Pretty much what it sounds like. This section handles the input events that affect the game state (Model) and in turn what happens on screen (View). You can be a bit clever with this for AI, for example. You could have a PlayerController and an AIController that both send input events to the Model code.

Similarly, the View can be AI sensors in order to observe the environment to make decisions (a heavily subsidised version of the player's view).

Hope that helps.

share|improve this answer
    
I don't think McShaffry's architecture is MVC, nor does he claim this. It does reflect a similar separation of model and view that MVC does, and he has a three-way separation of concerns (the logic, view and application layers), but these three layers don't really align with model, view and controller. For example, user input goes to the application layer, then to the view layer, then the view sends signals to the logic layer (2nd ed, p. 229); in MVC, the path C->V->M is not allowed. –  Nate C-K Apr 2 '13 at 16:59

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