I was watching a Unreal Engine developer on Twitch. He had made a battle royal game with pirate ships. Twitch users could write “!join” in the chat and they got their own AI pirate ship with health. The ships then sails around shooting at each other until one is standing.
So I took that idea and thought it would be cool if you had a racing game with twitch integration. Was thinking of making a mix between the retro Micro Machines and Mario cart. First I started with the vehicles. I used a plugin I had in my vault called Advanced Vehicle Systems. This allows me to quickly create child vehicle with different speeds, wheels, bodies and springs. I used a mesh from Kenney for my little race car.
Then I took on the AI, which was the tricky part, but first I needed some waypoints. Just a bunch of coordinates that the vehicle would follow. So I made an actor, and in that actor you can add the next way point into an array (so you can split the road.) Then for for my AI I had to make sure the AI would steer towards a location, and when it reach the location, it will then find the next location and steer towards that until the track is complete. When it comes to a split. It will just select a random direction.
Now in a lot of places the AI can bug out if it can’t acces the waypoints, let’s say if they fall off a bridge and can’t get back to the waypoint that is on the bridge. So I had to make a destruction system on my vehicle. Any time the vehicle is falling to far, is on its head or stuck, the vehicle will explode.
The track it self is just a bunch of tiles I made in 3dsmax. They fit together if you snap correctly. I choose this approach to make it easy to make new track tiles and also to build tracks fast.
To implement with twitch I went to the Unreal Engine marketplace and got Twitch Works plugin. It allows me to connect the game to twitch and receive the chat messages and other things that is happening on the channel. I then check if users write “!join” and check if they already have a car. If they don’t, I give them a car and and after a signup period and we have reached 32 vehicles, we are off. It goes ready, set go and the AI drive.
I coded this in about 1 week, and it was really fun. I don’t think its complete, I have to add more obstacles that creates funny situations. Also I need to give the players the ability to vote on maps, and get random vehicles and random start points.
It also opens up for giving say the winner of the previous race a special vehicle or cool vehicle decals etc. You could let the streamer decide how to set up the races and also have tournaments if the player count reaches say 32 or more.