Skip to content

Commit 4b4a3fe

Browse files
committed
Update the Readme
1 parent 5575701 commit 4b4a3fe

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,34 @@
11
# ml-agents-ecs
2+
23
This is a proof of concept for ECS based ML-Agents
4+
5+
## The core code is inside of `ECS_MLAgents_v0.Core`
6+
7+
`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 :
8+
9+
```csharp
10+
public class MyAgentSystem : AgentSystem<MySensor, MyActuator> { }
11+
```
12+
13+
The user can modify properties of `MyAgentSystem` to modify which Entities will be affected by MyAgentSystem.
14+
To access the instance of MyAgentSystem, use :
15+
16+
```csharp
17+
World.Active.GetExistingManager<MyAgentSystem>();
18+
```
19+
20+
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
21+
__Note that an Agent IComponentData must be attached to an Entity to be affected by MyAgentSystem.__
22+
At each call to OnUpdate, the Data from the sensors of compatible entities will be aggregated into a single NativeArray<float>. The AgentSystem will then process this data in batch and generate a new NativeArray<float> that will be used to populate the Actuator data of all compatible Entities.
23+
24+
## Example scenes
25+
26+
### SpaceMagic
27+
28+
Press `A`, `S`, `D` to spawn 1, 100 and 1000 new Entities in the scene.
29+
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`
30+
31+
### SpaceWars
32+
This does not use a Neural Network but a Heuristic that orient the ships and make them shoot towards the large spherical target.
33+
34+

0 commit comments

Comments
 (0)