A game prototype inspired by Motorball from Battle Angel Alita manga.
I've been contacted by some friends to help creating that fun racing and fighting prototype. My mission was to create 3 systems:
a race editor using SplineMesh,
two navigation mode for fighting and racing,
a basic artificial intelligence.
The Motorball is a fictionnal sport where wheeled cyborgs race on a dangerous curved track, trying to catch and keep a heavy ball the bounces randomly. Almost everything is allowed and it's not rare to see racer fight with each other, even completly forgetting the motoball at all.
Track: SplineMesh was a perfect tool to create the curved tracks of the Motorball. The artist of the groups created 3 track profiles, and 3 connections between these profiles. At this point, all I had to do was to create a spline and place the module I wanted on each curve.
The difficulty here was to make things perfect. We needed to have a total précision in the connexion and normals, because the character uses these normals to change camera LookAt vector. Any difference between track segment was causing camera glitches. You may think a simple lerp would have been sufficent to avoid glitches but as we will see later, the camera was controlled by two different systems and lerping was not possible.
Lights: Then we needed to place lights along the track. Thanks to SplineMesh sower script, it took more time to create the light prefab than to place them along the spline. And of course, thanks to SplineMesh update system, the light are moved when the track is deformed, so we didin't have to worry about it again.
Pillars: The last part was to place pillars below the track. For the feature, the sower was not sufficent as it would place pillars everywhere on the track which was not allowed. I created a dedicated script based on the sower.
The pillars are places vertically, not accordingly to the track slope,
pillars are placed only when the slope (pitch and roll) is not too important,
pillars are only placed if no obstacle is present below the track.
A major gameplay element was the navigation. The requirement was to mix fighing and racing and have them both fun. I tried many things but the result was never satisfying: either racing was fast and fun, but fithing was impossible due to high speeds, or the contrary. Of course, having an intermediate speed was causing both game phase to be boring.
Fighting itself was a problem as we wanted to avoid projectiles for two reasons:
any long range gun would have killed the gameplay as you would be able to shoot your enemies on the other side of the track
aiming was almost impossible due to the camera following the track slope.
We ended up with a simple system inspired by the game Overwatch, all abilities and guns would have a limited range of action. This forced players to make close combats either on dedicated arenas or directly onto the track.
These melees and close gun fight where so fun that we decided to separate fighting and racing a little, and ended up using a "run" key, leading to two different cohabiting gameplays:
When the player runs, the speed is massively increased, the camera follow the track slope, the character has momentum and collisions and some abilities are not available, like aiming and jumping.
When the player walks, the camera stays vertical and the character behave mostly like in any fps.
The game ended being an alternance of run/intercept/fight/capture the ball/fly away/chase that is quite fun !
In a small indie team, with different plannings and availabilities, it's hard to test your latest feature if nobody is available to join the game right now. So I created a very simple artificial intelligence, basically to have some dummies to shot at.
The idea was to have them follow the spline and run for their live. It was done by finding the next spline node and aim at it, to continue racing correctly even if they are bumped away. This ended up with some fun behavior, as always when you code artificial intelligence ^^