Game Development Reference
In-Depth Information
}
g_pApp->m_pGame->VRenderDiagnostics();
}
This method simply iterates through all the views attached to the game logic, g_pApp-
>m_pGame , and calls VOnRender() for each one. After that, the game logic calls a
special method for rendering debug information, VRenderDiagnostics() . This is a
convenience for programmers who would rather not adhere to the separation between
logic and view just to draw some debug lines on the screen.
A good example of how I use VRenderDiagnostics() is drawing physics informa-
tion, such as mesh wireframe of any objects moving on the screen. The physics sys-
tem is purely a game logic object, and the renderer really belongs to the game view. If
you wanted to religiously follow the separation of game logic and game view, you
'
d
have to do something like have the game logic create special
line
objects and send
messages to the game view that it needs to draw these lines.
That ' s just dumb, in my opinion. A game logic should be able to use the application
layer
to draw debug data onto the screen. Yes, it
breaks the rules, but yes, you should do it.
in this case, DirectX
'
s renderer
Can I Make a Game Yet?
By now you
ve learned a lot about some of the hidden superstructure of game code,
most notably about GameCodeApp , BaseGameLogic , Process , and Process
Manager . You
'
ve probably figured out that most of the subsystems discussed so far
can benefit from cooperative multitasking: animated objects, user interface code, and
more. If you
'
'
re like me, you
'
ve already played with writing your own games, and
you
re itching to put everything together in a tight little game engine. At this point,
you know just enough to be dangerous and could probably strike out on your own to
write a few very simple games. However, there are still quite a few important bits and
pieces you should know if you want to take it to the next level.
For example, you probably never thought about how game engines stuff a few giga-
bytes of game art and sounds through a much smaller memory space. Read the next
chapter and find out.
'
 
 
Search WWH ::




Custom Search