creating a 2d scrolling shooter

Started by
9 comments, last by popcorn 13 years, 10 months ago
I'm looking at creating a very simple top down 2d scrolling shooter and in order to help create one I've built a very simple map editor. I'm using visual C++ express 2008 along with SDL and the guichan api to create the editor. This is what the editor looks like at the moment:



You can try it here.

I have no experience building anything like this so I'm looking for ideas on:

1. How to best manage the tiles.
2. Creating enemies and in particular how to handle movement(e.g in a game like 1942, you start moving around the screen and then enemies start flying in from the top of the screen), how do I create this effect for the game.
3. Is it ok to mix tiles of different sizes i.e have 64 * 64 tiles with 32 * 32 tiles?

Also any ideas that I should include in the editor would be also be appreciated.

The code is not that great but if you want to have a look at it, you can download it.
How about them apples?
Advertisement
A good starting point.
- Iliak -
[ ArcEngine: An open source .Net gaming framework ]
[ Dungeon Eye: An open source remake of Eye of the Beholder II ]
I have made my top-down shooter http://btrgame.com/
As editor i used MS Paint :)
each color meant something
there are can be a few layers (images) for 1 level
in rare moments when it's a need to place an object not strictly in a cell but shifted i just directly coded place of such an object
______________________________[my blog] [my browser game]
MseMseM, I like your little shooter game, I would be happy if I could create something similar.

What do you mean there can be a few layers for each level?

Also I take it the enemies are only active when the player gets to a particular point of the map?

@iliak - Whats the point in directing me to google, surely the point of forums is to get specific advice.
How about them apples?
Quote:Original post by popcorn
I'm looking at creating a very simple top down 2d scrolling shooter and in order to help create one I've built a very simple map editor. I'm using visual C++ express 2008 along with SDL and the guichan api to create the editor.

I'd write such an editor in either C# or Python ( + Pygame & pgu) - the former being an excellent choice for GUI-heavy apps, the latter being great for rapid development and visual-oriented apps. I'm not saying it's wrong to use C++, I'm just saying it's not the most productive language for these kind of things. :)

Quote:1. How to best manage the tiles.

Your current approach is fine, except that the sprite list area is too small to get a quick overview of the tiles. Also, consider outlining tiles - currently it's unclear where tiles end. It's useful to have a visible grid when you need it - and the ability to hide it when you don't.

Having that said, perhaps it's better not to use tiles at all. What about freely placing images of any size in your level?

Quote:2. Creating enemies and in particular how to handle movement(e.g in a game like 1942, you start moving around the screen and then enemies start flying in from the top of the screen), how do I create this effect for the game.

I once worked on a top-down shooter, where I hard-coded/scripted enemy behavior. Testing was pretty hard though, mainly because I didn't implement fast-forward or start-at-a-specific-offset functionality. Being able to see enemy placement in an editor would certainly make level-design easier.

Consider making an enemies list, similar to your sprites list. Whenever you select an enemy type and click inside the map area, an enemy spawn point is placed there (you may want to outline it with a specific color to make them stand out). In-game, you spawn an enemy of that type when the screen reaches that spawn point (perhaps a little earlier).

You could add a waypoint-painting mode, that allows you to create waypoints for the selected enemy. Alternately, you could write some pre-defined movement patterns and give each enemy spawn an appropriate pattern.

You may want to add more properties to enemy spawn points, such as when that enemy should be spawned (perhaps some should spawn at the bottom of the screen). It may be useful to make spawn points generate a certain number of enemies at a regular interval. Do whatever is useful for your game.

Quote:3. Is it ok to mix tiles of different sizes i.e have 64 * 64 tiles with 32 * 32 tiles?

Whatever you want. You can mix tilemaps of various sizes and tile-sizes any way you want. Or you can totally abandon the tilemap concept and just place sprites where you need them.

Another thing that might be nice is to add layer support to your editor. Having layers scrolling at different speeds in-game adds a feeling of depth.


There's another thing I'd like to mention: you don't seem to be using any kind of version control. I strongly recommend starting with it - it'll be much easier to get back to a working version if you mess up, and it's a good way to check progress over time. Take a look at TortoiseSVN. It may be strange at first, but once you're used to it, you'll wonder why you ever worked without version control. :)
Create-ivity - a game development blog Mouseover for more information.
I created a side-scrolling 2-d shooter, and I went about it differently. I didn't do tile, but rather independent backgrounds entering the screen at a certain time with a certain x/y speed. Enemies also entered the screen at certain times with speeds. You can find the game here
Alpha and Omega
and the source code here:
Alpha Source

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

Quote:Original post by popcorn
What do you mean there can be a few layers for each level?

Also I take it the enemies are only active when the player gets to a particular point of the map?


If there could be 2 or more objects per cell there can be several bitmaps for each level. For example a level for static objects and decorations and another level for "alive" objects (mostly enemies). Take a look at the image that contains complete design of the first level (zoom it):


I activated all enemies when they reached max distance from a player (constant value for all enemies).
______________________________[my blog] [my browser game]
I just finished one too and the way I did it was that I had a set of waves and once a given wave was killed or went offscreen the next one would spawn, so it wasn't tied to how far you'd scrolled.
@Captain P - at the moment I am going to stick to using guichan and sdl to create the level editor just to get one level up and running rather than start again using another langauge, one thing that I have learned from doing this is that the choice of api is important when creating an editor, guichan is pretty limiting in terms of widgets available. There aren't simple message boxes, dialog boxes etc, when I think about creating the dialog box for browsing through directories etc I do get put off.

As for the tiles, I'll have to stick with tiles since all the artwork I'm using is pretty much made to be used in that way.

Quote:
Alternately, you could write some pre-defined movement patterns and give each enemy spawn an appropriate pattern.


I want to try this but what kind of pre-defined movement patterns would you suggest I try, what fits best?

Never really thought about version control, usually I build a project until I get something working then start a new project to clean the code up, if I'm going to make major changes then I usually start a new project up and use the old project as the base, that way I always have a working version.

How does version control generally work?

@BeerNutts - that's pretty good, I like the little helicopter that floats about until you destroy it.

@MseMseM - so you mean you have one layer for the background and then one layer for the enemies. I can't believe you used MS paint to create your levels, pretty ingenius though.

[Edited by - popcorn on June 29, 2010 8:58:06 PM]
How about them apples?
Quote:Original post by popcorn
I want to try this but what kind of pre-defined movement patterns would you suggest I try, what fits best?


I wrote a scroller and used sin/cos heavily, parabolas, cubic functions... each enemy was basically a state machine.

e.g.

state swerve: {  sin(delta)   if(y > some value) move to angle state}state angle:{ y-=delta x-=delta if(x > some value) move to fast_down state}state fast_down:{   y+=25   //move down super fast!   if(y>end of screen) move to finished state}state finished:{   self_destruct //we're off the screen now}

This topic is closed to new replies.

Advertisement