February 23rd, 2007, 12:58 PM
Where to start?
I'm working on a 2D Side Scroller. I've got a few classes designed, but I'm trying to think what should come first. Should I design a level editor first? The player, item, sprite classes first? I've read a lot of books, I have a decent understanding of SDL, C/C++, object-oriented techniques, and just plain programming in general (except the gaming side) but when it comes down to thinking of the concept behind a 2D Side Scroller, I can't seem to think of what I should start with first, and what I should end with.
What type of things should I do for planning to make my programming sort of just "flow", without going back after 2 days and going "oh ****, I have to re-write this whole thing over again in order to incorporate this feature".
Any help from anybody with previous experience with writing 2d games or complex applications would be greatly appreciated.
February 23rd, 2007, 02:23 PM
I typically start with things I know I'm going to have to use first. Player classes. Monsters.
Dear God. What is it like in your funny little brains? It must be so boring.
February 23rd, 2007, 06:42 PM
I would start with a number of proofs of concepts. When I mean proof of concept I mean something that proves you can do something.
Here is a few. I would write code:
1. that draws a few sprites to the screen.
2. that plays sounds.
3. that captures key strokes and such.
Once you are comfortable with those few things then write some code:
4. that detects collision between 2 sprites.
5. moves a sprite on a key stroke.
Once you can do that then write some code:
6. that distinguishes between player/monsters and terrain and apply gravity to the player/monsters and using collision detection makes sure the player/monsters don’t fall though the terrain.
Also think on how you will move the screen whether it will stay centered on the player or if it will stay centered on room and when the player goes off screen another room is loaded or something else.
You will also want to think on how you will do animations such as walking and attacking. And think how to handle collision detection for when a monster hits the player and visa versa. Also put in code to play sound when the play jumps, attacks and so on. Sound isn’t very hard to put in so you can wait to put it in.
Another thing to think about is how will you do menu screens or dialogs?
Another thing you can do is play a few games close to what you want to write and while playing it examine every detail and think “how would I put this in my game?”
Another option is you could just get a commercial game library like Torque 2D. Most of the things I mentioned here are already taken care of in those.
February 23rd, 2007, 07:01 PM
I put together before I decided to restart. It has things like a Player class, Map class, Tile class, Sprite class (also one for animation clipping), things like that. I've already created functions for vertical and horizontal collision and such (turned out kind of buggy, the player has a seizure when he's touching the ground - moves up and down really quick), but I'm thinking I want a new method of Tiling. It seems kind of redundant always having to draw 300 tiles (sprites) per game loop. I have 300 tiles because, 800x600 @ 40x40px tiles (sprites), thats 20 horizontal tiles, and 15 vertical tiles, 15x20= 300. I'm also creating a new Sprite/Tile class for each individual tile, probably not a good idea, but its working so far heh.