Back In highschool I made a aeroplane-shooter game inspired by games like Scramble Spirits. Looking back at it now it was poorly written, but it got me good marks at the time. Years later I attempted to recreate it in 3D in Java again.
I suppose the project halted because the random level generation wasn’t interesting enough and it was either impossible or not challenging enough.
Here’s one of the old posts:
I got to the point in this project where it is time to either write a level editor, or work out some sort of dynamic map generatior. Many times I have been caught up in creating an editor that I never get back to the game, so this time I chose dynamic map generation.
The tiles are calculated as soon as they appear on the top of the screen, so each tile only has knowledge of the ones below it, or the ones to the left of itself on the current line.
I ended up doing this in 2 passes.
Work out if the tile should be a water tile or land tile. This decision is based on the type of surrounding tiles that have already been placed. This boiled down to 10 rules which prevent all impossible cases which i didnt have suitable cliff tiles for.
If no rules apply, a random tile can be placed. In the video, the frequency of random water tiles goes up and down as the level progresses.
This pass is performed on the second row (or lower, as shown in the video) so that each tile in the row has knowledge of all of it’s neighbouring tiles. With some fancy code including bitwise operation, the result is appropriate, seemless cliff tiles.
Here’s a screencapture I did, with the 2nd pass moved to the middle of the screen