Reinforcement Learning
ml-agents
TensorBoard
ONNX
Pyramids
deep-reinforcement-learning
ML-Agents-Pyramids
Instructions to use AnnaMats/ppo-Pyramids-Training with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ml-agents
How to use AnnaMats/ppo-Pyramids-Training with ml-agents:
mlagents-load-from-hf --repo-id="AnnaMats/ppo-Pyramids-Training" --local-dir="./download: string[]s"
- Notebooks
- Google Colab
- Kaggle
| using UnityEngine; | |
| using Unity.MLAgentsExamples; | |
| public class PyramidArea : Area | |
| { | |
| public GameObject pyramid; | |
| public GameObject stonePyramid; | |
| public GameObject[] spawnAreas; | |
| public int numPyra; | |
| public float range; | |
| public void CreatePyramid(int numObjects, int spawnAreaIndex) | |
| { | |
| CreateObject(numObjects, pyramid, spawnAreaIndex); | |
| } | |
| public void CreateStonePyramid(int numObjects, int spawnAreaIndex) | |
| { | |
| CreateObject(numObjects, stonePyramid, spawnAreaIndex); | |
| } | |
| void CreateObject(int numObjects, GameObject desiredObject, int spawnAreaIndex) | |
| { | |
| for (var i = 0; i < numObjects; i++) | |
| { | |
| var newObject = Instantiate(desiredObject, Vector3.zero, | |
| Quaternion.Euler(0f, 0f, 0f), transform); | |
| PlaceObject(newObject, spawnAreaIndex); | |
| } | |
| } | |
| public void PlaceObject(GameObject objectToPlace, int spawnAreaIndex) | |
| { | |
| var spawnTransform = spawnAreas[spawnAreaIndex].transform; | |
| var xRange = spawnTransform.localScale.x / 2.1f; | |
| var zRange = spawnTransform.localScale.z / 2.1f; | |
| objectToPlace.transform.position = new Vector3(Random.Range(-xRange, xRange), 2f, Random.Range(-zRange, zRange)) | |
| + spawnTransform.position; | |
| } | |
| public void CleanPyramidArea() | |
| { | |
| foreach (Transform child in transform) | |
| if (child.CompareTag("pyramid")) | |
| { | |
| Destroy(child.gameObject); | |
| } | |
| } | |
| public override void ResetArea() | |
| { | |
| } | |
| } | |