Game Development Reference
In-Depth Information
if (SHCreateDirectoryEx(hWnd, m_SaveGameDirectory, NULL)
!= ERROR_SUCCESS)
return false;
}
_tcscat_s(m_SaveGameDirectory, _T(
\\
));
return m_SaveGameDirectory;
}
Developers Have Different Needs Than Your Players
Make sure that you have two different game option files
one for users and
one for developers. For example, it can be very convenient to have some way
to override the full-screen option in the user settings to open in window mode
for a debug session. Debugging a full-screen application with a single monitor
is sure to send you on a killing spree. While you are at it, make sure that you
allow gamers to set which monitor your game will be displayed on in a
multimonitor configuration, which is becoming much more common.
Preload Selected Resources from the Cache
Most games preload much, if not all, of the resources they
ll need during the game, or
at the very least the level that is currently loaded. Even open world games will typi-
cally preload as much of the game as makes sense, given the player
'
s current location
in the game world. The resource cache has methods that you can call to preload
resources, based on file type:
'
m_ResCache->Preload(
*.ogg
, NULL);
m_ResCache->Preload(
*.dds
, NULL);
m_ResCache->Preload(
*.jpg
, NULL);
m_ResCache->Preload(
*.sdkmesh
, NULL);
Preloading these resources will take some time, but players expect a pause during
game initialization. What they don ' t expect is a big hitch right after they fire a
weapon, which might happen if the sound effect for the weapon isn
'
t loaded yet.
Stick the Landing: A Nice Clean Exit
Your game won
t run forever. Even the best games will take a back seat to food and
water. There may be a temptation to simply call exit(0) and be done with it. This
isn
'
t a wise choice because your DirectX drivers might be left in a bad state, and it
could be difficult to tell if your game is leaking resources.
If you don
'
'
'
ll also find it impossible to determine
where your game is leaking memory or other resources. After all, a hard exit is
t have a decent exit mechanism, you
 
 
 
Search WWH ::




Custom Search