Devlog 4
Source: Dev.to
Perlin Noise Generation
In this devlog I added a simple Perlin‑noise based terrain generator.
Perlin noise smooths white noise (random static) and can be combined in multiple layers—called octaves—to produce more natural variation.
The implementation works as follows:
- Determine the grid index of a point and retrieve its height value from the noise map.
- Compare the height against thresholds:
- Above a high threshold → place a tree.
- Below a low threshold → place water.
- Otherwise → grass.
Creature System
I created a basic creature system that serves as a foundation for future creature types. Each creature has two states:
- Active – the creature moves around searching for food.
- Recharging – the creature remains stationary to regain energy.
State transitions are handled simply: when a creature runs out of energy it switches to recharging; once fully recharged it returns to active.
Player Movement
Player movement is implemented by moving the environment rather than the player sprite, keeping the player centered on screen. When the player approaches the edge of the background, the background stops scrolling and the player character begins to move within the screen bounds. If the player reaches a defined edge threshold, movement is halted.