浏览代码
[cherry-pick][docs] Add Dungeon Escape Environment (#5133)
[cherry-pick][docs] Add Dungeon Escape Environment (#5133)
* Add DungeonEscape POCA Environment (#5128) * Add DungeonEscape assets from working branch * Add Dungeon Escape docs * Create dungeon_escape.png * Add to docs Co-authored-by: Hunter-Unity <hunter@unity3d.com>/release_15_branch
GitHub
4 年前
当前提交
f7ab0cb0
共有 45 个文件被更改,包括 7228 次插入 和 3 次删除
-
2com.unity.ml-agents/CHANGELOG.md
-
9docs/Learning-Environment-Design-Agents.md
-
22docs/Learning-Environment-Examples.md
-
8Project/Assets/ML-Agents/Examples/DungeonEscape.meta
-
77Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Brown.mat
-
8Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Brown.mat.meta
-
77Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Door.mat
-
8Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Door.mat.meta
-
143Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/CollisionCallbacks.cs
-
11Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/CollisionCallbacks.cs.meta
-
26config/poca/DungeonEscape.yaml
-
1001docs/images/dungeon_escape.png
-
8Project/Assets/ML-Agents/Examples/DungeonEscape/Meshes.meta
-
43Project/Assets/ML-Agents/Examples/DungeonEscape/Meshes/Cave.fbx
-
103Project/Assets/ML-Agents/Examples/DungeonEscape/Meshes/Cave.fbx.meta
-
58Project/Assets/ML-Agents/Examples/DungeonEscape/Meshes/Door.fbx
-
107Project/Assets/ML-Agents/Examples/DungeonEscape/Meshes/Door.fbx.meta
-
8Project/Assets/ML-Agents/Examples/DungeonEscape/Prefabs.meta
-
379Project/Assets/ML-Agents/Examples/DungeonEscape/Prefabs/Column.prefab
-
7Project/Assets/ML-Agents/Examples/DungeonEscape/Prefabs/Column.prefab.meta
-
1001Project/Assets/ML-Agents/Examples/DungeonEscape/Prefabs/DungeonEscapeAgent.prefab
-
7Project/Assets/ML-Agents/Examples/DungeonEscape/Prefabs/DungeonEscapeAgent.prefab.meta
-
1001Project/Assets/ML-Agents/Examples/DungeonEscape/Prefabs/DungeonEscapePlatform.prefab
-
7Project/Assets/ML-Agents/Examples/DungeonEscape/Prefabs/DungeonEscapePlatform.prefab.meta
-
578Project/Assets/ML-Agents/Examples/DungeonEscape/Prefabs/Sword.prefab
-
7Project/Assets/ML-Agents/Examples/DungeonEscape/Prefabs/Sword.prefab.meta
-
8Project/Assets/ML-Agents/Examples/DungeonEscape/Scenes.meta
-
1001Project/Assets/ML-Agents/Examples/DungeonEscape/Scenes/DungeonEscape.unity
-
9Project/Assets/ML-Agents/Examples/DungeonEscape/Scenes/DungeonEscape.unity.meta
-
8Project/Assets/ML-Agents/Examples/DungeonEscape/Scripts.meta
-
260Project/Assets/ML-Agents/Examples/DungeonEscape/Scripts/DungeonEscapeEnvController.cs
-
11Project/Assets/ML-Agents/Examples/DungeonEscape/Scripts/DungeonEscapeEnvController.cs.meta
-
137Project/Assets/ML-Agents/Examples/DungeonEscape/Scripts/PushAgentEscape.cs
-
12Project/Assets/ML-Agents/Examples/DungeonEscape/Scripts/PushAgentEscape.cs.meta
-
45Project/Assets/ML-Agents/Examples/DungeonEscape/Scripts/SimpleNPC.cs
-
11Project/Assets/ML-Agents/Examples/DungeonEscape/Scripts/SimpleNPC.cs.meta
-
8Project/Assets/ML-Agents/Examples/DungeonEscape/TFModels.meta
-
1001Project/Assets/ML-Agents/Examples/DungeonEscape/TFModels/DungeonEscape.onnx
-
14Project/Assets/ML-Agents/Examples/DungeonEscape/TFModels/DungeonEscape.onnx.meta
|
|||
fileFormatVersion: 2 |
|||
guid: 9ee1af8bad0b14bfcb4eb70491929ffa |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!21 &2100000 |
|||
Material: |
|||
serializedVersion: 6 |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_Name: Brown |
|||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF |
|||
m_LightmapFlags: 4 |
|||
m_EnableInstancingVariants: 0 |
|||
m_DoubleSidedGI: 0 |
|||
m_CustomRenderQueue: -1 |
|||
stringTagMap: {} |
|||
disabledShaderPasses: [] |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- _BumpMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailAlbedoMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMask: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MainTex: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _OcclusionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ParallaxMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- _BumpScale: 1 |
|||
- _Cutoff: 0.5 |
|||
- _DetailNormalMapScale: 1 |
|||
- _DstBlend: 0 |
|||
- _GlossMapScale: 1 |
|||
- _Glossiness: 0 |
|||
- _GlossyReflections: 0 |
|||
- _Metallic: 0 |
|||
- _Mode: 0 |
|||
- _OcclusionStrength: 1 |
|||
- _Parallax: 0.02 |
|||
- _SmoothnessTextureChannel: 0 |
|||
- _SpecularHighlights: 0 |
|||
- _SrcBlend: 1 |
|||
- _UVSec: 0 |
|||
- _ZWrite: 1 |
|||
m_Colors: |
|||
- _Color: {r: 0.294, g: 0.294, b: 0.294, a: 1} |
|||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
|
|||
fileFormatVersion: 2 |
|||
guid: 16fb7514bd09f43f8ae773b97bf3819d |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!21 &2100000 |
|||
Material: |
|||
serializedVersion: 6 |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_Name: Door |
|||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_ShaderKeywords: |
|||
m_LightmapFlags: 4 |
|||
m_EnableInstancingVariants: 0 |
|||
m_DoubleSidedGI: 0 |
|||
m_CustomRenderQueue: -1 |
|||
stringTagMap: {} |
|||
disabledShaderPasses: [] |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- _BumpMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailAlbedoMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMask: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MainTex: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _OcclusionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ParallaxMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- _BumpScale: 1 |
|||
- _Cutoff: 0.5 |
|||
- _DetailNormalMapScale: 1 |
|||
- _DstBlend: 0 |
|||
- _GlossMapScale: 1 |
|||
- _Glossiness: 0 |
|||
- _GlossyReflections: 1 |
|||
- _Metallic: 0 |
|||
- _Mode: 0 |
|||
- _OcclusionStrength: 1 |
|||
- _Parallax: 0.02 |
|||
- _SmoothnessTextureChannel: 0 |
|||
- _SpecularHighlights: 1 |
|||
- _SrcBlend: 1 |
|||
- _UVSec: 0 |
|||
- _ZWrite: 1 |
|||
m_Colors: |
|||
- _Color: {r: 0.2830189, g: 0.22119384, b: 0.16153437, a: 1} |
|||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
|
|||
fileFormatVersion: 2 |
|||
guid: daf629e39cc0f4521b64c93cd9604da9 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using Random = UnityEngine.Random; |
|||
using Unity.MLAgents; |
|||
using UnityEngine.Events; |
|||
|
|||
namespace Unity.MLAgentsExamples |
|||
{ |
|||
/// <summary>
|
|||
/// Utility class to allow target placement and collision detection with an agent
|
|||
/// Add this script to the target you want the agent to touch.
|
|||
/// Callbacks will be triggered any time the target is touched with a collider tagged as 'tagToDetect'
|
|||
/// </summary>
|
|||
public class CollisionCallbacks : MonoBehaviour |
|||
{ |
|||
// [System.Serializable] public class BoolEvent : UnityEvent<bool> { }
|
|||
// [SerializeField] BoolEvent boolEvent = new BoolEvent();
|
|||
// public void OnBoolEvent(bool value)
|
|||
// {
|
|||
// Debug.Log($"OnBoolEvent {value}");
|
|||
// }
|
|||
|
|||
|
|||
[Header("Collider Tag To Detect")] |
|||
public string tagToDetect = "agent"; //collider tag to detect
|
|||
|
|||
// [Header("Target Placement")]
|
|||
// public float spawnRadius; //The radius in which a target can be randomly spawned.
|
|||
// public bool respawnIfTouched; //Should the target respawn to a different position when touched
|
|||
//
|
|||
// [Header("Target Fell Protection")]
|
|||
// public bool respawnIfFallsOffPlatform = true; //If the target falls off the platform, reset the position.
|
|||
// public float fallDistance = 5; //distance below the starting height that will trigger a respawn
|
|||
//
|
|||
//
|
|||
// private Vector3 m_startingPos; //the starting position of the target
|
|||
// private Agent m_agentTouching; //the agent currently touching the target
|
|||
|
|||
[System.Serializable] |
|||
// public class TriggerEvent : UnityEvent<string>
|
|||
public class TriggerEvent : UnityEvent<Collider> |
|||
{ |
|||
} |
|||
|
|||
[Header("Trigger Callbacks")] |
|||
public TriggerEvent onTriggerEnterEvent = new TriggerEvent(); |
|||
public TriggerEvent onTriggerStayEvent = new TriggerEvent(); |
|||
public TriggerEvent onTriggerExitEvent = new TriggerEvent(); |
|||
|
|||
[System.Serializable] |
|||
public class CollisionEvent : UnityEvent<Collision, Transform> |
|||
{ |
|||
} |
|||
|
|||
[Header("Collision Callbacks")] |
|||
public CollisionEvent onCollisionEnterEvent = new CollisionEvent(); |
|||
public CollisionEvent onCollisionStayEvent = new CollisionEvent(); |
|||
public CollisionEvent onCollisionExitEvent = new CollisionEvent(); |
|||
|
|||
// // Start is called before the first frame update
|
|||
// void OnEnable()
|
|||
// {
|
|||
// m_startingPos = transform.position;
|
|||
// if (respawnIfTouched)
|
|||
// {
|
|||
// MoveTargetToRandomPosition();
|
|||
// }
|
|||
// }
|
|||
|
|||
// void Update()
|
|||
// {
|
|||
// if (respawnIfFallsOffPlatform)
|
|||
// {
|
|||
// if (transform.position.y < m_startingPos.y - fallDistance)
|
|||
// {
|
|||
// Debug.Log($"{transform.name} Fell Off Platform");
|
|||
// MoveTargetToRandomPosition();
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
|
|||
// /// <summary>
|
|||
// /// Moves target to a random position within specified radius.
|
|||
// /// </summary>
|
|||
// public void MoveTargetToRandomPosition()
|
|||
// {
|
|||
// var newTargetPos = m_startingPos + (Random.insideUnitSphere * spawnRadius);
|
|||
// newTargetPos.y = m_startingPos.y;
|
|||
// transform.position = newTargetPos;
|
|||
// }
|
|||
|
|||
private void OnCollisionEnter(Collision col) |
|||
{ |
|||
if (col.transform.CompareTag(tagToDetect)) |
|||
{ |
|||
onCollisionEnterEvent.Invoke(col, transform); |
|||
// if (respawnIfTouched)
|
|||
// {
|
|||
// MoveTargetToRandomPosition();
|
|||
// }
|
|||
} |
|||
} |
|||
|
|||
private void OnCollisionStay(Collision col) |
|||
{ |
|||
if (col.transform.CompareTag(tagToDetect)) |
|||
{ |
|||
onCollisionStayEvent.Invoke(col, transform); |
|||
} |
|||
} |
|||
|
|||
private void OnCollisionExit(Collision col) |
|||
{ |
|||
if (col.transform.CompareTag(tagToDetect)) |
|||
{ |
|||
onCollisionExitEvent.Invoke(col, transform); |
|||
} |
|||
} |
|||
|
|||
private void OnTriggerEnter(Collider col) |
|||
{ |
|||
if (col.CompareTag(tagToDetect)) |
|||
{ |
|||
onTriggerEnterEvent.Invoke(col); |
|||
} |
|||
} |
|||
|
|||
private void OnTriggerStay(Collider col) |
|||
{ |
|||
if (col.CompareTag(tagToDetect)) |
|||
{ |
|||
onTriggerStayEvent.Invoke(col); |
|||
} |
|||
} |
|||
|
|||
private void OnTriggerExit(Collider col) |
|||
{ |
|||
if (col.CompareTag(tagToDetect)) |
|||
{ |
|||
onTriggerExitEvent.Invoke(col); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: df05ec10e50114a9d92106879d04d89d |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
behaviors: |
|||
DungeonEscape: |
|||
trainer_type: poca |
|||
hyperparameters: |
|||
batch_size: 1024 |
|||
buffer_size: 10240 |
|||
learning_rate: 0.0003 |
|||
beta: 0.01 |
|||
epsilon: 0.2 |
|||
lambd: 0.95 |
|||
num_epoch: 3 |
|||
learning_rate_schedule: constant |
|||
network_settings: |
|||
normalize: false |
|||
hidden_units: 256 |
|||
num_layers: 2 |
|||
vis_encode_type: simple |
|||
reward_signals: |
|||
extrinsic: |
|||
gamma: 0.99 |
|||
strength: 1.0 |
|||
keep_checkpoints: 5 |
|||
max_steps: 20000000 |
|||
time_horizon: 64 |
|||
summary_freq: 60000 |
|||
threaded: true |
1001
docs/images/dungeon_escape.png
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 52cc95bb0ae204a03b020b5e25025f92 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
Kaydara FBX Binary � M FBXHeaderExtension\ FBXHeaderVersionI� x |
|||
FBXVersionI� � EncryptionTypeI � CreationTimeStamp� VersionI� � YearI� � MonthI DayI ' HourI ? MinuteI9 W SecondI t MillisecondI� � . CreatorS) Blender (stable FBX IO) - 2.91.0 - 4.21.3@ ' |