Shmup Level Design/Scripting : I'm so lost.

Started by
10 comments, last by the incredible smoker 9 years, 6 months ago

First, greetings and salutations. I'm a new poster here, though I've browsed the forums and articles many times in the past, and have come to ask for assistance with my current project. Any help, even the tiniest of nudges in the right direction, will be most appreciated.

I am currently, as the title suggests, working on a Shmup style game, specifically a Vertically Scrolling Arcade Space Shooter. The game is written in Java, using the wonderful Libgdx framework. I have the core mechanics working, namely the enemy movement, power-ups, etc. I can have endless random waves of enemies to shoot but I'm completely at a loss when it comes to creating actual levels that control when and where the enemies should spawn. A bit of research has led me to believe that there are two main ideas when it comes to this. First, using a spatial map editor system to place enemies that are activated when the camera/character draws near. Second, using LUA or XML files to script enemy spawning based on time. Either of the options would work for me but, sadly, I'm not even sure where to begin to implement either one.

My question is, what would be a good method for creating levels/waves for a game such as this?

Again, any help or advice is very much appreciated. If more information is required on my part, please, ask away and I'll do my best to answer any questions.

Advertisement

You should make a level edittor, even in a game like that.

S T O P C R I M E !

Visual Pro 2005 C++ DX9 Cubase VST 3.70 Working on : LevelContainer class & LevelEditor

Since you've already stated your game is vertically scrolling that implies that you've got some kind of "level" already - as in the background is scrolling past a camera?

The easiest way I can think of (keep in mind I'm winging this, never made a SHMUP) is a XML or Json file that has a "timeline" of when to spawn enemies and from where.

Simple example:

<Level>
  <Spawn Scroll="10" Position="0, 0" Enemy="Airplane" Pattern="StraightAcross"/>
  <Spawn Scroll="10" Position="10, 0" Enemy="Boat" Pattern="Stationary"/>
  <Spawn Scroll="15" Position="0, 0" Enemy="Airplane" Pattern="Loop01"/>
</Level>
Then you kind of treat it like an animation with the spawns as your keyframes and your scroll position as the time. In the above case, "Scroll" is the level scroll position at which the enemy spawns. "Position" is the X,Y coordinate for where they start. "Enemy" is the type of enemy to make. And finally "Pattern" is the kind of AI pattern they should follow.

Of course, tweak the above to however you have your stuff set up.

Psuedocode follows:


void SpawnEnemies(int NewScrollPos)
{
  while ((NextSpawn < Spawns.Length()) && (Spawns[NextSpawn].Scroll <= NewScrollPos))
  {
    auto& itemToSpawn = Spawn[NextSpawn];
    SpawnEnemy(itemToSpawn.Enemy, itemToSpawn.Position, itemToSpawn.Pattern);
    ++NextSpawn;
  }
}
Once you have the ability to make simple levels by hand with a text editor, then you can consider making a level editor to make things easier smile.png

Edit: Beaten out by SmkViper when I had to run an errand. Blast! :)

An editor would certainly speed things along, but I don't believe hsidnomeL knows what kind of data to put in there. First, we need to figure that out. smile.png

You have random enemy spawning working, but you want to define a level. After 10 seconds have passed, spawn 5 space pirates, 1 second apart, at the top middle of the screen.

Our data needs to answer the following questions: When do we spawn? Where do we spawn? What do we spawn? How Many? How Fast? Here's how an xml section might look:


<Level LevelNumber="1">
    <SpawnEnemy Time="20.0" LocationX="0.0" Type="SpacePirate" Amount="5" Delay="1.0"/>
    <SpawnEnemy Time="35.0" LocationX="-50.0" Type="PirateBoss" Amount="1" />
</Level>

Once you have this data where your program can see it, your level manager keeps up with how much time has passed. Once 20 seconds is reached, it starts the first spawn timer and spawns one "SpacePirate" every second for five seconds. You can get this working with hard-coding data, but I'd move it to data files as soon as possible.

I'm no master of the genre so perhaps someone more knowledgeable can refine my suggestion, but I think this will work. A better "When to spawn" might be a distance unit instead of time.

As for whether it should be Lua or XML? it should be whatever format you have the easiest time editing and loading into your program. Even if it's just a text file, 1 line per spawn enemy instance.

- Eck

EckTech Games - Games and Unity Assets I'm working on
Still Flying - My GameDev journal
The Shilwulf Dynasty - Campaign notes for my Rogue Trader RPG

Edit: Beaten out by SmkViper when I had to run an errand. Blast! smile.png


Great minds think alike? tongue.png

Thank you all for the quick responses! You've been very helpful and after some consideration, I've decided to go with an editor instead of setting up timing in a text/lua/xml file. I feel that, despite the extra work involved upfront, an actual level editor would allow me to design the levels/waves much more efficiently than scripting everything out.

My question now is this; Could the Tiled map editor be used in this situation or is it not a good solution? I could create my own map editor but I believe, if I'm not completely off base here, that Tiled would be able to do what I need it to fairly effectively.

My question now is this; Could the Tiled map editor be used in this situation or is it not a good solution? I could create my own map editor but I believe, if I'm not completely off base here, that Tiled would be able to do what I need it to fairly effectively.

Tiled should be fine. You could define particular tile types as spawners pretty easily (even on an invisible [in your game] layer).

Personally though, I just prefer procedural level generation. It saves you a lot of headache and work in level editing, and you don't have to worry about importing and parsing the tiled map.

It's a bit of tweaking your algorithm, but depending on how long you plan your game to be, can be a lot less work in the end (Also, if you need to change the game balance, which is likely, you don't have to go back and re-edit all of the levels: you just tweak your procedural generation a bit).

Hi, good choise.

I,m still busy with my own edittor, but i,m giving you how i wanto make things ( so its not bragging yet ).

In a scrolling shooter, the enemys must be defeated, before the next background comes,

so you could build a self destruct mechanism, then still if you defeat the enemys to fast, you have to wait for the background for the next wave.

So you should loop a background, when the enemylist is empty : change background & spawn next wave.

Therefore i make a normal edittor, with the option for the loopings for 2D shooters, otherwise it will be standard 3D maps.

hope this helps.

By the way for you who dont know much about shooters :

A side scroller does scroll, the players & enemys are not moving exept when moving~!!!

The game camera is Always at x 0 y 0 ( exept for intro movies ), the background camera can move a bit for nice looking effect.

S T O P C R I M E !

Visual Pro 2005 C++ DX9 Cubase VST 3.70 Working on : LevelContainer class & LevelEditor

If you were lost with figuring out a data format for your files, you may want to hold off on the editor. Here's what I recommend.

  1. Figure out a data structure you're happy with.
  2. Build a level in code.
  3. Play it/tweak it a bit just to see what you might want to change about your data structure.
  4. If you have your data in code, you can probably export it to a file easily.
  5. Read your level from the file, make sure it works.
  6. Make a new level in a different file, and try that one.
  7. Now that you're familiar with your data/layout, start working on an editor.

I think if you just start with an editor right now, you might get lost in the weeds. Feel free to ignore this advice for now. But if you do get lost, come back and give it a read. :)

- Eck

EckTech Games - Games and Unity Assets I'm working on
Still Flying - My GameDev journal
The Shilwulf Dynasty - Campaign notes for my Rogue Trader RPG

Jeah ofcourse you need something working, so you can load your maps.

S T O P C R I M E !

Visual Pro 2005 C++ DX9 Cubase VST 3.70 Working on : LevelContainer class & LevelEditor

This topic is closed to new replies.

Advertisement