
Mind Mesh
AI Neural Network Unity Car Physics Simulation Machine Learning Mind Mesh Game Dev
Mind Mesh is an experimental AI racing project where neural networks learn to drive formula-style cars on procedurally generated tracks. Built entirely in Unity with C#, it features realistic car physics and evolutionary neural networks trained through natural selection.
🚗 How It Works
Each generation spawns 100 AI agents. They receive input from:
- 15 raycasts spread over 180° (for spatial awareness)
- Vehicle speed
- Wheel slip (both forward and sideways for each wheel)
- Track direction
Outputs are:
- Steering direction
- Throttle/Brake (via a single node: top half = throttle, bottom half = brake)
Agents evolve through generations using mutation and selection. The best-performing driver (distance + low impact or no crash) passes its traits to the next generation.
🧠 Neural Network
The architecture is a multi-layer feedforward network built from scratch in C#. It supports:
- Randomized weights and biases
- Mutation-based evolution
- Activation via sigmoid function
- Output decisions per frame
- Future: competitive training with collisions between agents
🛞 Physics & Control
Cars use Unity’s Rigidbody system and Wheel Colliders, simulating:
- Traction & friction
- Suspension
- Engine torque and directional steering
- Speed-based throttle/brake handling
A brake override system was added after early agents pressed throttle + brake simultaneously. This significantly improved lap time efficiency.
🧪 Results
- After ~50 generations, agents completed laps consistently without crashes.
- They learned subtle driving behaviors like slowing before corners and staying right on the track due to spawn conditions.
- New additions include “reverse” and “idling” death conditions to prevent cheating/stalling.
I love how realistic the agents became. They started driving like maniacs, then learned restraint—just like we do.
🧰 Tools Used
- Unity 2022.3 LTS
- C#
- Blender (car modeling + procedural track generation using Geometry Nodes)
🛣️ Next Steps
- Enable full collision between agents → true competitive AI racing
- Export a public web demo