Random Platform Generation

This is the second post in a series about Ataraxy, a roguelike platform brawler. Here I will discuss some of the approach towards my Random floating island generation.

 

I started with the idea of island prefabs. I want to have variety in my islands later, so I wrote to randomly select an island prefab and then place, scale, tilt, and texture it. This was a sustainable long term approach.

Clusters – The world is made up of clusters which are located near each other. Each cluster is made up of N islands. Upon creation, a cluster instantiates islands in random orientations and positions into the world.

Other Notes

Cluster Attributes
The yellow, dark yellow and red lines are debug tools I use to evaluate parts of the cluster generation.

The yellow, dark yellow and red lines are debug tools I use to evaluate parts of the cluster generation.

As many of the characteristics of islands vary, a cluster’s parameters control the islands it creates. I found it beneficial to disable certain island initialization steps – texturing, scaling or rotation as it allowed individual clusters to feel distinct from one another. This is my first approach towards the idea of Biomes.

Later parameters such as island tilt ranges, island scale ranges and island perceived size for the Poisson Disk Sampling (smaller size means many islands overlapping one another) allow for greater variation between clusters.

This particular image showcases three different ranges in island generation. The top cluster has no random texturing or coloring, so the islands all maintain a bland template appearance. The other two islands are varied and colorful. Additionally, the top cluster islands are larger, less populated and further apart compared to the bottom two. (Last note: This image was added later after I got into the enemy path-finding components of terrain generation)

Upward ORientation

This is a pair of tips for randomly scaling and rotating the islands. In early runs, some of the scale ranges resulted in islands that appeared sideways in one dimension. This occurred when an islands X or Z scale was smaller than that island’s Y scale. While this isn’t a terrible flaw, I found it beneficial to always make the Y scale the smallest of the three, if X or Z was smaller, I simply swizzled the scales (totally an excuse to use the word swizzle).

The second tip was with the ranges of rotation I allowed. I didn’t want extreme tilting of the islands to where the CharacterController slid off of them, so I randomized the rotation between a min and maximum tilt (generally the same value). This parameter varies between clusters, so some clusters will be more tumultuous than others. As for the Y rotation, I allowed that to vary between 0 and 360, being as it didn’t matter which direction the island was facing.

March Edit: I have since disabled the random rotation of islands as it disrupts the way I can generate path nodes. I plan to re-enable random island tilting after I revise my approach to generating path nodes in a way that is not disrupted by Unity’s lackluster parent-child rotation.

Terrain Features

The environment needed to be adorned with various features to be more immersive and generate player interest. When encounter environments in nature, a meadow has an occasional tree or large rock. I wanted to place ruins, altars and checkpoints that would improve the environment as well as serve game-play purposes.

My initial approach was to give each island a small chance to spawn with a terrain feature from a group of features (checkpoints, altars with tokens, cosmetic details, etc.)

All of the objects on the platforms themselves are generated in the style of terrain features.

All of the objects on the platforms themselves are generated in the style of terrain features.

Some of the terrain features in this image: Early Wanderer (the white beaked, yellow pills with a black outline), token altar (bottom right with the yellow token), ruin (on the island north of the token), a light pillar (on the far back left light brown island).

Each terrain feature is placed on top of the island within the bounds of its edges. I evaluate the size of the terrain feature so that it wouldn’t hang off the edge of an island.

A downside came with terrain features, due to the way rotations are calculated in Unity between parent and child objects, it would skew my ability to place the features atop the island. For the time being I disabled the random rotation and will revisit it later.

While the current terrain features do not greatly improve the environment, they are a step in the right direction.

When I revisit and improve them, I seek to have different terrain features for different type of clusters and islands, creating the beginning of environmental biomes.

Comments are closed