top of page
ProjectTextLines.png

My Roles: Tools and Gameplay, Physx and AI

Short Description: 3D Racing Game + Engine

Duration: November 2017 - July 2018 (8 months)

Team Size: 10 programmers, 5 artists, 6 designers

Platforms: PC, PS4

Tech:

CustomEngineLogo.png

Custom

Engine

VSLogo.png

Visual

Studio

C++Logo.png

C++

CMakeLogo.png

CMake

JiraLogo.png

Jira

P4VLogo.png

Perforce

PhysXLogo.png

NVIDIA

PhysX

ps4-logo.png

PS4 Dev Kit 

NeighbourhoodLogo.PNG

Neighbourhood for PS4

Project description

Our task was to create a custom 3D engine for making a racing game for both PC and PS4. To prove that our engine is working properly we also had to make such a game.

Working in such a big team was not easy, but because we had good communication, solid pipelines and dedicated game developers it was not only fun but also a great learning experience.

After a lot of hard work, we managed to make a designer-friendly engine and a really nice racing game that runs smoothly and with a solid fps both on PC and PS4.

My contribution

1.Tools

DesignTools1.png
DesignTools2.png

I made a tool that allows the designers to create their own vehicles, balance all of their variables and also adjust some of the game settings.

To create this tool, I used Imgui and a JSON parser. With this system, you can create as many vehicles as you want and then you can save your data in a JSON file.

From here you can also assign different vehicles to the different players.

I also created a similar menu where you can set the number of laps you have to complete to win the race and that also allows you to change the map.

When you start the game, the JSON file is loaded and the data from the file is used for the initialization of various systems.

 

This allows for quick balancing and playtesting. If you want to change some variable or the map you are playing on all you have to do is to press "save" and restart the game.

 

Some of the variables can be updated without having to restart the game - you can spawn another AI, change the amounts of laps you have to complete and a  few others.

This is an example of how the JSON file with the setting for the vehicles.

At the bottom of the file you can see that we also save some other data:

 - Player Index - to know which vehicle the player has chosen
- AI Indexes - to know the AI vehicle indexes
- Some other variable used for the AI that I will explain in the AI section.

2. Physx

Drivinity1.gif
Drivinity2.gif

To make the movement of the vehicle as realistic as possible we decided to use NVIDIA PhysX in our project. I had never worked with PhysX before so it was quite an experience to get used to it.

 

Getting the right feeling was a difficult task on its own, but we also had some problems with creating the custom allocators for the PhysX library as we needed it to run both on PC and on PS4.

When I started making the vehicle, I read through some articles about car physics - acceleration, gears, torque, traction and others. So at first, I tried to make it behave like a car and it was quite realistic but it really did not fit with our playstyle.

So to make it more fast paced and fun we decided to add "air break". What the "air break" does is to allow the player to take sharper turns but he has to sacrifice some of his speed.

The idea was that you can still clear the stages without the air brake, but if you use it properly it can make you quite faster.

Another problem I faced was with the camera interpolation. We wanted the camera to follow the player, but to never go too far away or too close. At first, the camera was jittering a lot and I could not get it right but with the help of another programmer, we managed to make it run really smooth.

Something else that gave me some hard times, was the collision of the walls/floor. The PhysX collision works in such a way that if you apply enough force on an object, it can penetrate the collision. Controlling the thickness of the collision was quite difficult but we managed to make it work.

3. AI

DrivinityRaycast.png

I and the other AI programmer had a lot of interesting ideas about how we are going to do the AI. After a lot of research and discussions we decided to go for this:

 - We are going to have waypoints that are manually set by the designers.

 - The AI will raycast in a few directions and then taking into account which direction is closest to the next waypoint and if there is an obstacle in this direction, it will choose the optimal one. 

 - After the direction is chosen, the AI looks to see if the angle between its current forward and the desired direction is at least a certain value - min turn angle (you can see it in the image).

 - If the angle is smaller then it does not turn, but if the angle is bigger it turns in this direction.

But I wanted to have a system that would allow the designers to tweak how good the AI is. So I came up with the idea that we may learn the AI to use the air brakes.

My idea was that if the angle between the current forward and the desired direction is more than a certain value - min air brake angle, then the AI will you air brake.

But if the AI always knows when to use the air brake, how can we make it play better or worse?

DrivinityAIAirBrake.png

It is actually quite simple - we are going to make a simple utility system - we are going to give each AI a certain skill level. The higher the skill level of the AI is, the higher the chance is of using the air brake when he has to. This will allow the designers to tweak how strong each of the AI is.

To make this system more flexible, I made it so that you can set the skill level not just for the entire race, but per lap.

Instead of giving different skill levels for each AI for each lap, I decided to make 3 different groups of AI - front, middle and back group. Each group has different skill values for each lap. The idea is that at the start of the race the front group will have a high skill level and with every lap, its skill level will decrease. It is the opposite for the back group - at the start, they have a low skill level but in the end, they become better. As for the middle group, they stay relatively the same during the entire race.

With this system, the average player should in most cases have AI in front of him and behind him.

I made a menu that allows the designer to adjust the skill levels of each of these groups and also to assign AIs to each of the groups and the data is saved in the JSON file for the game settings.

AISkillChart.png

Here is a video of the AI racing

bottom of page