07 Jul 2020

Little Racer – General and Development

Przemysław Piasecki
By Przemysław Piasecki

Prologue

It all started when we were just kids playing slot cars toys, do you know those? Toys for which you had to build a track yourself and then simply put them on it, and race with your friends just by pressing a button! That’s what Little Racer is all about, to bring joy from our childhood times for everyone! We decided to release our game on Nintendo Switch, as joy-cons and console itself suit the game perfectly.

But what Little Racer is really about? 

Having fun, that is it! You can play campaign mode with your friends or/and with AI, build custom tracks and then race on them in the party mode! Let your imagination run wild, and build amazing tracks filled with many obstacles difficult to avoid. Do you want a lava geyser? You got it! Want an orca jumping out of the water, leaving puddles on the track? No problem! When you are done with designing your level and making it difficult, you can decorate it with a press of a button!

Our project went a long way to be where it is now, it started as a simple little game on one of the Game Jams in Poland, then went through rapid prototyping stage, where we created mobile and PC version, but then decided to stick to Nintendo Switch.

Development

Little Racer is more than just a simple racing game, we created complex systems for AI, obstacles, level editor, racing and achievements.

Cars are moving on the invisible Bezier Paths to simulate slot cars-like mechanics of movement, and it allows us to control the behavior of cars – we were able to decide when it should fall of the track or jump through a ramp.

We have 4 different types of AI and each of them is based on a state machine, having: chasing state, leading state, loser state, and medium state- which specify the behavior of the specific AI. They define the mechanics of AI, how fast should they ride, the probability of them avoiding the next obstacle and slowing down on turns.

In the release version of the game, there are 22 different obstacles, with unique mechanics such as Yeti, who will try to hit the closest car that rides towards him.

As we have mentioned before, we have developed and integrated an achievement system, which allows the player to unlock new maps, obstacles, and cars as he or she progresses through a game, but it is not always about winning the race! In some of the achievements you really have to show off your skills.

 

One of the most complex systems in the game is the level editor, which allows users to create levels, using worlds and obstacles unlocked in the campaign mode. All of the data about the position, rotation and many other elements is stored in JSON files, which are then loaded through our SaveManger when the user decides to open a particular level.

Optimization

We had some challenges during our development phase, such as setting up the camera field of view to the size of the track created in Track Editor or optimization. Because our camera is rotated by  45-degree angle and is pointing down towards the middle of the track, we had to calculate proper bounds for it, knowing the angle and distance from the level itself. Here is a snippet of a code that does just that.

Another challenge we had to undertake was optimization. We had to optimize our graphic assets and sounds – more information about that will be included in our next post about Design and Arts. From the code side, we had to optimize the way we spawn all of the objects for each level and random decorations in level editor. We achieved that by using object pooling and coroutines to delay spawning of the object. Instead of spawning all of them at the same frame, what caused a visible freeze. Optimization is very important on every platform but especially on Nintendo Switch and mobile, simply because their specification isn’t as high as PC or other consoles.

Instantiating and destroying objects is very heavy for game performance. That’s why we used object pooling, which deactivates already spawned objects and returns them to the pool, so they can be reused next time when they are needed.

Przemysław Piasecki
By Przemysław Piasecki
SIRBart

Call The Knights!

    Table of contents