Skip to main content
gamedev.net
🔒 Locked

Organizing my engine

Started by sirSolarius Apr 26, 2004 at 5:22 PM 0 replies 350+ views
Original Post
sirSolarius
sirSolarius
Ok, so I''m debating a couple of techniques for organizing my engine. I''m going to use a quadtree to hold level and entity information, which will be loaded straight from a file. Now, I obviously will split my engine into seperate classes: rendering, input and physics (sound will come last). Do I just pass my quadtree into the rendering and physics engine? If so, how do I tell my rendering engine that something moved on the physics side and update that? And if I get something from the input layer, how do I tell the rendering layer to move something around?
Jason Z
Jason Z
Keep in mind that the various engines (graphics, physics, input, and sound) are components of the overall application. Each sub-engine handles specific aspects of the game. The input engine reads whatever input there is, the physics engine acts on the game objects properties (such as position, velocity, and acceleration), and the renderer displays the current scene. The main application uses each of these components to bring it all together.

So to answer your question, the main application will need to maintain a list of all of the objects that are in your game. It will then use each of the sub-engines to perform a one frame update. The loop would go something like this:

1. Read input (mouse state and keyboard state, maybe joystick too)
2. Use input to affect whatever objects it is supposed to (like the mouse movement moving the view in a FPS or hitting the spacebar to shoot a missile...)
3. Use the physics engine to discover collisions and update object positions, velocities, and acceleration.
4. Use graphics engine to display what has happened in this frame.

This is a little bit over-simplified, but hopefully it helps. I would recommend getting some basic game programming books to get the basic ideas down. I found "Tricks of the Windows Game Programming Gurus" by Andre LaMothe to be very helpful. It doesn''t go into any 3D theory or anything like that, but I touches on most of the important aspects of game programming.

Good Luck,

Jason Z



Jason Zink :: DirectX MVP   Direct3D 11 engine on CodePlex: Hieroglyph 3 Direct3D Books: 

Topic Locked

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

Sign in to reply to this topic.