Emergent Behaviour
Procedural Generation
September 9, 2024 - October 4, 2024
This project explores emergent behaviour using Unity, showcasing where individual entities follow simple rules to produce complex behaviours. The simulation demonstrates swarm-like behaviour in a 2D environment.
Role: Sole Developer
I designed and programmed a simulation to investigate emergent behaviours. This project is based off of an Augmented Reality Sandbox I saw while at NSCC - COGS campus.
Challenge Identified:
While demonstrating the code, I noticed that certain playthroughs of the game appeared to work well, but I later realized that the tiles' colliders were interfering with the "get neighbours" function. This issue caused the flocking behavior to malfunction, as the colliders were being considered as part of the neighbours.
Action Taken:
Upon identifying the issue, I quickly fixed it by adjusting how the neighbours were being retrieved. I added a check for the layerMask to ensure that the colliders weren't the only factors being considered when determining the neighbours.
Reflection:
This experience highlighted the importance of carefully considering all factors that might affect interactions in the game. It also reinforced the need to thoroughly test and debug while explaining the code to others, as sometimes issues can go unnoticed until reviewed from another perspective.
Challenge Identified:
For this project, I followed a couple of tutorials to implement the emergent behavior of the flock. However, the one area where I deviated from tutorials was the background. Specifically, using game objects instead of sprites for the hex grid proved to be a bit challenging, particularly in setting up and aligning the grid properly.
Action Taken:
I researched how to implement a hex grid, focusing on determining the correct cell size and layout. Additionally, I worked on figuring out how to "paint" the game objects onto the grid efficiently. This involved trial and error to ensure proper placement and seamless transitions between tiles.
Reflection:
While creating the hex grid was initially difficult, I am very pleased with the final result, as it offers a visually appealing alternative to using a square grid. The hexagons give the terrain a more natural "land-like" appearance compared to squares. Once the grid was set up, adjusting its size became a straightforward process.
That said, there is still one unresolved challenge: identifying which game objects surrounding a tile belong to the same type of "land." This limitation suggests an area for future improvement, such as implementing a neighbor-checking algorithm to evaluate adjacent tiles more effectively.