Implementing MVC Questions
I have done quite a bit of searching here, and other places in the web, looking for actual implementation examples of MVC game design. I found this article very useful for visualizing for a high level design: http://www.gamasutra.com/features/20050414/rouwe_01.shtml .. But, while I have learned a lot conceptually, I am struggling turning it into an actual program.
I want to learn MVC to decouple the rendering, model, input, logic, etc to ease the rafactoring pain in my projects. I came up with a simple game project to practice MVC (I am sure MVC is overkill for it and not necessary, but I wanted to learn in a simple manner). The project contains simple 3d primitives for graphics, and no animation. Using the above link as my template, I have built my Model out as I typically do:
EntityBase <- Non-MovingGameObjects
EntityBase <- MovingEntityBase <- MovingEntityGameObjects
I created a EntityManager to contain the EntityObjects, and provided Add(), Remove(), and Update() interfaces. I am comfortable with this setup and feel it will work fine for this project.
But now I have reached a bit of a hurdle in my understanding of the implementation. I am trying to build out the representation piece, and am not quite sure how to proceed. I was thinking of something like:
RepresentationBase <- Non-EntityGameObjects (i.e. background)
RepresentationBase <- EntityRepresentationBase <- EntityRepresentationGameObjects
In this setup, I am unclear as to what to pass to the EntityRepresentationGameObjects, nor how exactly to structure it.
Do I provide a pointer to the EntityGameObject in the representation class to get position information? Or do I use a messaging system?
How do I implement the actual shapes of the objects into the representation class? Use another class to represent the shape and have a pointer to that in the representation class?
Any help / advice, or actual implementation examples, would be greatly appreciated.
Thanks,
Brad
Edit: If this question seems to vague or unclear and you need more info, please let me know and I will provide it as best I can.
[Edited by - Sammie22 on February 12, 2010 1:41:02 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement