# [Optimizations](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/09-optimizations/)

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/)
- [Machine Learning in games](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/02-ml-in-games/)
- [Install Unity and the project](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/03-install/)
- [The Dr Arm game](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/04-the-dr-arm-game/)
- [Machine Learning in Unity](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/05-machine-learning-in-unity/)
- [The Unity project](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/06-the-unity-project/)
- [Objects and Components](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/07-objects-and-components/)
- [Training our ML agents](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/08-training-our-ml-agents/)
- [Optimizations](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/09-optimizations/)
- [Summary](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/10-summary/)
- [Next Steps](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/_next-steps/)

## Some notes about reducing training time
A few things were done to reduce the time it takes to train the ML agents to a reasonable level.

![Image Alt Text:Training Scene](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/images/training-scene.webp)
*Figure 1. The Training Scene (again)*

### Multiple simultaneous battles
Six “arenas” are employed in the training scene (you may have to adjust your view in Unity to be able to see all of them). Running multiple battles simultaneously speeds up the training. If you have more CPU power, you could use more.

### Fast forward time
To speed things up even more, the game is run at a much higher speed when training. Rendering still runs at normal speed but everything else should update at a much higher frequency. The Unity value *Time.timeScale* is normally 1.0 which runs the game at real-time. *Time.timeScale* is set to a higher value in order to speed up the training.

When you speed it up, be careful to make sure it speeds up for everything equally so that the models learn the correct behaviors.

### Some minor optimizations
The light has been removed from the individual scenes as only one is needed and only one event system is required. The UI has also been removed, as it isn’t required for training.

### Switching the human character to AI
If you select the *ML-Player* object you’ll notice in the *Inspector* that the *Is Player* flag is no longer set. During training, the character will not be controlled by a human player. Also in the *ML Player Manager* object *Init on Start* has been set to true, as it does some extra initialization. Then under *Agent Settings* the *Training* property has to be set to true.

Take some time to look through each object in the training arena. They differ slightly to those in the game scene that are used when playing the game. 

The next section summarizes what we have learned and suggests a few ideas for how to improve the Dr Arm project.
