Sign in to follow this  
metsfan

Building a view and controller layer

Recommended Posts

metsfan    679
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. Edited by metsfan

Share this post


Link to post
Share on other sites
metsfan    679
[quote name='Narf the Mouse' timestamp='1339396564' post='4948075']
How would you render a model?
[/quote]

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this