-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
…要ぽい。
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!1 &9162002844355582235 | ||
GameObject: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
serializedVersion: 6 | ||
m_Component: | ||
- component: {fileID: 9162002844355582239} | ||
- component: {fileID: 9162002844355582238} | ||
- component: {fileID: 9162002844355582233} | ||
- component: {fileID: 9162002844355582232} | ||
m_Layer: 0 | ||
m_Name: Floor | ||
m_TagString: Untagged | ||
m_Icon: {fileID: 0} | ||
m_NavMeshLayer: 0 | ||
m_StaticEditorFlags: 0 | ||
m_IsActive: 1 | ||
--- !u!4 &9162002844355582239 | ||
Transform: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 9162002844355582235} | ||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||
m_LocalPosition: {x: 0, y: 0, z: 0} | ||
m_LocalScale: {x: 1, y: 1, z: 1} | ||
m_ConstrainProportionsScale: 0 | ||
m_Children: [] | ||
m_Father: {fileID: 0} | ||
m_RootOrder: 0 | ||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
--- !u!33 &9162002844355582238 | ||
MeshFilter: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 9162002844355582235} | ||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} | ||
--- !u!23 &9162002844355582233 | ||
MeshRenderer: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 9162002844355582235} | ||
m_Enabled: 1 | ||
m_CastShadows: 1 | ||
m_ReceiveShadows: 1 | ||
m_DynamicOccludee: 1 | ||
m_StaticShadowCaster: 0 | ||
m_MotionVectors: 1 | ||
m_LightProbeUsage: 1 | ||
m_ReflectionProbeUsage: 1 | ||
m_RayTracingMode: 2 | ||
m_RayTraceProcedural: 0 | ||
m_RenderingLayerMask: 1 | ||
m_RendererPriority: 0 | ||
m_Materials: | ||
- {fileID: 2100000, guid: 7e6fc66c5f0fc154caa2998fe70b8ee2, type: 2} | ||
m_StaticBatchInfo: | ||
firstSubMesh: 0 | ||
subMeshCount: 0 | ||
m_StaticBatchRoot: {fileID: 0} | ||
m_ProbeAnchor: {fileID: 0} | ||
m_LightProbeVolumeOverride: {fileID: 0} | ||
m_ScaleInLightmap: 1 | ||
m_ReceiveGI: 1 | ||
m_PreserveUVs: 0 | ||
m_IgnoreNormalsForChartDetection: 0 | ||
m_ImportantGI: 0 | ||
m_StitchLightmapSeams: 1 | ||
m_SelectedEditorRenderState: 3 | ||
m_MinimumChartSize: 4 | ||
m_AutoUVMaxDistance: 0.5 | ||
m_AutoUVMaxAngle: 89 | ||
m_LightmapParameters: {fileID: 0} | ||
m_SortingLayerID: 0 | ||
m_SortingLayer: 0 | ||
m_SortingOrder: 0 | ||
m_AdditionalVertexStreams: {fileID: 0} | ||
--- !u!64 &9162002844355582232 | ||
MeshCollider: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 9162002844355582235} | ||
m_Material: {fileID: 0} | ||
m_IsTrigger: 0 | ||
m_Enabled: 1 | ||
serializedVersion: 4 | ||
m_Convex: 0 | ||
m_CookingOptions: 30 | ||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!21 &2100000 | ||
Material: | ||
serializedVersion: 8 | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_Name: New Material | ||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} | ||
m_ValidKeywords: [] | ||
m_InvalidKeywords: [] | ||
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_Ints: [] | ||
m_Floats: | ||
- _BumpScale: 1 | ||
- _Cutoff: 0.5 | ||
- _DetailNormalMapScale: 1 | ||
- _DstBlend: 0 | ||
- _GlossMapScale: 1 | ||
- _Glossiness: 0.5 | ||
- _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.7169812, g: 0.7135992, b: 0.7135992, a: 1} | ||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} | ||
m_BuildTextureStacks: [] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"count":1,"self":297.4222592,"total":573.0653449,"children":{"InitializeActuators":{"count":5,"self":0.0029925,"total":0.0029925,"children":null},"InitializeSensors":{"count":5,"self":0.0009975,"total":0.0009975,"children":null},"AgentSendState":{"count":110917,"self":0.1375943,"total":0.5728009,"children":{"CollectObservations":{"count":55460,"self":0.060627999999999994,"total":0.060627999999999994,"children":null},"WriteActionMask":{"count":55460,"self":0.0253212,"total":0.0253212,"children":null},"RequestDecision":{"count":55460,"self":0.0975443,"total":0.3492574,"children":{"AgentInfo.ToProto":{"count":55460,"self":0.0769552,"total":0.25171309999999997,"children":{"GenerateSensorData":{"count":55460,"self":0.1747579,"total":0.1747579,"children":null}}}}}}},"DecideAction":{"count":110917,"self":273.9150848,"total":273.9150896,"children":null},"AgentAct":{"count":110917,"self":1.1512058,"total":1.1512058,"children":{"AgentInfo.ToProto":{"count":15,"self":0,"total":0,"children":{"GenerateSensorData":{"count":15,"self":0,"total":0,"children":null}}}}}},"gauges":{"Agent.CumulativeReward":{"count":15,"max":4085,"min":-2214,"runningAverage":141.133331,"value":1544,"weightedAverage":1166.06616}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1671375728","unity_version":"2021.3.14f1","command_line_arguments":"F:\\Program Files\\Unity\\2021.3.14f1\\Editor\\Unity.exe -createproject F:\\Products\\GraduateReport2\\1on1FlagGame\\1on1DoroK-MLTEST1 -cloneFromTemplate F:\\Program Files\\Unity\\2021.3.14f1\\Editor\\Data\\Resources\\PackageManager\\ProjectTemplates\\com.unity.template.3d-8.1.3.tgz -cloudOrganization -cloudEnvironment production -useHub -hubIPC -projectpath F:\\Products\\GraduateReport2\\1on1FlagGame\\My project -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.3","scene_name":"RollerAgent","end_time_seconds":"1671376301"}} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using UnityEngine; | ||
using Unity.MLAgents; | ||
using Unity.MLAgents.Sensors; | ||
using Unity.MLAgents.Actuators; | ||
|
||
public class PoliceAgent : Agent | ||
{ | ||
Rigidbody rBody; | ||
|
||
void Start() | ||
{ | ||
rBody = GetComponent<Rigidbody>(); | ||
} | ||
|
||
public Transform Target; | ||
public override void OnEpisodeBegin() | ||
{ | ||
// If the Agent fell, zero its momentum | ||
if (this.transform.localPosition.y < 0) | ||
{ | ||
this.rBody.angularVelocity = Vector3.zero; | ||
this.rBody.velocity = Vector3.zero; | ||
this.transform.localPosition = new Vector3(0, 0.5f, 0); | ||
} | ||
|
||
// Move the target to a new spot | ||
Target.localPosition = new Vector3(Random.value * 8 - 4, 0.5f, Random.value * 8 - 4); | ||
} | ||
|
||
public override void CollectObservations(VectorSensor sensor) | ||
{ | ||
// Target and Agent positions | ||
sensor.AddObservation(Target.localPosition); | ||
sensor.AddObservation(this.transform.localPosition); | ||
|
||
// Agent velocity | ||
sensor.AddObservation(rBody.velocity.x); | ||
sensor.AddObservation(rBody.velocity.z); | ||
} | ||
|
||
public float forceMultiplier = 10; | ||
public override void OnActionReceived(ActionBuffers actionBuffers) | ||
{ | ||
// Actions, size = 2 | ||
Vector3 controlSignal = Vector3.zero; | ||
controlSignal.x = actionBuffers.ContinuousActions[0]; | ||
controlSignal.z = actionBuffers.ContinuousActions[1]; | ||
rBody.AddForce(controlSignal * forceMultiplier); | ||
|
||
// Rewards | ||
float distanceToTarget = Vector3.Distance(this.transform.localPosition, Target.localPosition); | ||
|
||
// Reached target | ||
if (distanceToTarget < 1.42f) | ||
{ | ||
print("POLICE:caught the thief"); | ||
SetReward(1.0f); | ||
EndEpisode(); | ||
} else { | ||
SetReward(-1.0f); | ||
} | ||
|
||
// Fell off platform | ||
if (this.transform.localPosition.y < 0) | ||
{ | ||
SetReward(-1.0f); | ||
EndEpisode(); | ||
} | ||
} | ||
|
||
public override void Heuristic(in ActionBuffers actionsOut) | ||
{ | ||
var continuousActionsOut = actionsOut.ContinuousActions; | ||
continuousActionsOut[0] = Input.GetAxis("Horizontal"); | ||
continuousActionsOut[1] = Input.GetAxis("Vertical"); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.