Rookie Awards 2024 - Open for Entries!
ElectroMagRace
Share  

ElectroMagRace

by amencanc on 31 May 2023 for Rookie Awards 2023

A racing game, set in a Cyberpunk/Sci-fi environment

0 83 0
Round of applause for our sponsors

The Track Configuration System

The track mesh

The Waypoints - to model the knowledge of the best path along the track

the speed points - to model the knowledge a pilot has about how fast must be in every point of the track

the Path - to know at each moment which is the percentage of the track where the car is

The speed knowledge is generated at startup from the Speedpoints, and it results in an Animation Curve

The system is made in such a way that the following conditions will be satisfied:

1) the order of the waypoints is not relevant - a user can configure the list of the waypoints not taking care at all of the order. The waypoint list will be built at Startup and sorted correctly to reflect the order in which each waypoint appears on the track

2) the order of the speedpoints is not relevant - again, while configuring how fast the pilot can go on each curve, the brake-points and so on, the order is not relevant. At test phase, while testing the configuration, new speed points can be added at will. The speedpoints list will be used at Startup to build the "speed knowledge" of the Artificial Pilot

These conditions ensure that the knowledge of the track of the Artificial Pilot will be fully configurable and customizable just placing the points on the track where they have to be; e.g.: if the pilot must brake until reaches 150 km/h in a certain point before a curve, we just need to put a speedpoint configured at 150 km/h on the track, in the point where the car must reach the desired speed.

The pilot will know how to interpolate the speed reduction from the last speedpoint until the next speedpoint is reached.

Modeling The Engine

To model the engine behavior, in terms of Torque and Power, an animation curve has been used with real vlaues taken from a real engine, thus describing a Torque/Power curve as if it was in real life.

The Torque curve must be expressed not in RMP, but in meters per seconds, so we have to take a particular gear as a reference, knowing the minimum and the maximum speed of the reference gear.

The second step is to define which is the maximum speed reachable for each gear to extract the corresponding torque multiplier, to simulate a real engine behavior. The correct torque multiplier is derived by the maximum speed reachable by the target gear.

Once done and correctly configured without too much effort, what is interesting is the correspondence we get while comparing the engine performance, having a real-life 0-100 Km/h in 3.7 seconds, that replicates also in the game.

Modeling the Artificial Pilot behavior

Benefits of this apporach

The use of a Behavioral Tree makes much simpler the process of modeling the overall behavior of the Artificial Pilot, being able to refine the sub-behaviors and concentrate only on the single task, not risking to mix code in a giant if-else cascade or implementing a Finite State Machine whose states number can explode if a refinement must be made.

All together

Clean - Without Configuration Elements

With Visible Configuration Elements

Thanks a lot for watching! :)

The material used for this entry comes from a team project. 
Though, the following contents of this entry:
- Track Configuration System
- Engine Configuration System
- Artificial Pilot Behavior Modeling
- Engine UI (bottom right corner)
are totally my work.

Nonetheless, I would like to give a huge thank you to elenastambuco for all the remaining graphical part:
- environment set up
- lighting
- car textures
that she took care of, mostly visible in the videos.

Third party contents:

Behavior Bricks, by PadaOne Games
Bezier Path Creator, by Sebastian Lague
the car - Mercedes Benz Biome by qosimjongiyosov, available for free on cgtrader.com
Environment - Dark City 2 - Cyberpunk pack by ManufacturaK4


Comments (0)

This project doesn't have any comments yet.