• Advertisement
Sign in to follow this  

Game Initialization Considerations

This topic is 3475 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm reading the book Game Coding Complete and it talks about initializing a game in Win32, however, I'm using SDL. It outlines the steps as this (with my questions): - Check system resources (HD space, memory, input devices) Is hard drive space much of an issue anymore? How can I check memory (HD and RAM) with SDL? How can I check for input devices (and is it necessary)? - Check CPU speed Think this is geared more towards the 3D side, I'm working on a 2D game with a hard-coded resolution, so I most likely won't need to do this. - Estimate available VRAM Can retrieve with SDL_GetVideoInfo() - Initialize random number generator Ok. - Load programmer options for debugging purposes Is this just for 3D effects/window stuff (windowed/fullscreen)? - Initialize the memory cache Load needed game resources? - Create the window SDL_SetVideoMode()? - Initialize the audio system Call to SDL_InitSubSystem(SDL_INIT_AUDIO) I assume. The author said that due to multithreading reasons, check to make sure that only one instance is running, then intialize the audio. - Load options and saved game(s) Simple enough (I hope!). Although he does mention that Windows XP Home doesn't allow access to the Program Files folder, so just write these files to the Application Data folder? - Create the drawing surface Is this the same as creating a window (when using SDL)? - Initialize game systems (AI, physics) Should be easy. Sorry for so many questions/the long post, just want to make sure I get my first big game running efficiently.

Share this post


Link to post
Share on other sites
Advertisement
I just wrote it into your post, making it a wee bit easier for myself. Hope you can read it, otherwise let me know.

- Check system resources (HD space, memory, input devices)
Is hard drive space much of an issue anymore?
No, not really, although it is very easy to enumerate all logical drives, determine which are hard drives and their volumes by the use of the Win32 API.
How can I check memory (HD and RAM) with SDL?
You cannot IIRC. You can, however, check available RAM with the function wxGetFreeMemory (based on wxWidgets). Otherwise, if you can use the Windows API, use GlobalMemoryStatus to fetch details about the state of the memory.

- Load programmer options for debugging purposes
Is this just for 3D effects/window stuff (windowed/fullscreen)?
To my mind, this can be anything from tiny and useful preprocessing directives, such as assertions, to Quake/HL in-game cvars and/or in-game profiling data. Possibly also logging to a file of some sort (very useful if done properly IMO). This are quite a lot of useful debugging tools available, both programmable by yourself and also premade.

- Initialize the memory cache
Load needed game resources?
Depending on your game, you can probably get away with loading everything into memory at once at the start of your game, since there so much memory nowadays, but otherwise you need to consider more complex loading and caching systems where only a part of the resources are kept in memory at any given moment. If you have many textures and/or vertex data, you should also consider whether they will fit in your minimum targeted machine's graphics adapter. But I am pretty sure that you can ignore this for the time being, since it takes quite a lot of data to get a out-of-bounds memory exception.

- Create the window
SDL_SetVideoMode()?
If you can away with something as simple as that, then you should definitely do it. I assume you do not need more complex render targets, such as dual-views, P-Buffers, or FBO's at the moment, so simplicity is probably the key.

- Load options and saved game(s)
Simple enough (I hope!). Although he does mention
that Windows XP Home doesn't allow access to the
Program Files folder, so just write these files
to the Application Data folder?
As long as you know where you are saving it and are sure that the saving does not have any ugly side-effects for the end-user, then it is indeed a plausible choice.

- Create the drawing surface
Is this the same as creating a window (when using SDL)?
This probably means initialization of OpenGL or a SDL Surface with SDL, so it is not the same, but it can be done right after the window creation with SDL.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement