Sign in to follow this  
  • entries
    18
  • comments
    24
  • views
    12798

Slowly but steadily

Sign in to follow this  

286 views

The outcome of my last entry seems blatantly obvious now that I should continue on and save the level in a specific format that's easy to read and write from the level editor, and write up a utility later that will 'Content Pipeline-ize' all the assets based on the level file. Oh well, if an hour of typing it all up and reading it back a few times helps my brain work it out, then it wasn't a waste of an hour.

I spent some time this weekend setting up a rendering framework using Xna. I've decided on having a single interface, IGameObject that all objects in the game will inherit from. I also have various other interfaces that help to group the game objects, and provide a few methods that all of a certain type of object should have. For example, ISceneObject has no methods, but objects inheriting from it tells the framework that this object must be a part of the scene graph. Similarly there are IRenderable, IUpdateable, IInitializeable and so on.

I've set up a kind of game object index which various manager classes store their objects in. The index contains basically multiple hash maps, each one storing references to data implementing a certain interface, one for updateables, one for renderables and so on. I figure that will be more efficient during rendering and updating, for example when update is called, the index iterates over the entire updateable map, calling update on every thing in there as opposed to iterating over one master hash map and checking the type of each element as it goes. The idea of indexing with multiple hash maps displaces this type checking from happening every frame to once per object when they're first added to the index.

This is probably not the final solution I will stick with for scene management as it seems like nothing more than just hash maps of game objects. Eventually the editor will get to a point where I can create pretty complex scenes, and this brute force rendering won't perform very well. At that point I'll need to research and refactor some things. The current solution just needs to get me to that point, which I think it can do without having taken me months to code up.

This evening I've finally gotten around to starting to uncomment the large portions of the editor's code I had to comment out during replacing the OpenGL based system I had in place with the Xna one. I'm fairly certain I'm able to add a terrain to the scene, and it's rendering code is being called, but I can't be sure if it looks right or not due to the keyboard and mouse input have been pretty much deleted and need to be rewritten. That being the case, the next area I'll be thinking about designing is the input system. Hopefully with my next entry, I'll post some of the details of that design since until it happens I'm kind of at an impasse. Manipulating all the camera rotations and translations via the debugger is not a very efficient way to verify your rendering code.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

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