Prototype – Infini Roller

This project came about as Unity released Netcode for game objects (NGO). While I was reading some info about NGO I was thinking what simple yet fun game could be put together quickly to try out the multiplayer abilities. well how about a game where you roll a ball around ( I mean no one has ever had this idea before) and race other balls (players) in a randomly generated track.

It did not take long to get the networking together working an having multiple balls on the screen. Once I got the track generations working( more on that in a moment ) I quickly found my self racing around the world with my son. He however was less pleased than I. This was because he was experiencing quite a bit of lag. You see I was doing everything physics based with the server having authority on final positions. The non-server computers would interpolate ( assume ) a position in the world which was delayed enough to to make it difficult to turn. You could learn to tern early. Also Good luck controlling it after you hit another player or obstacle. I found that to make this work properly in realtime I would need to add some form client side prediction with rollback. Supposedly unity provides an implementation using their NetCode for Entities solution found here.

Not wanting to get into the nitty gritty of client side prediction nor switch to Entities I decided to improve the level generation instead. Here is a short run down of how it works. key level components are… Level, Level Piece

Level Piece

Level Pieces are a prefabbed Object with a Collider, Mesh and custom Piece Component on it.
Piece Component Has a list of transforms that determine the path. for Instance a straight piece would have a start and end only, but a curved piece would have another transform placed at the corner. There are always Start and End transforms used to connect the next piece together (currently there can only be one connected piece). Pieces can be different sizes as long as the start and end transforms are centered they will connect just fine. Some pieces are programmed to move and some have moving obstacles on them and pieces have gaps to jump. If you want to ramp up you just make a ramp piece that is rotated on one of its axis.

Level

  • Levels contain all the World data which consists of..
  • Starting Point,
  • DeathCollider(kills player and restarts at beginning )
  • Win Collider
  • Key Pieces – List of all the available pieces to generate with
  • Level Pieces – List of all the Pieces that were generated using the Generation input
  • The Generation Input. which is a Comma separated String of indices to pull from the Key Pieces

Actually the most difficult part of the level generation was getting the pieces to link together smoothly. while it wasn’t too difficult it did take a bit longer than anticipated. The Ideas is each piece has their own start and stop point(transform) and the next generated piece will attached to the previous piece’s Stop Point.

In the future if I was to do something with this I would, add sound, new visuals, come up with a better them, either industrial, or forest I think, but maybe a multi theme where it changes based on levels. It would be nice to have grass that could be displaced. Next add another challenge and make it where there are bad guys shooting at your ball and you can squish them.. okay you see where this is going so Ill stop.

Leave a Comment

Your email address will not be published. Required fields are marked *