ChiChiLand Adventure: Perlin Maps

It’s been a while since I updated the progress, and I totally skipped any mention of alpha 0.0.7. Now we are at 0.0.8 and although I will be rolling back on some features, I think it’s time to show the progress.

I have been working on two main areas of the game: NPC VI and Level Generation.

  • NPC VI

For the NPC VI (Non-player character virtual intelligence) I needed to script several basic behaviors: growing need, locating the satisfaction trigger, navigating to the trigger and finally, consuming the trigger / resetting the need. Since the navigation seemed like the toughest part, that was what I focused on in alpha 0.0.7.

I begun developing a fairly intricate, completely custom pathfinding algorithm and although it was quite an undertaking for a beginner programmer like myself – it was going great. Then, while browsing the Game Maker forums I came across a discovery that Game Maker Studio has pathfinding built in.

I quickly tacked on the “prefab” solution using mp_grid_create(); and path_add(); method and within seconds had the NPCs chasing the player around the screen. There are still some bugs in finding paths and collisions, but generally it is working.

The problem is: I don’t really like the way it feels. NPCs seem to be all-seeing and all-knowing and can easily navigate even complex path scenarios. While it would be quite possible to hinder and handicap them a bit, I think I will get back to writing my own navigation method on the way to the next alpha.

  • Level Generation

I grew weary of seeing the whole green “garden” temporary texture in the background and decided to create a way to generate some sort of simple texture generator that would make the terrain more interesting. It is a purely aesthetic element and does not affect the gameplay in any way (as if there was any gameplay) but finally I can enjoy looking at the game a bit more.

After a bit of research, I quickly confirmed the theory based on my experience in motion design: I needed a good noise generator, preferably a perlin one. While Game Maker Studio does not have its own (heavily requested) built-in perlin noise method, I came across a set of scripts for creating Simplex Noise by CallTear. It’s light, quick and serves my needs perfectly.

I quickly devised my own generate_background(tilesetObject,frequency); function, which allows me to create noise-based backgrounds out of any tile set. The function, initialized from an object, will analyze its parent and provided tile set, divide the parent into blocks (based on the sprite size of the tile set) and fill it up with a noise-based arrangement using given frequency.

Here are some examples based on a simple four-tile 8×8 tileset:

tileset
tileset, enlarged

 

simplex noise background at frequency of 0.01
simplex noise background at frequency of 0.01

 

simplex noise background at frequency of 0.05
simplex noise background at frequency of 0.05

 

simplex noise background at frequency of 0.15
simplex noise background at frequency of 0.15

 

The cool thing about the system is that I can very easily feed it different tile sets and frequencies and alter the results really fast. The test build below uses a frequency of 0.08 which feels quite fine for now.

Click to Play

 

…and yea, I fixed these awful bush sprites too.