Navmesh3D Plugin
Navmesh3D is a plugin in development that was created for my flight racing game, Drifters. I needed a way to generate paths for AI flying ships to traverse a race track, as well as things like missiles.
I needed the pathfinding to be fast and have a low memory and disk footprint. I also wanted the process of building the navmesh to be relatively quick for large maps (8km x 8km) and allow me specify exactly which parts of the map should be traversable.
I settled on using A* as the primary pathfinding algorithm. The navmesh using a series of box traces, the size of which is determined by configuration. The result of that trace is packed as a bit into a byte (so, 8 trace results per byte).
The bounds of the navmesh are determined using proxy actors with box components. I also developed a series of editor utilities to make visualization and debugging of the navmesh easier for myself and anyone who uses the plugin.
The plugin does not provide the bells and whistles of other plugins - like a movement component or integration with Unreal Engine’s movement tasks - instead providing the essentials for finding paths in 3D environments, with a small library of functions that I found personally useful for development, debugging, and integrating into an actual game.
In-game, a Drifter is the ship you fly. It is a highly aerodynamic ship, capable of breaking the sound barrier. A key component of the game is drifting, which charges your batteries, and allows you to use that charge to perform boosts, maneuvers, and activate hardpoints.
The progression focuses around upgrading your drifter to get better times in races - whether that is in the game’s Career mode or Time Trials.
Any race can be re-watched via replays. You can also race against ghosts of your own previous races in the time trial modes.
As part of the replay system, any replay can be raced against in a ghost race. Play against your old times and try to beat them, with your replaying drifter flying against you in real time. You can also ask your friend for their replay files and race against them too.
Race against up to seven of your friends in multiplayer. Fly with a starter ship or any of your custom built ships with your own tuning settings. One player hosts and the other can connect via IP. Custom network code for ship movement and replication of ship states.
Project Details
Catch My Drift is a project in ongoing development. It is the current result of 7 months of active development between 2022 and 2023, with a large amount of C++ code, including some custom physics and replication code, and more logic in Blueprint. The code-base has several large modules that include:
Replay system - A record of the ship’s state and inputs are saved for later replay. States and inputs are saved as structs, and saved into a SaveGame object in Unreal Engine. The replay system then iterates through the states and inputs, playing back the moves again and interpolating between states for a smooth replay experience.
Build Mode - Allows player to create their own ships from a selection of parts, that include thrusters, fuel tanks, wings, and others. Players can pick a part from a selection, rotate it, move it, and place it onto the body of your ship. Parts can connect to other parts. The ship is saved as a JSON file and can be loaded in single and multiplayer races, or for later editing in build mode.
Physics simulation - Several different forces are enacted on the ship, including thrust, drag, lift and gravity. Mass is an important factor to determine the resultant acceleration due to these forces, meaning massive ships will accelerate slower due to thrust, decelerate slower due to drag, and heavier ships will also have less lift. The system also calculates surface area dynamically for your ship, meaning drag will be higher for ships with larger profiles.
Three different gameplay modes - Race (single player and multiplayer), Ghost Race, and Replay. A regular race can be played alone or with friends. By sharing your external IP with them, they can directly connect to your session. A ghost race can be played against your own replays. Much like watching a replay, a replay is loaded and then its states iterated upon to move a ghost ship along the track while you race alongside it.
Movement replication - Custom network code, implementing client side prediction algorithm [1] [2]. Movement replication takes advantage of the infrastructure implemented for the replay system by using its input and state structs to replicate ship movement across the network to all clients. This results in smooth gameplay for clients, without jitter.
GitHub Repository: https://github.com/kevinrmahoney/ProjectZero
Tools: Unreal Engine, Gaea (terrain)
Plugins: FMOD (audio)
Team
Kevin Mahoney - Developer
Matthew Mahoney - Audio design
There are three time trial modes: Season, Weekly, and Daily time trials. Daily and weekly time trials are refreshed every day/week with a different map and different track conditions, which include things like temperature, humidity, time of day, and wind. Each affect the gameplay in various ways. Season time trials leaderboards reset based on updates to the game.
Features
Debug lines drawn to show trace lines that detect parts, which is used for drag calculation.
Ground effect debug, showing traces done to detect closeness to surface, negating drag.
Client debug lines for netcode client prediction. Yellow is before rollback. Red is after rollback. Green is the final result after replaying inputs.
The leaderboard shows a record of all races you’ve played in, sorted by your result.
Controls can be mapped through settings menu.
All races are shown in the replay menu, where they can be watched, played against, or deleted.
An example of the build menu widgets when creating ships.
Tuning Window allows the player to tune each part that can be tuned, such as changing how much fuel is in the tank, setting thrust levels, setting lift generation of wings, etc.
Specifications window shows important statistical information about the ship, including its max velocity, acceleration, thrust, lift, drag, mass, etc. Most specs can be expanded to show even more detailed information about the specifications in each direction
Simulator allows you to simulate how the ship will perform given certain inputs, such as thrust levels, if using boost, fuel and boost fuel levels, and flap angle.
Part Panel can be see by hovering over a part in the part selection panel , displaying its statistics.