I just purchased some shared hosting space, so I'll hopefully have the code up by this weekend.
Let's talk architecture. Games have objects, of course, and those objects have methods (responsibilities) and can also contain other objects.
I started by taking a DirectX tutorial project and refactoring it to work as a game. I created a few objects, moved some of the core rendering responsibilities around, etc. What I need to do now is take a step back and really think about the object heirarchy. What objects need access to/control over other objects? Where should responsibilities lie?
Following is a quick outline of the basic game engine objects we need to design.
Application
Contains the Main() program entry point.
Creates the game object
Game
Creates the form (window) object
Creates the task manager
Contains the main "game loop"
Form
Contains display settings?
Task Manager
Contains all tasks
Calls Run() on each task for every "game loop" iteration
Handles pause/unpause of game
Render Task
Contains a reference to the form object
Draws everything to the form
Input Task
Passes all keyboard/mouse/joystick and scripted input to the input manager object
Input Manager
Converts all input into events to be raised on various game objects
This is obviously a VERY basic list, and it needs to be added to. I want to stick to the core engine components for now, then move on to define the smaller pieces. What am I forgetting that should be considered a core object (high up in the heirarchy)?
-Nag
|