This project was created in collaboration with one of my colleagues for our lecture in mobile games. We got a
java environment which called native C++ code. This was for the purposes of future porting to other platforms.
Our task was to create a game that used sensor inputs from the phone as a main way to play the game.
We decided to use the accelerometer to convert tilting motions into horizontal movement.
We basically had to create our own little C++ rendering engine for sprites to draw a game onto a screen with a camera. To accomplish this, we looked at the very helpful tutorials from https://learnopengl.com/ and implemented a texture, shader, sprite renderer, resource manager, class along with two shaders, one vertex and one fragment shader.
Some horrendous programming hell hours later, we were able to create some sprites, yeeey! We then created smooth horizontal movement and basic shooting, some simple obstacles that would fall from the top of the screen to the bottom.
And that was our first assignment.
The second assignment was to create a particle system. I wanted to program this system and let my college create a spawning pattern for the obstacles and resizes the game screen, because we did not do that right at first. I started by creating a particle pool from which objects would be pooled. Particles are a simple struct position, scale, velocity, colour, rotation, life and depth. These particles get pushed between two deques one for active particles which will be iterated over while updating and drawing and the initial particle pool where inactive particles. Every update cycle the emitter spawns rateOverTime particles. Spawning means that rateOverTime particles get transferred from the particle pool deque into the active particle deque so that we don't have to loop over all particles when determining whether to update them or not.
The particle system is capable of attaching to another gameobject in our scene so that it can follow this object on its path. This is used for our meteorites to let the star particles seamlessly follow our obstacles. It can also be spawned without a reference transform and exist at its own position which is used when an obstacle is destroyed. On top of these simple features the particle emitter can loop its particle system, assigning a random velocity over lifetime, duration, colour gradients over time, fade out, and many more.
(Yes I like to overengineer things X)
Please reach me at firstname.lastname@example.org if you want to get in touch.