efficient way of doing level design for auto-scrolling games

Hi, I’m currently doing make some test auto horizontal scrolling game.

In this game, background images move using UVAnimation, with fixed camera position and angle.

Playing character stays where it is, so as a result,

it can be shown as if it is infinitely going forwards.

As character proceeds, Obstacles appear from the right side of the screen and leaves at the left side of the screen.

I’m now positioning each Obstacles in Scene View, but I feel this method is very inefficient, when considering that

there would be more complex levels and patterns of obstacles.

So I’m asking you how should I resolve this problem efficiently?

Could anyone give me ideas?

P.S. I was thinking about making some external files to read such as txt files consits of 0’s and 1’s that may represent empty spaces and houses, but since this project is for iPhone so I rather not try that… :S

A couple of questions:

  1. Is there any particular reason you’re moving the background and obstacles rather than the player? It seem it would be more straightforward to let the background and obstacles remain stationary and move the player and camera instead (but maybe you have a good reason for doing it the other way).

  2. Is your concern about placing obstacles using the editor just that you think it’ll be time-consuming for large numbers of obstacles? Or is there something else that you mean by ‘inefficient’?

An idea I had for spawning enemies in a 2d game could work for you… make a few empty game objects off screen on your right side and have them as obstacle spawners. Then using script, just have your obstacles randomly or specifically choose a place to spawn in front of the player. the more spawners you have the more varied your level can be. Just make your obstacles prefabs… spawn in front of the player and destroy them behind the payer and I think it will work out.

answers for a couple of questions - :slight_smile:

  1. Reason I’ve chose to move the background (although background isn’t actually moving in terms of transform - just background image offset is) is because my player does nothing other than throwing stuff downwards from the air while he is forced to move forwards no matter what, and this process can potentially be infinite loop. if I make my player move instead of obstacles, then the player will end up reaching 1000000 for transform.position.x (I wonder whether this is an appropriate answer)

  2. I believe positing/placing obstacles using the editor is very time-consuming process, and especially when making new patterns and levels. So I was wondering whether there would be more clever way of placing those obstacles in terms of time.

The first thing that comes to mind is to create some sort of custom editor that allows you to build levels in a more streamlined fashion. I created an editor for my current project using editor scripting; it’s not trivial, but it can certainly speed things up when it comes to generating content. So, ultimately it probably just comes down to whether you’d get the time spent developing the editor back in the form of easier level editing.

As for what the editor would look like, I don’t know enough about your game to offer much in the way of specific suggestions for that. But, I imagine you could put together some sort of ‘point-and-click’ interface that would allow for easier placement of obstacles.

Maybe someone else will be able to offer a better suggestion though.

An Editor is the way to go, I have not done anything like this in unity yet but did experiment with it in flash to some extent , you could add add all sorts of jigs to aid rapid level development eg: mass placing an object in a row , creating sets of objects that can be placed again with ease etc… . The placement of items is all dependent on the scenario of the game, it could be infinite world with random placements based on time , but in most old school tiling engines the pseudo movement of the character is measured and items are spawned in relation to where your character is within the data grid , but since this is a modern application and you have frustrum culling doing its work for you , Im sure all the data created from your custom editor for each stage of your game could be rendered for each level in unity in one shot . How you store you data for a level is something you would have to research and decided what works best for your needs.

2unitygirl

Reason 1 is kinda lame. I did waypoints system and my scrolling object loopping over the waypoints
https://dl.dropbox.com/u/14167855/MechSmoke_005.html

I am currently trying to persue two ways of storing objects data:

  1. right in the level. Some script activates nearest enemies and maybe place some items a head of the place. Also removes them when the player is gone
  2. sort of parse the level , write all props data into some arrays and initiate object withins some distance from the player on fly

In any case I find the possibility to manually redistribute props and mobs as an advantage. There can be some object that will be spawn on fly, but others need proper tweaking when and where to appear.