Space Hero
Me and a group of 3 artists were tasked to make a game about space. We ended up making a space-themed bullet-hell game. I did most of the programming work for the game. My largest systems are a bullet object pool and the enemy shooting.
This project used trello for task management and github for source controll.
Showreel
The aim of the game is to dodge incoming projectiles and make your way to the end of the level where you must defeat the final boss
My contribution to the project
- Designing the core game.
I did all the core game design for this project.
- Creating the player movement.
I created the basic player movement system
- Making the player/enemy shooting systems.
While the player shooting system was pretty simple, I wanted the enemy shooting system to be ajustable in projectile count and shot angle.
- Creating an object pooling script for the enemy bullets to avoid instantating and deleting them constantly.
One of the first things I thought we might need was a system to optimize the spawning of the large amount of bullets on screen. After some research I figured an object pool would be a suitable way to do this.
The feature I am most proud of is the bullet object pool system. It worked perfectly and it led me to understand more about optimalisation. Its also the feature i spent the most time on. The enemy shooting system was developed to work hand in hand with it.
Bullet Object Pooling
Because a bullet hell game may potentially have hundreds of bullets on screen at one time I realised that we had to optimise it in some way. After some research I realised that instantiating and deleting the bullets constantly would be the biggest issue to fix.
To that end i decided to create an object pool for the bullets that would only instantiate new bullets if there were not currently enough. After the bullets are instantiated they are then added to a list of bullets. When the bullets are no longer needed they are then set to inactive instead of being deleted. If an enemy needs to fire a bullet it first checks trough the list of bullets to see if there are enough inactive bullets available to use. The enemy's shooting script then takes those bullets, gives them the proper position and direction, and then sets those bullets to be active again
Here is a video showing the pool filling up with bullets until it has enough bullets for every enemy to fire
This is the code for the bullet pool. First it creates an instance of the bullet pool so that it can be acessed anywhere, and after that we create the list that holds the bullets.
The GetBullet function is called whenever an enemy needs a bullet, instead of them instantiating bullets themself. This function will loop trough the list to see if there are any inactive bullets, and if there is, return the inactive bullet.
If there are no inactive bullets found in the list, and growPool is set to true it will instead instantiate a new bullet.
What i learned from this project.
- Techniques for optimization.
Looking into a way to optimize the bullet hell i came across many pages about optimization. This led me to look more into things such as code optimization in the future. I came out of this project with more understanding and awareness about optimization.
- Working in a team.
This is the first time I truly worked with a team. Unfortunately we were forced to work long-distance so there was plenty of misscommunication. Being unable to have face-to-face meetings for my first team project was a shame, but it was also a great learning experience.
- The importance of implementing the core features first.
The biggest mistake I made was focusing too hard on implementing all the features we had planned instead of first focusing on the most important ones. This led to some features being underwhelming and others being worked on but never implemented since they were unfinished. This realisation caused me to change these priorities in the future.