X-Speed (Red Forest part 2)
Continued from this post:
With Red Forest, I wanted a hover-racer, but I needed it to be easy to update and add extras. The amount of effort required to create each track was immense. How could I solve this problem?
It quickly became obvious that although I liked the feeling of the simulated hover vehicles moving over bumpy terrain, others disagreed. This combined with the effort required for each track made me think:
What if I procedurally created my tracks?
I then found this post, which got me started on my idea. I could remove my terrain, lay out waypoints and generate a track to follow them. Awesome! Getting that to work well was very, very difficult at first- I’ll go into more detail on how I fixed that in a future post, because it’s quite interesting, but it doesn’t fit here.
I bought a cheap “city building” pack from the Unity Asset store and spent quite some time working on a track generator that produces quite interesting tracks with a city theme. As a result, we could no longer call the game Red Forest- now it’s called X-speed, until we can get a better name for it!
So what’s different?
- AI ships use 75% less Raycasts than Player ships to reduce CPU usage on mobile devices. the player ship still uses all 4 for full “hover” simulation. You don’t notice the CPUs using full hover simulation so this is a massive saving for minimal change to gameplay.
- Procedurally generated tracks: The tracks generate city pieces around the racing area giving it a populated feel.
- Better textures: I wrote a ship shader so that each ship is a single pass render, rather than three passes is Red Forest. I wrote a single shader that takes a base detail map, and second and third texture layers that are used as paint layers. It’s specular too, so they look nice and shiny, and all in a single draw call!
- Shadows: Unity added shadows to Unity Basic recently, and as a result, there’s a HUGE improvement in visuals on desktop platforms!
- Better physics on the player ship: Ships now gain speed going down ramps and can better handle up-ramps.
- SPEED: Its faster than Red Forest- more of the adrenaline pumping racing action. Not only does it feel faster, but it runs faster, too. Less CPU and GPU usage as there’s no terrain system and the internal calculations have been refactored.
- Controls: They’re less juddery when the framerate drops, and as of the next update, keyboard control is now viable. Previously, keyboard controls were terrible and too sensitive.
You can play the current Xspeed prototype here. At the moment, the track generator occasionally puts a city piece on the track. A fix has already been prepared and will be uploaded after testing.