DOTS compatible version of ML-Agents
Перейти к файлу
vincentpierre 3e10ec2102 Initial Commit 2019-03-01 11:58:53 -08:00
Assets Initial Commit 2019-03-01 11:58:53 -08:00
Packages Initial Commit 2019-02-11 15:06:58 -08:00
ProjectSettings Trained a model for space wars 2019-02-14 17:04:58 -08:00
.gitignore Added a basic gitignore 2019-02-11 15:17:31 -08:00
README.md update doc 2019-02-11 15:18:58 -08:00

README.md

ml-agents-ecs

This is a proof of concept for ECS based ML-Agents

The core code is inside of ECS_MLAgents_v0.Core

AgentSystem<Sensor, Actuator> is a JobComponentSystem that updates the Actuator based of the data present in Sensor for all of the compatible Entities. The user can create a new AgentSystem by defining a class this way :

 public class MyAgentSystem : AgentSystem<MySensor, MyActuator> { }

The user can modify properties of MyAgentSystem to modify which Entities will be affected by MyAgentSystem. To access the instance of MyAgentSystem, use :

 World.Active.GetExistingManager<MyAgentSystem>(); 

It is the responsibility of the user to create and populate the MySensor of each Entity as well as create and use the data in the MyActuator of each Entity. MySensor and MyActuator must be IComponentData struct that only contains blittable float fields Note that an Agent IComponentData must be attached to an Entity to be affected by MyAgentSystem. At each call to OnUpdate, the Data from the sensors of compatible entities will be aggregated into a single NativeArray. The AgentSystem will then process this data in batch and generate a new NativeArray that will be used to populate the Actuator data of all compatible Entities.

Example scenes

SpaceMagic

Press A, S, D to spawn 1, 100 and 1000 new Entities in the scene. There are 3 random neural networks used to update the acceleration of the spheres based on their position. You can replace the Decision type on one of the system from Neural Network to Heuristic by pressing U and I

SpaceWars

Press A, S, D to spawn 1, 100 and 1000 new Entities in the scene. This scene does not use a Neural Network but a Heuristic that orient the ships and make them shoot towards the large spherical target.