Race dynamics in MyGPTeam Turbo
Howdy managers, friends, fan, random visitors and strange creatures which visit our blog!
Hope you are all doing fine! We, at Interactive Project, have been quite involved in planning and working for you on our last game OverVolt: crazy slot cars! The game has been out on Windows Phone store in exclusivity for almost three months now, it enjoyed over 270.000 downloads and, thanks to all your feedback, is in continuous evolution (check the dedicated blog section here if you want to know more about OverVolt).
Today we are back with something different from the weekly appointment with OverVolt cars and are back with one of our programmers! Here for you, with something more technical, written for those who are interested in how being a start-up works, want to learn from our previous experience or are simply curios of how their favorite games came to life!
Today we are here with our developer Ennio! Ennio, known as Sant’Ennio or Sir Ennio the prince, because of his knowledge and professionalism, is one of the component of our team of developers. An architect-to-be until few days before the beginning of the university, when he decided to get a degree in computer engineering. Soon after that he came to Rome, few years and works after he finally landed at Interactive Project! Now every game of our company has been coded and perfected also thanks to his knowledge and work.
We sat with him today and asked him to give us some insights about his work. So, after few months we are back with are back with the technical insights by Interactive Project!
Today we want to present you some concept from an older game of us: MyGPTeam Turbo. Ennio dedicated time to study and implement the dynamics of the races. But first… what does MyGPTeam Turbo races have which makes them different from a classical racing game?
Simple answer! MyGPTeam is not a simple racing game, but is a managerial racing game. This means that races are not run by the gamer; easy to understand in essence, not so easy to implement. This because when the player is racing in first person the race is run in a just-in-time simulation and bots’ behavior is determined by the environment and in relation to the player driving through the circuit.
Not the same in a managerial, where the cars have to drive and compete on pre—decided paths and times with a known result of the lap.
So how did our developers solved the problem? Ennio explained us that what happens in MyGPTeam Turbo, and what happens is that the remote server decides the time and the performance of the car depending on cars’ stats, pilots’ training and a series of other statistics. So, the server estimates the lap time and sent it to the client; client which is responsible to receive the times and take in consideration other events like the minigames. One of the mini-games is aimed at reducing lap time. After the game the client sends to the server the result and the server analyzes the new time, which is sent back and updated to the client which is in charge to change the car behavior accordingly.
How the car regulates its speed
What happens is that the cars work to respect the time decided by the server while giving back to the players a realistic rendering of the race. Every moment in time the car checks the point in which is in the circuit and how much it misses to the end of the lap, while analyzing how much space it misses. This data are used to regulate the speed according to server’s lap-times thus accelerating if there is a delay with the server times or decelerating if the car is ahead of the time.
How the car moves in the circuit
At the same time the cars have to regulate the way they move in the circuit. That is done through the implementation of steering behaviors. Steering behaviors determines a series of rules the object “car” has to respect in the races.
For example, the car, in order to avoid going out of the circuit, received a command which generates a series of controls around the chassis and, when the borders of the circuit approach the car simply corrects its behavior in order to go back to the centre of the track. Cars avoid collisions with each other applying the same logic.
For take overs it is important to know that there is a “suggested” path in the game which is usually respected by the car. So, when the servers’ times require a takeover during the lap the cars start behaving in a more “aggressive” way, following an ad-hoc racing path different from the suggested one, a path which allows the object “car” to take over the other car(s). After the car takes over the aggressive path becomes obsolete and the car starts again moving around the suggested path always respect the servers times and accelerating or decelerating accordingly.
All this process was not easy to be developed since required the study of steering behaviors, which were deeply analyzed by our developers; moreover the functioning was firstly tried on Java and, only as a second step, was then ported to Unity. Long work! But, with great results as the races on MyGPTeam Turbo!