Spawning Errors

Beelonging

Hello there!

My name is Fredrik Henriksen Lövlie and I am studying Programming and Game Design at Uppsala University, Campus Gotland. During our current course (Game Design 2: Game Development) we are required to write weekly blog posts about our design process and the progress of our 2D Shooter project. The game we decided to make is called Beelonging and is designed to evoke the feeling of belonging to a group.

This week I worked on changing the way our enemy spawner worked, this needed to be done because our previous version was random and to make a level design to speak of we had to be able to design the spawning by hand. To make this spawner I decided that I had to design it to be able to choose the time from the start of the game the spawn needed to occur and the location on the Y-axis. The X-axis is not important since all enemies spawn from the right side of the screen and fly towards the left. I also decided that I wanted my spawner to be accessible to anyone that didn’t have coding experience so that the level design could be done by anyone in the group. Finally, I wanted the spawner to be able to spawn swarms of flies since we wanted them to appear in waves.

The way I solved this is by creating a Game Object that’s just off the right side of the screen and within its script I made a class that holds information about the Y-axis, the Game Object that was supposed to spawn and the time that the object in question was supposed to be created. Then I made a list to hold a number of those classes and made that list public. This way anyone with access to the unity editor of the project could decide all of these variables for every object as well as increase the size of the list. The way the spawner was then used to spawn a whole swarm of flies was through making an empty game object and having that object be parent of all the flies in the swarm and placing all of them in relation to the parent in any formation that you’d like and saving that swarm as a prefab to be used by the spawner later.

Spawner
This is the interface I ended up with

Sadly an issue came to my attention, which was that none of the children of that formation would be updated if the prefab they were based on would be updated. This was a problem since most of the features in our game are designed simultaneously. I solved this issue by making a separate script to create the formations for me based on the position relative to the center of the formation. This way I could even create waves of other enemies or even power-ups which also helped to make the enemy spawner easier to use and less dense to navigate.

In conclusion, this work was important because my job as a programmer is not only to make things work but also to make my work accessible to my peers, not only to the programmers I work with but also with the ones who don’t have experience with coding. This way saves endless hours of pointless work and improves cooperation within the team.

 

About Fredrik Henriksen Lövlie

2017 Programming