Building a view and controller layer

Started by
1 comment, last by metsfan 11 years, 10 months ago
Hey all. I am considering how I want to handle the view and controller layers of my game engine, and I just wanted to get some opinions on my thought process. I have been working a lot with iOS lately, and I have come to really like their model for views and controllers. For those who dont know, the way views and controllers work in iOS is that the UI is controlled by UIViewControllers. Each UIViewController has one root view, and an unlimited hierarchy of subviews can be created and added as children to the root view. The UIViewController is responsible for building the view, and making the calls to render the view, as well as the option of handling events on its view (the UIView can also handle its own events).

My question is, does this seem like a good logical base for a game engine as well? Each "View" in the game, such as the main 3d scene, the options panel, the login screen, each of these would have a GameController, and attached to each GameController would be a root GameView. Each GameController builds its subviews, and then the root view of the controller is added to the root GameController's view, which is essentially just a root node. Then on each render pass, the view hierarchy is traversed, and each view is rendered.

Not sure if this is making sense by this point, but if you're still with me, I'm wondering if there is anything that is obviously wrong with this architecture, whether its something small or big. I'd appreciate any opinions on the matter, and if there are any questions I will be happy to clarify.
Advertisement
How would you render a model?

How would you render a model?


The main 3d scene controller would have a scene graph, and one of the node types in the scene graph would be a Mesh node. At least thats how I'm thinking about it now.

This topic is closed to new replies.

Advertisement