
Create a Unity project, install ML-Agents, and import the Amelle agents from the MLA Agents GitHub repository. Use the package manager to enable preview packages and select version 1.0.2.
Model low-poly rocks by sculpting a subdivided ico sphere with the scrape brush, adjusting radius and falloff, disabling accumulate, and duplicating to populate the scene with varied instances.
Duplicate objects around the 3d cursor at 72-degree steps to assemble a checkpoint, then create a simplified cylinder collider and export both as FBX for Unity ML-Agents.
Create a 10-point circular finish line using an array modifier and an empty rotation center, then export the finish line collider as an FBX for Unity ML-Agents.
Achieve a true low-poly look for the plane by adjusting materials with matte cap mode, triangulating faces, and tweaking vertices in edit mode to refine the cockpit and wings.
Add a horizontal stabilizer to the aircraft model, align it using top and side views, then mirror, delete faces, triangulate, and fine-tune its position for realism.
Build a low-poly airplane landing gear by adding a cube, shaping with G on axes, adding edge loops, extruding and triangulating faces, and renaming the part.
Learn to model a low-poly airplane propeller, building a six-sided cone and extruding blades, using a mirror for symmetry, and setting the origin for correct rotation.
Import and organize 3d mesh assets by creating a meshes folder and importing all FBI X files into it, then verify models, colliders, and prepare materials for assets.
Import the airplane mesh, create red and other color materials with controlled smoothing and a metallic look, assign a separate propeller material, and set capsule colliders before making a prefab.
Import the airplane mesh into the scene, create color materials (red, blue, white, yellow), apply a propeller material, and add capsule colliders with color-specific prefab variants for cnn training.
Override the base initialize in the aircraft agent to set up key components. Use get component calls to fetch the aircraft area, rigidbody, and trail renderer at startup.
Create and integrate the aircraft player script that inherits from aircraft agent, enable the new input system, and wire public inputs (pitch, boost, pause) to support heuristic control.
Add explosion and training variables to the aircraft agent script, including mesh and explosion effect, and implement step timeout to speed up reinforcement learning with Unity ML-Agents.
In initialize and on action received, set 5000 training steps, enforce infinite steps for racing, add small negative rewards per step, and implement curriculum-based checkpoint radius to progress checkpoints.
Define a private vector to next checkpoint function in the aircraft agent, converting world space direction to a local space vector with inverse transform direction and the next checkpoint index.
Implement freeze and thaw logic for an aircraft agent in Unity ml-agents. Freeze stops movement by sleeping the rigidbody and disabling trail emissions; thaw resumes them, with a training warning.
Implement onTriggerEnter to handle checkpoint collisions by validating the checkpoint tag, matching the next checkpoint index, and calling gotCheckpoint; also tag and configure checkpoints and the finish line in Unity.
Implement collect observations and heuristic override in aircraft agent to feed a vector sensor with velocity, next checkpoint position and orientation, enabling aircraft to observe the world and make decisions.
Attach Ray Perception Sensor 3D to child objects of the aircraft learning prefab, configure forward, up, and down rays with detectable tags for the aircraft agent.
Explore how a position offset introduces randomness in Unity ML-Agents aircraft spawning, showing how slight start-position variation leads to non-deterministic observations and different decisions.
Race your airplane against heuristic-only control and neural network agents, stop training early to create easy or hard rivals, and swap networks in the airplane prefab to adjust difficulty.
Create the main menu scene for your Unity ML-Agents flight project, adding text mesh pro title, level and difficulty dropdowns, and start and quick buttons, with proper anchoring and sizing.
Initialize the MainMenuController.cs in Unity to manage public variables for levels and dropdowns, populate level and difficulty options from a levels list and the game difficulty enum, and set defaults.
Awake locates HUD, count down UI, pause menu UI, and game over UI, and the virtual camera. Start initializes race and freezes aircraft agents until the player is found.
Start the race by showing a countdown UI and yielding the coroutine, while initializing aircraft statuses in a dictionary and thawing agents when playing with a 15-second time remaining.
Import checkpoint assets into an images folder, create UI images for the checkpoint icon and the arrow, and apply an unlit transparent material colored bright orange.
Update the hud with live race data by retrieving the race manager, updating place, time, and lap text, and rendering a checkpoint arrow and icon using viewport calculations.
Create a Unity countdown UI with TextMeshPro and attach a CountdownUIController to display three, two, one, go. Use a coroutine with timed delays to update the text.
Test the racing gameplay by wiring a game manager, validating race progression, checkpoints, and end screens, and debugging the pause menu and UI behavior in Unity ML-Agents.
Convert the race manager into a reusable prefab and drop it into any scene with an academy, area, camera, and game manager to create a working level.
Reuse desert assets to create a snowy race scene, turn the global volume and camera setup into prefabs, generate lighting, test the scene, and adjust player instances.
Resolve snow level loading bug in a Unity ML-Agents project by updating build settings and main menu dropdowns to pass the selected level and difficulty.
Interested in the intersection of video games and artificial intelligence? If so, you will love Unity ML-Agents.
Reinforcement Learning with ML-Agents is naturally more intuitive than other machine learning approaches because you can watch your neural network learn in a real-time 3d environment based on rewards for good behavior. It's more fun because you can easily apply it to your own video game ideas rather than working with simplified example problems in a library like OpenAI Gym.
In this course, we will create a complete game with incredibly challenging AI opponents.
We'll start with an introduction to ML-Agents, including how to use and train the example content.
Then, we'll use Blender to make custom assets for our game (you can skip that part if you just want to code).
Next, we'll create a full environment for the airplane agents and train them to fly through checkpoints without crashing into obstacles.
Finally, we'll take our trained agents and build a full game around them that you can play, including menus for level and difficulty selection.
Important note 1: We DO NOT cover the foundations of deep learning or reinforcement learning in this course. We will focus on how to use ML-Agents, which abstracts the hard stuff and allows us to focus on building our training environment and crafting rewards.
Important note 2: While the course was originally recorded with ML-Agents version 0.11, we have updated it for version 1.0.
As you work through the course, you'll have plenty of opportunities to customize it and make it your own. At the end, you'll have a complete game that you can share with friends, add to your portfolio, or sell on a game marketplace.