OzAltagar7 / Smarticar

A self driving car created using Unity ML-Agents

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Thumbnail

Smarticar

A self driving car created using Unity ML-Agents.
Compete against the AI in two different game modes-

  • Racetrack, first to complete two consecutive laps
  • Parking, park as much as you can in different random parking spots in one minute

for a complete documentation (hebrew), visit Smarticar.pdf in docs.
for the application code, visit the Scripts folder under Smarticar\Assets\Scripts

General Algorithm

The agents in both game modes were trained using reinforcement learning (an area of machine learning concerned with how software agents ought to take actions in an environment in order to maximize the notion of cumulative reward). Basically, the agents were getting a positive reward when taking correct actions and a negative penalty when taking bad ones while the neural network policy optimized it's mapping from the agent's observations to the decision taking over time.

In the Racetrack mode, the agent's observations consisted of 8 raycasts being casted at all directions around the player while the possible actions consisted of turning either left or right.

Parking Mode Training

In the Parking mode, the agent's observations consisted of 8 raycasts being casted at all directions around the player, the distance from the player to the chosen parking lot, the direction to the parking lot and the direction the car is currently facing. The agent's possible actions consisted of turning either left, right forward or backwards.

Parking Mode Training

User Manual

Edit The Project In Unity

Prerequisites

  • Unity 2019.3 or higher
  • Unity ML-Agents version 0.15.0 (for updating the project into a newer version of Unity ML-Agents follow the Migrating from earlier versions of ML-Agents in the Help section of the Unity ML-Agents github repository documentation)

1. Launch Unity Hub.
2. Click on the Add button.
3. Navigate to the Smarticar repository folder and select the Smarticar folder.

Steps

Playing Instructions

  1. Unzip Smarticar.rar. After unzipping the folder, run Smarticar.exe in order to start the application

Run Smarticar.exe

  1. Press the START button in order to choose the desired game mode
Game mode selection


  1. Choose one of the two game modes
Game mode selection


  1. After choosing a game mode, the game instructions will appear. Press the START button in order to start the game
Game instructions


  1. After the countdown, the game will start and will end as soon as one the players wins (first to complete 2 consecutive laps in the case of the racetrack mode). you can pause the game at any time by pressing on the ESC button
Gameplay


  1. At the end of the game, stats will be displayed
End of game

About

A self driving car created using Unity ML-Agents


Languages

Language:C# 52.2%Language:ShaderLab 43.1%Language:HLSL 4.7%