Skip to main content
gamedev.net
🔒 Locked

Getting Started

Started by Ninj4D4n Oct 9, 2002 at 1:46 PM 0 replies 200+ views
Original Post
Ninj4D4n
Ninj4D4n
Hi, all. I''ve posted a few times before and gotten lots of help, so i decided to come back for help on my newest questions. I''m working on a simple puzzle gaming involving a character pushing blocks around in order to reach a goal. While i''m still in the design process, i''ve come up with 2 really big questions. 1) What''s the best way to load/unload levels in DX8? Should i make a new pair of functions to do this? or should it be done in FrameMove()? or what? 2) Secondly, when a block is moved what''s the best way to handle this, should i change the verticies of the block? or just create a transformation matrix for the object to indicate the move? Thanks in advance for any help i get --Ninj4D4n Ohh yeah, one last question, does anybody know where i can find example source code of some simple games/programs made using DX8 and the common files framework?? Thanks again
Spacecat
Spacecat
Hmm, levels. I can''t say it''s the best approach but being a very object-oriented programmer I have (for a game project our company is working on) developed a fairly simple frame for our ''levels'' which simplified loading/changing levels very much:

class CHighLevel{
HRESULT Init()=0;
void Update(float fDeltaT)=0;
void Render()=0;
DWORD Message(DWORD dwMsgType, DWORD dwMsgData){return 0;}
}; // This is a grossly simplified version

It''s a pure virtual class that works well for a game that looks at the time counter and gives the time difference between the last two frames to the update cycle. (Everything in our game would update according to time advancement, not according to framerate). So every frame we''d have an update with the time difference and a render cycle. Why the message function? Well since this is a pure virtual class, you never know what object you''re really calling thanks to polymorphism. But Message is a common ground to ask a CHighLevel to ''do'' something.

On to levels: ''Levels'' are comprised of a heck of a lot of ''things'' that need updating and rendering, right? Well we''d just hook them all up in a given specialized CHighLevel object, and have a game manager just call the update/render of a single active CHighLevel object. Then to change level, the gamemanager would destroy one level, create and init the other, then set that new guy to get the update/render loops. Easy enough.

About the boxes: Most people would advise keeping -one- Mesh with your box, and several instances each with their own transformation. (All pointing to the same mesh)

=^.^= Leaders and teachers should remember: It is best to offer others what they Need, not what they Want.
=^.^= Leaders and teachers should remember: It is best to offer others what they Need, not what they Want.

Topic Locked

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

Sign in to reply to this topic.