A short prototype inspired by the mobile game, Pocket Frogs. The prototype is based on its pond mode and mimics the lily pad generation, along with determining a chance for if the lily pad has loot on it.
Engine: Unity
Team Size: Solo
Project Length: 1 day
Role: Programmer
Focus: Random Terrain Generation
The main script of the prototype generates the positions of the lily pads from a pool of available objects. Lily pad objects are placed as children under the LilyParent object, which is used to create the pool of lily pads the positioning function can pull from. The nodes are empty objects placed in a grid pattern.Â
Once the lists are made, the lily pads are placed in a position by randomly selecting one of the node locations. To prevent the lily pads from generating in the grid pattern the nodes are in, another level of randomness is added onto their x and z values. Then, they get a random size applied to them. Finally, when their size and position are determined, the chance whether or not they have a frog (green), a common gift (yellow), or a rare gift (red) is calculated. The material colors of the lily pads are changed to visually indicate if they passed one of the checks. If not, they stay the same.
The secondary, much shorter script simply edits a lily pad's position if it generated too close to another. If their colliders overlap with each other, their x and z values get regenerated to compensate. Some overlap still exists afterwards, but in the base game, other lily pads have overlap with each other as well.