Skip to main content
gamedev.net
🔒 Locked

MVC vs ?

Started by HappyCoder 0 replies 1.2k views
Original Post
HappyCoder
HappyCoder
[size=2]So I have known about the Model View Controller model from web development and just yesterday I was talking about it with a roommate and then almost like a slap to the face I realized that separating the Model, View, and Controller in games seemed like a good idea. I am working on a game project as of now and at the beginning of creating it I wanted it to work as such.

I want to be able to create entities that are disconnected from each other. The enemy entities, for example, wouldn't have a reference to the human player class. To know the players position and such I wanted to create an eye and ear class. Attach and eye and/or ear to an entity and it would see/hear objects in the scene and alert the entity it belongs to of the objects. The entity could also cause the eye to ignore certain objects or specifically search for objects. The idea behind this was to modularize the actors in a scene from each other and the scene. The way I have been going about creating this is by making a hierarchal tree of entities and was planning on subclassing the Entity type, the same class that does the rendering, and having the subclasses of it have the logic to update objects.

I am realizing that my View and Model would be in the same object if I continued on this. I am wondering if this is still a good way of doing this or if I should separate the view from the model. Any experience with either of the two design models or comments on this would be appreciated. Thank you.
My current game project Platform RPG
ApochPiQ
ApochPiQ
It really isn't worth contorting your design to fit someone's preconceived notions of what "good architecture" involves. Design patterns and prefab architectures like MVC are dangerous - they were meant to describe patterns that emerge from common designs, not to dictate how you do design in the first place. If you find yourself building code by selecting patterns (or architectures like MVC) and strictly conforming to them, you're doing it wrong.

Develop a design that makes sense for your gameplay requirements. Everything else is wasted time.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.