
Here's some tips for converting GWar to your own game. I wrote these as I did the conversion process on a little game (which I will probably not be finishing anytime soon) so they should be accurate and useful:
- Downloaded GWar & the GWar source code, put it all in a new directory
- Deleted GWar.exe and renamed the datafile
- Decided on what kind of game it would be
- Had to create artwork - sort of determined various aspects of the game
- I stole some graphics from SpriteLib using Snag (a Weasel Tool)
- Made a background picture in Corel 5
- Made some more game art in Corel 5
- I am using all 8 bit art, you might want to use 16
- I used the Grabber to create a common palette so they'd all look ok together on one screen
- Doing all that was a bit of a bitch cause I had to keep playing with the palettes, etc (grr!)
- Maybe next time I just do everything in 16 bit :)
- Generated src/palcols.h using PalDef (a Weasel Tool) on the common palette which I exported using the Grabber
- Began modifying code
- Start off with obvious things:
- Change the screen shot's prefix to whatever you want (draw.c:takeScreenShot())
- Change the background drawing code (draw.c:setupBackground())
- Change the pause code (draw.c:doPause())
- You could just leave that alone if you left the pause message bitmap in the datafile. Regardless, you should do all the same timing rigamorale it does.
- Change the statistics drawing code (draw.c:drawStats())
- Change the name of the datafile being loaded in gwar.c:setup()
- ostats.h declares the two player variables, remove them if not needed (player 1's stuff should probably be kept, player 2 not needed for single player games)
- ostats.c defines these variables, remove whatever you deleted in ostats.h from ostats.c too
- gwar.c:worldThink() has various things you're going to want to change for your game (respawning, etc)
- Start changing less obvious things (if your game requires it)
- Remove the player creation code from gwar.c:main()
- Add in a load map function call after the call to setup(), before the line that says "gameTime=0;"
- Add/Remove/Change the data associated with every object type
- ostats.h defines what each on-screen object has (health, position, etc)
- ostats.h also defines how many objects are in the game, and their ID numbers
- ostats.c:objCollide() handles collision detection, which you might want to make better (currently uses bounding-circle method - it's very easy but has some flaws, especially if your objects aren't more or less square-ish)
- Start writing in your own specific object types
- Change each object type's starting statistics (what that kind of object's
properties intially are when it is created)
- objs.c defines initialization functions for each object, write your own
- objs.h declares these functions, change this to reflect your init funcs
- ostats.c:statsInit() sets each object types' initialization function, which will have to be changed once you've written these functions
- objs.c defines several different types of object drawing methods. Write in
your own if you need more
- Make sure to declare the new ones in objs.h
- objai.c defines all of the object code besides the init function (the think, touch and death functions)
- objai.h declares these functions, change that to reflect your AI
- My bullets have no death functions since they are simply removed when they touch something
- My ships (cars) share the same death function (objai.c:shipDeath()) because they are all essentially the same. You can make your own, however. In the init funcs, just set the objects' deathFunc member variable to reflect this
- objai.c:rotX() and objai.c:rotY are helper functions to rotate a point. They're
used for firing bullets
- objai.c:moveAlong() simply moves an object along its current angle at its
current speed. Use it in the think functions to move objects
Click here to return to the GWar Source Code page.
If you have questions, comments or just want to say thanks, email me. I can also be reached via ICQ
at UIN 1783204. If you do anything cool based on this, please tell me about it. I maintain all copyrights to my code. Have fun!
|