Well, this thread is too old, but the question is always valid; I make my background stages by the more simple way as possible: build a big map and save it like an unique image.
But, in my project "PIXEL FIGHTERS" I'm trying to build maps starting randomic tiles that use mathematical combinations. This way, the map NEVER repeats when players run the game, the combination algorithms run aleatory pieces, and those pieces merge themselves, building a background environment.
The objective is prevent the players to remember where enemies spawn, where bonuses are hidden, where stay avoiding bullets...
For this, I built five objects to be the pieces of map; Each one of these pieces have 20 internal subpieces, and these have 40 frames, that always change according some mathematical combinations of frames.
So, the mathematical combinations define which frame will be showed according scenario of sea, desert, city, forest, snow...
I'm making it using flash MX AS1, and the codification is very simple. In general terms, the method is:
1 - Each stage/mission is defined by numbers, from 1 to 40 (more some secret stages). So, if first stage is called "1", the program will search the pre-defined environment to it. The main 5 pieces are classified like CITY, ISLAND, FOREST, MOUNTAIN and RIVER/LAKE; Into each of these 5 main pieces, there are 20 sub pieces with equal design, but with different colors and details, to be showed according the environment. Finally, the 40 frames contain little elements like cars, houses, trees, buildings, bridges and others. Those little elements also are selected by the same randomic code that controls the main 5 pieces.
See some examples:
2 - When the program reads that the stage/mission is "1" (or other number between 40), another piece of code says if the environment of these mission is : the CITY, ISLAND, FOREST, MOUNTAIN or RIVER/LAKE; This piece of code is a simple loop similar to old "FOR... NEXT, GO TO..." from basic. See:
Code: Select all
//ESTAGIO 1
if(_root.estagio==1){
this._x = 62.5;
this._y = this._y + 0.5;
this.gotoAndStop(2);
_root.ilha2.gelo.gotoAndStop(_root.frame_ilha2);
}
Translating from portuguese, "ESTAGIO" means "STAGE", "GELO" means "ICE" and "ILHA" means "ISLAND". Flash allows you to write using anyname wha you want, for variables. The coordinates _x and _y are the position of piece of map, this case, an island. Finally, the variable "frame_ilha" is an aleatory number from 1 to 40. It is changed when the piece of map appears on screen, on a position above the visible area for player. It runs when the piece of map is removed from screen, and stop when the piece spawns again.
See:
The great advantage of this method is to create incredible maps that (almost) NEVER repeat. At least, until now, none respawn EXACTLY equal the map that been shown before.
This method is fun, these are some results:
Unfortunately, one of five main pieces is showing a strange bug that causes a confused visual when the game runs.
But patience and new tries can solve this problem.
Well, by today is this
