TPU ChatChat on IRC
Internet Relay Chat?
Java Applet client
Who's on IRC?
Simple Engine Design
Posted by Mycroft [send private reply] at June 14, 2002, 10:37:06 PM OK, so if I were to develop a simple bitmap 2-d game engine in C or C++ how would I go about designing, testing, and intergrating it into an actual app? I know this is pretty general, but just about anything you can give will help me out.
Posted by metamorphic [send private reply] at June 15, 2002, 06:32:10 AM well i cant remember much off the top of my head, becasue this is way over my level. i did see some articles on gamedev.net for a 2d engine.
Posted by unknown_lamer [send private reply] at June 15, 2002, 02:53:03 PM You would probably want to use SDL (http://www.libsdl.org) for the graphics and sound. SDL is somewhat easy to use...as for integrating your engine into a program you would probably want to make the engine event based, where the controlling program set up events and then called a function like engine_eventloop (); at the ends of it's main and let the engine loop over events. So an example main might be:
int main (int argc, char **argv)
add_event (game_events, ...[stuff]);
add_event (game_events, ...[more]);
// game_event_loop won't return
return 0; // supress warning
Posted by CViper [send private reply] at June 15, 2002, 03:29:37 PM Well... do some really careful planing / structuring, so you know what exactly you want to do (maybe sounds stupid, but that's the most important part)
Then i'd suggest you start dividing you game into smaller modules and make 'em as independent as possible, so you can test and debug each on it's own (more or less).. Later if you change something it also helps you not having to rewrite alot of other stuff :)
Posted by RedX [send private reply] at June 15, 2002, 05:31:05 PM Make a ofstream object to a file called debug.txt (or what name you want to give it) early. It's very handy to have a alternative to cout when doing graphics. However keep an eye on what functions write what to the file, because when you put an output in the wrong function the file can become enormous in a matter of minutes.
Posted by unknown_lamer [send private reply] at June 15, 2002, 08:18:58 PM What is wrong with logging to std::clog or std::cerr? You can just start up the program like so:
mygame > debug.log 2>&1
And have a log...
Posted by RedX [send private reply] at June 16, 2002, 08:26:56 AM There is nothing wrong with those. The ofstream object is mend as an addition to those. It's not used for errors but for getting access to the data without writing to much extra code. You can use cerr or clog for this, but the standard libs use these too for their errors and it can be quite annoying to look for an error message between a few thousand lines with data.
Posted by unknown_lamer [send private reply] at June 16, 2002, 02:58:06 PM Wierd. Last time I checked the STL and standard C library didn't report errors unless you caught the exception and printed the error yourself (STL) or used perror (stdlib, either that or grab the errno yourself).
Posted by RedX [send private reply] at June 16, 2002, 05:14:58 PM I'm not 100% sure about the standard C lib, but people are usualy advised to use standards, so you can predict that libs (which also includes imported functions and stuff) would be using these standard streams for outputting their errors (especialy because exceptions are part of C++ and are one the more advanced parts of the language. Not everyone uses them).
Besides imho cerr is for errors only (clog too because they point to the same stream). Else you expect whoever takes a look on your program to magically know that cerr is used for other things as well (is practicly the same thing as reusing variables).
Register as a new user