Hello Guys, Recently I read in a book related to Game coding that the games we code must follow the MVC Design Pattern. Is it necessary that we strictly follow this pattern. And do most of the games follow this pattern

geon
—
2012-05-01T13:40:38Z —
#2

I have never read about games explicitly using the MVC pattern, but some sort of similar concept will usually be the result if the engine is at all well designed.

I think it is more common to have a component based approach, where a game object (like a monster) has an AI, a mesh renderer, a physics simulation etc.

alphadog
—
2012-05-01T20:08:17Z —
#3

MVC is one of many general patterns to architect an app. MVC is simply a practice/pattern that makes you separate data, logic and presentation in a certain way. The reason that MVC isn't strongly useful in all game subtypes is that, in most games, the Model is pretty close to the Presentation, esp. in 3D worlds. With a business-line app, the Model is often very different from the View, and there may be multiple Views of the same Model.

MVC is one of many general patterns to architect an app. MVC is simply a practice/pattern that makes you separate data, logic and presentation in a certain way. The reason that MVC isn't strongly useful in all game subtypes is that, in most games, the Model is pretty close to the Presentation, esp. in 3D worlds. With a business-line app, the Model is often very different from the View, and there may be multiple Views of the same Model.

Hi.You mean to say in 3d Worlds the model has only a single view or the model is equivalent to the view.Could you please give me an example regarding this. Thanks.

alphadog
—
2012-05-02T18:18:56Z —
#5

The Model exist to track a system-level representation of data, and the View exists to track a user-level representation. So, in a sense, I mean both. There is usually a limited number of views on the user side, and there's little transformation between the two (ie. all that game world data becomes a fixed-size set of viewed pixels.)

This is different from the Observer pattern, from which MVC is modeled from. The Observer pattern is a little more universal, and can apply at the subsystem level or even on just one class. So, don't confuse the purpose of the two.