├── LICENSE
├── README.md
├── Record - Chinese.md
├── jumpjump
├── .gitignore
├── Assets
│ ├── Data.meta
│ ├── Data
│ │ ├── jump.exe.bytes
│ │ └── jump.exe.bytes.meta
│ ├── Demigiant.meta
│ ├── Demigiant
│ │ ├── DOTween.meta
│ │ └── DOTween
│ │ │ ├── DOTween.XML
│ │ │ ├── DOTween.XML.meta
│ │ │ ├── DOTween.dll
│ │ │ ├── DOTween.dll.mdb
│ │ │ ├── DOTween.dll.mdb.meta
│ │ │ ├── DOTween.dll.meta
│ │ │ ├── DOTween43.dll
│ │ │ ├── DOTween43.dll.mdb
│ │ │ ├── DOTween43.dll.mdb.meta
│ │ │ ├── DOTween43.dll.meta
│ │ │ ├── DOTween43.xml
│ │ │ ├── DOTween43.xml.meta
│ │ │ ├── DOTween46.dll
│ │ │ ├── DOTween46.dll.mdb
│ │ │ ├── DOTween46.dll.mdb.meta
│ │ │ ├── DOTween46.dll.meta
│ │ │ ├── DOTween46.xml
│ │ │ ├── DOTween46.xml.meta
│ │ │ ├── DOTween50.dll
│ │ │ ├── DOTween50.dll.mdb
│ │ │ ├── DOTween50.dll.mdb.meta
│ │ │ ├── DOTween50.dll.meta
│ │ │ ├── DOTween50.xml
│ │ │ ├── DOTween50.xml.meta
│ │ │ ├── Editor.meta
│ │ │ ├── Editor
│ │ │ ├── DOTweenEditor.XML
│ │ │ ├── DOTweenEditor.XML.meta
│ │ │ ├── DOTweenEditor.dll
│ │ │ ├── DOTweenEditor.dll.mdb
│ │ │ ├── DOTweenEditor.dll.mdb.meta
│ │ │ ├── DOTweenEditor.dll.meta
│ │ │ ├── Imgs.meta
│ │ │ └── Imgs
│ │ │ │ ├── DOTweenIcon.png
│ │ │ │ ├── DOTweenIcon.png.meta
│ │ │ │ ├── Footer.png
│ │ │ │ ├── Footer.png.meta
│ │ │ │ ├── Footer_dark.png
│ │ │ │ ├── Footer_dark.png.meta
│ │ │ │ ├── Header.jpg
│ │ │ │ └── Header.jpg.meta
│ │ │ ├── Examples.meta
│ │ │ ├── Examples
│ │ │ ├── Basics.cs
│ │ │ ├── Basics.cs.meta
│ │ │ ├── Basics.unity
│ │ │ ├── Basics.unity.meta
│ │ │ ├── Sequences.cs
│ │ │ ├── Sequences.cs.meta
│ │ │ ├── Sequences.unity
│ │ │ └── Sequences.unity.meta
│ │ │ ├── readme.txt
│ │ │ └── readme.txt.meta
│ ├── Logo.meta
│ ├── Logo
│ │ ├── 洪流学堂logo - 横板.png
│ │ └── 洪流学堂logo - 横板.png.meta
│ ├── ML-Agents.meta
│ ├── ML-Agents
│ │ ├── Editor.meta
│ │ ├── Editor
│ │ │ ├── BrainEditor.cs
│ │ │ └── BrainEditor.cs.meta
│ │ ├── Plugins.meta
│ │ ├── Plugins
│ │ │ ├── Computer.meta
│ │ │ ├── Computer
│ │ │ │ ├── TensorFlowSharp.dll
│ │ │ │ ├── TensorFlowSharp.dll.meta
│ │ │ │ ├── libtensorflow.dll
│ │ │ │ └── libtensorflow.dll.meta
│ │ │ ├── JSON.meta
│ │ │ ├── JSON
│ │ │ │ ├── Newtonsoft.Json.dll
│ │ │ │ └── Newtonsoft.Json.dll.meta
│ │ │ ├── System.Numerics.dll
│ │ │ ├── System.Numerics.dll.meta
│ │ │ ├── System.ValueTuple.dll
│ │ │ └── System.ValueTuple.dll.meta
│ │ ├── Scripts.meta
│ │ ├── Scripts
│ │ │ ├── Academy.cs
│ │ │ ├── Academy.cs.meta
│ │ │ ├── Agent.cs
│ │ │ ├── Agent.cs.meta
│ │ │ ├── Brain.cs
│ │ │ ├── Brain.cs.meta
│ │ │ ├── Communicator.cs
│ │ │ ├── Communicator.cs.meta
│ │ │ ├── CoreBrain.cs
│ │ │ ├── CoreBrain.cs.meta
│ │ │ ├── CoreBrainExternal.cs
│ │ │ ├── CoreBrainExternal.cs.meta
│ │ │ ├── CoreBrainHeuristic.cs
│ │ │ ├── CoreBrainHeuristic.cs.meta
│ │ │ ├── CoreBrainInternal.cs
│ │ │ ├── CoreBrainInternal.cs.meta
│ │ │ ├── CoreBrainPlayer.cs
│ │ │ ├── CoreBrainPlayer.cs.meta
│ │ │ ├── Decision.cs
│ │ │ ├── Decision.cs.meta
│ │ │ ├── ExternalCommunicator.cs
│ │ │ ├── ExternalCommunicator.cs.meta
│ │ │ ├── Monitor.cs
│ │ │ ├── Monitor.cs.meta
│ │ │ ├── UnityAgentsException.cs
│ │ │ └── UnityAgentsException.cs.meta
│ │ ├── Template.meta
│ │ └── Template
│ │ │ ├── Scene.unity
│ │ │ ├── Scene.unity.meta
│ │ │ ├── Scripts.meta
│ │ │ └── Scripts
│ │ │ ├── TemplateAcademy.cs
│ │ │ ├── TemplateAcademy.cs.meta
│ │ │ ├── TemplateAgent.cs
│ │ │ ├── TemplateAgent.cs.meta
│ │ │ ├── TemplateDecision.cs
│ │ │ └── TemplateDecision.cs.meta
│ ├── Materials.meta
│ ├── Materials
│ │ ├── GroundMaterial.mat
│ │ ├── GroundMaterial.mat.meta
│ │ ├── Player.mat
│ │ └── Player.mat.meta
│ ├── Prefabs.meta
│ ├── Prefabs
│ │ ├── Game.prefab
│ │ └── Game.prefab.meta
│ ├── Resources.meta
│ ├── Resources
│ │ ├── DOTweenSettings.asset
│ │ └── DOTweenSettings.asset.meta
│ ├── Scenes.meta
│ ├── Scripts.meta
│ ├── Scripts
│ │ ├── BottleFlipAcademy.cs
│ │ ├── BottleFlipAcademy.cs.meta
│ │ ├── BottleFlipAgent.cs
│ │ ├── BottleFlipAgent.cs.meta
│ │ ├── BottleFlipDecision.cs
│ │ ├── BottleFlipDecision.cs.meta
│ │ ├── Player.cs
│ │ └── Player.cs.meta
│ ├── _Scenes.meta
│ └── _Scenes
│ │ ├── Game.meta
│ │ ├── Game.unity
│ │ ├── Game.unity.meta
│ │ ├── Game
│ │ ├── LightingData.asset
│ │ ├── LightingData.asset.meta
│ │ ├── ReflectionProbe-0.exr
│ │ └── ReflectionProbe-0.exr.meta
│ │ ├── GameAI.unity
│ │ ├── GameAI.unity.meta
│ │ ├── GameAIMultiple.unity
│ │ └── GameAIMultiple.unity.meta
└── ProjectSettings
│ ├── AudioManager.asset
│ ├── ClusterInputManager.asset
│ ├── DynamicsManager.asset
│ ├── EditorBuildSettings.asset
│ ├── EditorSettings.asset
│ ├── GraphicsSettings.asset
│ ├── InputManager.asset
│ ├── NavMeshAreas.asset
│ ├── NetworkManager.asset
│ ├── Physics2DSettings.asset
│ ├── ProjectSettings.asset
│ ├── ProjectVersion.txt
│ ├── QualitySettings.asset
│ ├── TagManager.asset
│ ├── TimeManager.asset
│ └── UnityConnectSettings.asset
├── python
├── .gitignore
├── jump#3.ipynb
├── jump.ipynb
├── jump.json
├── jump2.ipynb
├── jump2.json
├── jump3.json
├── models
│ └── jump4
│ │ ├── build3
│ │ └── jump.exe.bytes
│ │ ├── checkpoint
│ │ ├── model-377000.cptk.data-00000-of-00001
│ │ ├── model-377000.cptk.index
│ │ ├── model-377000.cptk.meta
│ │ ├── model-378000.cptk.data-00000-of-00001
│ │ ├── model-378000.cptk.index
│ │ ├── model-378000.cptk.meta
│ │ └── raw_graph_def.pb
├── ppo.py
├── ppo
│ ├── __init__.py
│ ├── history.py
│ ├── models.py
│ └── trainer.py
└── unityagents
│ ├── __init__.py
│ ├── brain.py
│ ├── curriculum.py
│ ├── environment.py
│ └── exception.py
├── training.gif
└── 关注“洪流学堂”公众号,让你快人几步.jpg
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 关尔Manic
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # unity-jumpjump-ml-agents
2 | The lite edition of JumpJump developed by Unity3d with AI developed by ml-agents.
3 |
4 | [JumpJump Game](https://github.com/zhenghongzhi/Unity-JumpJump)
5 |
6 | # Develop record
7 | [English](https://connect.unity.com/p/jump-tiao-yi-tiao-with-ml-agents-wip)
8 | [Unity3d开发跳一跳AI(ML-agents)全纪录](https://github.com/zhenghongzhi/unity-jumpjump-ml-agents/blob/master/Record%20-%20Chinese.md)
9 |
10 | 欢迎关注“洪流学堂”微信公众号
11 | ---
12 | 洪流学堂,让你快人几步。
13 | 
14 |
--------------------------------------------------------------------------------
/Record - Chinese.md:
--------------------------------------------------------------------------------
1 | >本文首发于“洪流学堂”微信公众号。
2 | 洪流学堂,让你快人几步!
3 |
4 | ## 来给我投一票吧~
5 | 长按识别下方二维码或文章左下角阅读原文,在页面中点一下赞👍,感谢大家!
6 | https://connect.unity.com/p/jump-tiao-yi-tiao-with-ml-agents-wip
7 | PS:在微信中投票不用登陆注册哦~
8 | 
9 |
10 | 
11 |
12 | # 跳一跳介绍
13 | 最近微信上非常火的一个小游戏,相信大家都已经玩过了。
14 |
15 | ## 玩法
16 | - 小人跳跃的距离和你按压屏幕的时长有关,按屏幕时间越长,跳的越远
17 | - 跳到盒子上可以加分,没跳到盒子上游戏结束
18 | - 连续跳到盒子中心可以成倍加分
19 |
20 | # 开发历程
21 | 阅读此文章需要有一定的Unity3d基础和unity-ml-agents基础。
22 | 文中有任何纰漏欢迎指正。
23 |
24 | ## 用Unity开发跳一跳
25 | 先参照微信原版用Unity3d开发了简版的跳一跳。
26 |
27 | 视频教程 https://edu.csdn.net/course/detail/6975
28 | 源码工程 https://github.com/zhenghongzhi/Unity-JumpJump
29 |
30 | ## PPO中一些名词解释
31 | ### Experience
32 | 每一次states,action及输出称为一次experience
33 |
34 | ### episode_length
35 | 指的是每一次游戏一个agent直到done所用的步数
36 |
37 | ### batch size
38 | 进行gradient descent的一个batch
39 |
40 | ### buffer size
41 | 先收集buffer size个数据,然后再计算进行gradient descent
42 |
43 | ### Number of Epochs
44 | 会对buffer size的数据处理几遍,比如为2,就会把这些数据处理2遍
45 |
46 | ### Time Horizon
47 | 被加入experience的条件是agent done或者收集到time horizon个的数据量才加入,为了搜集到更全的可能性,避免过拟合
48 |
49 | ## 模型迭代
50 | ### 迭代1
51 | 一开始模型建立很困惑,官方的demo里并没有这种给一个输入以后,需要一段时间等结果才出来进行下一步的例子。
52 |
53 | 如果使用2个按键分别表示按下和抬起的事件,并且训练出按键之间的联系,训练起来会很慢而且有可能无法拟合。
54 |
55 | 一开始尝试用Player类型的brain,结果发现无法实现,只能用两个键的方式。然后使用Heuristic来直接模拟按键的时长,即action只有一个值,一个连续型的float,代表按空格的时长。
56 | 这样的话只能去掉小人的缩放和台子的缩放效果。(后注:现在想来其实是有一个对应关系的,可以直接通过参数设置出来,但是没有过渡的动画。)
57 |
58 | 这个模型用5个值作为state,分别是小人位置坐标的x,小人位置坐标的z,下一个盒子位置的x,下一个盒子位置的z,下一个盒子的localScale的x(x和z相同)
59 |
60 | 在最开始的时候一直在考虑如果小人在空中的时候,action还一直输入,可能会在神经网络中建立出来奇怪的联系。所以本次迭代在小人在空中的时候如果给了大于0的action的时候给一个惩罚,reward -= 1**(这种想法其实是错误的)**
61 |
62 | 开始训练...
63 |
64 | #### 迭代1-1
65 | 经过2个小时的训练发现效果很不好
66 | 禁止输入应该是一个规则,而不应该惩罚玩家,即使玩家输入游戏也不应该有反馈,所以去掉了小人在空中时候的惩罚。
67 |
68 | 另外用Academy中的Frame to Skip参数,设为30,来减少无用的输入。
69 |
70 | 开始训练...
71 |
72 | #### 迭代1-2
73 | 游戏出现了卡死的情况,游戏中的判定有BUG,导致可以一直接收action并且没有获得reward。
74 | 修复BUG...开始训练...
75 |
76 | #### 迭代1-3
77 | 训练效果一直不好,又重新将unity-ml-agents里面的文档都看了一遍,特别参照best practice将参数重新调整了一遍开始训练。
78 | 训练了一个晚上,大概8个小时,效果依然不好...
79 |
80 | ### 迭代2
81 | 本来想着这么简单的模型,训练出来一定的成果再用curriculum的方式重新训练对比以下,看来只能直接上Curriculum看看效果了...
82 | 定义了如下的Curriculum文件
83 |
84 | ```
85 | {
86 | "measure" : "reward",
87 | "thresholds" : [10,10,10,10,10,10,10,10,10,10,10,10,10,10,10],
88 | "min_lesson_length" : 2,
89 | "signal_smoothing" : true,
90 | "parameters" :
91 | {
92 | "max_distance" : [1.1,1.1,1.1,1.1,1.5,1.5,1.5,1.5,2,2,2,2,3,3,3,3],
93 | "min_scale" : [1,1,0.5,0.5,1,1,0.5,0.5,1,1,0.5,0.5,1,1,0.5,0.5],
94 | "random_direction":[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]
95 | }
96 | }
97 | ```
98 | >这里需要注意的是,thresholds的值要比下面parameters里面的值少一个,因为最后一个lesson是会一直训练下去的,没有threshold
99 |
100 | #### 迭代2-1
101 | 忽然游戏崩了,发现log是场景里collider太多了
102 | 这次训练的效果还不错,但是游戏里还是有bug,导致box生成太多了
103 | 将box的生成方式改为对象池的方式,性能能优化不少,也应该不会有刚才的bug了
104 |
105 | #### 迭代2-2
106 | 嗯,这么训练确实不错,tensorboard里的cumulative_reward一直在增长,但是训练了一段时间以后想到一个可能存在的问题,由于第一个max_distance是1.1,和最小distance是一样的,也就是说下一个盒子总是距离现在的盒子1.1米,可能会有过拟合的问题,而且threshold貌似有点太大了,一直没有切换到下一个lesson
107 |
108 | 于是赶紧停掉训练,将第一个max_distance改成了1.2重新训练
109 |
110 | #### 迭代2-3
111 | 发现了不会切换lesson的问题,赶紧去查,在issues里面发现了答案,只有global_done为true时才会切换,需要将academy设为done或者设置一个max steps
112 | 这次将每次game over的时候academy设置为done
113 | 后来发现这样其实是有点问题的,write_summary之后cumulative_reward会清空,如果刚好这之后的cumulative_reward波动出来大的值,那么就会跳过lesson,这样随机性很大。怪不得官方的demo用的是max step 50000
114 |
115 | #### 迭代2-4
116 | 经过30小时的训练,第一版终于训练出来了,但是结果很不理想
117 | 
118 | 如图:
119 | 1. 第一个过程就是开始设置max_distance是1.1的时候,增长的很快
120 | 2. 修改为1.2之后,又训练了一段时间,发现不会切换lesson,然后改了bug
121 | 3. 后面lesson切换的很快
122 | 4. 最后训练了很久,但是cumulative_reward也没到1
123 |
124 | 于是开始反思模型上的问题,要简化模型,优化Curriculum。
125 |
126 | ### 迭代3
127 | 将state重新定义为2个,一个是小人与下一个盒子之间的距离,一个是下一个盒子的size
128 | Curriculum也重新定义为:
129 |
130 | ```
131 | {
132 | "measure" : "reward",
133 | "thresholds" : [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],
134 | "min_lesson_length" : 2,
135 | "signal_smoothing" : true,
136 | "parameters" :
137 | {
138 | "max_distance" : [1.2,1.2,1.2,1.2,1.5,1.5,1.5,1.5,2,2,2,2,3,3,3,3],
139 | "min_scale" : [1,0.9,0.7,0.5,1,0.9,0.7,0.5,1,0.9,0.7,0.5,1,0.9,0.7,0.5],
140 | "random_direction":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
141 | }
142 | }
143 | ```
144 | 由于现在state中是小人与下一个盒子之间的距离,而生成与跳跃方向又是游戏系统定的,所以random direction就没有什么用了。
145 | 而且问了能加快训练速度,重构了游戏和场景,使得可以有很多游戏instance可以一起训练,去掉random direction可以避免游戏之间发生冲突
146 | 
147 |
148 | #### 迭代3-1
149 | 出现了两次Info/cumulative_reward突然剧烈下降并且再也回不去的情况,虽然这两次发生的时候都进行了别的工程webgl的编译,但是应该还是参数的问题
150 | 1. 怀疑是layer为1的锅,虽然模型很简单,因为并不是线性关系那么简单,所以把layer加为2重新训练
151 | 1. 看来不是layer为1的锅。怀疑原地跳的话-0.1的惩罚有点太大了,改为-0.01重新训练试一下
152 | 1. 再次训练还是出现了剧烈下降,这次直接删掉原地跳的惩罚,再试验看看是什么问题
153 | 1. 还是会出现剧烈下降,试着寻找问题的原因
154 | 1. 修改了以下内容:
155 | - 去掉normalization,改为手动normalization
156 | - academy max steps改为1000
157 |
158 | 还是不行!!!!!!!!!!!!!!!
159 |
160 | 开始怀疑是多个instance同时运行出现的问题,但是没找到多个instance同时运行的逻辑问题
161 |
162 | 经过反复思考,得到是游戏机制问题。小人跳跃时不应该接收输入,否则的话前一个step的输入得到的reward值会是0,无法对应起来。之前设置的skipfram30确实有问题,无法将states,action和reward对应起来
163 |
164 | 2018年1月27日23点19分
165 | 但是经过debug发现,有超过200帧还无法接收下次输入的情况,高达5000帧,这样就没法用skip frame这个值了,训练速度会太慢太慢,怀疑程序有bug,调试中。。。
166 |
167 | 发现高达5000帧时,有player掉到地面以下的情况,可能是物理穿透,,加上一个y位置的判断,如果y的值小于1,那么表示小人穿透了地面gameover,并且将ground的box厚度改大
168 |
169 | 而且发现frame skip 有bug,还是我没理解对,竟然每帧都会执行step
170 | Edit:
171 | I find in Academy.cs line:345 that following code is not surrounded by `if (skippingFrames == false)`.
172 | Am I misunderstanding something?
173 | ```
174 | AcademyStep();
175 |
176 | foreach (Brain brain in brains)
177 | {
178 | brain.Step();
179 | }
180 | ```
181 | 在github上发了个issuse,寻求建议
182 | 重新调试测试,用代码的方式检测skipframe的最佳值,设为了200
183 | 是否跳到盒子上端的检测方式改为法线检测
184 | 并且将上述的代码加到了if判断里面
185 |
186 | #### 迭代3-2
187 | 2018年1月28日
188 | 今天早上起来发现模型还是不行,而且游戏里还有bug
189 | 14点29分
190 | 在github上发了个issuse,作者给了个建议,可以使用unsubscribe和resubscribe的方式来让小人在空中的时候不接受action
191 | 但是测试后发现不行,因为动态unsubscribe和resubscribe的话,agents数量是动态变化的,python端上次输入和这次输出的信息,可能长度不相等
192 | 输入的时候可能有10个小人的信息,但是输出的时候只有8个或20个
193 |
194 | 修复了游戏里的bug:跳到了下一个盒子侧面,又和当前的盒子发生了碰撞,会造成逻辑问题
195 |
196 | 最终解决方案还是得用frame skip,这次游戏运行稳定了,通过统计找到一个最佳值是137,而且小人每一步都不会超过137帧。将场景中game instance的数量设置为100个,layer 1,hidden units 32
197 | 开始训练
198 |
199 | 发现一个报错,game instance数量太多,导致socket buffer超出的问题,复现了几次,出现问题时收到的buffer长度都是1460或者1460的倍数。然后意识到这是由于socket的包分包所致
200 |
201 | >路由器有一个MTU( 最大传输单元),一般是1500字节,除去IP头部20字节,留给TCP的就只有MTU-20字节。所以一般TCP的MSS为MTU-20=1460字节。
202 |
203 | 还是会出现剧烈下降的问题,应该是learning rate的问题,learning rate太大了,降低learning rate到1e-4
204 | 终于训练成功了,但是跳到中心的几率不高,感觉需要修改reward,给跳到中心加分多一些 试试中心+1,台子上+0.1试试
205 |
206 | #### 迭代3-3
207 | 2018年1月29日13点21分
208 | 终于训练出比较成功的模型了,当前设置了小人最多跳100步,所以cumulative_reward最好也就是100
209 | ```
210 | Step: 349000. Mean Reward: 88.70098911968347. Std of Reward: 10.67634076995865.
211 | Saved Model
212 | Step: 350000. Mean Reward: 89.22838773491591. Std of Reward: 9.210647049058082.
213 | Saved Model
214 | Step: 351000. Mean Reward: 89.44072978303747. Std of Reward: 12.138629221972357.
215 | Saved Model
216 | ```
217 | 其实所有东西都搞对以后训练的速度还是挺快的,大概到200K步的时候Mean Reward就能到70了
218 |
219 | ### 后记
220 | 搞完以后尝试修复socket分包的问题,修复完创建PR的时候发现:
221 | >development-0.3的分支中已经修复这个问题
222 |
223 | 哈哈,白费功夫了~不过对python的socket通信以及粘包有了更深的了解
224 |
225 | # 总结
226 | 这个游戏也算是开创了一个mg-agents的游戏类型:需要等待一些时间才能得到reward的情况。
227 | 虽然最终是用skip frame解决的,但是中间做了很多的探索,也发现了ml-agents的一些局限。
228 | **贡献**:在GitHub上提了一个pull request(解决了env含有子目录时export_graph的bug)和2个issue(一个是寻求这种类型游戏的建议——作者回复会跟进这种类型游戏的支持;一个是unity端解析socket buffer的json失败的问题,自己修复了这个问题,不过development-0.3的分支中已经修复这个问题)。
229 | 自己在Unity3d的一些细节开发,增强学习、ml-agents的使用和理解上也有不小的进步。
230 | 共同交流,共勉~
231 |
232 | ---
233 | 
234 |
235 | ---
236 | 交流群:492325637
237 | **关注“洪流学堂”微信公众号,让你快人几步**
238 | 
239 |
240 | 
241 |
--------------------------------------------------------------------------------
/jumpjump/.gitignore:
--------------------------------------------------------------------------------
1 | .vs
2 | Library/
3 | Temp/
4 | *.csproj
5 | *.sln
6 | UnityPackageManager/
--------------------------------------------------------------------------------
/jumpjump/Assets/Data.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2de72f7438a1ac342a99ed5c20bf1920
3 | folderAsset: yes
4 | timeCreated: 1516964905
5 | licenseType: Pro
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Data/jump.exe.bytes:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Data/jump.exe.bytes
--------------------------------------------------------------------------------
/jumpjump/Assets/Data/jump.exe.bytes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 731f65b3bf56a5c498e60ec85921e779
3 | timeCreated: 1516977726
4 | licenseType: Pro
5 | TextScriptImporter:
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b3765853629919d40aee3c849a987043
3 | folderAsset: yes
4 | timeCreated: 1516084772
5 | licenseType: Pro
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 075d13501e120bb49b82f83b7f09f384
3 | folderAsset: yes
4 | timeCreated: 1516084772
5 | licenseType: Pro
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween.XML.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5ec570c4aad08e54aa562697147a6947
3 | timeCreated: 18446744011573954816
4 | TextScriptImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Demigiant/DOTween/DOTween.dll
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Demigiant/DOTween/DOTween.dll.mdb
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5c2dfc56de474cf43acb60e5b0ba64c9
3 | timeCreated: 18446744011573954816
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6e38ac6b1c3556b4c888ca8552375e1e
3 | timeCreated: 18446744011573954816
4 | PluginImporter:
5 | externalObjects: {}
6 | serializedVersion: 2
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | isOverridable: 0
11 | platformData:
12 | - first:
13 | Any:
14 | second:
15 | enabled: 1
16 | settings: {}
17 | userData:
18 | assetBundleName:
19 | assetBundleVariant:
20 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween43.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Demigiant/DOTween/DOTween43.dll
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween43.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Demigiant/DOTween/DOTween43.dll.mdb
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween43.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 92b9d87bc43f42d47a4d3dd662ddd88d
3 | timeCreated: 1516084796
4 | licenseType: Pro
5 | DefaultImporter:
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween43.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fcaedf977ebbf1c45b7f5d74654e470d
3 | timeCreated: 1516084799
4 | licenseType: Pro
5 | PluginImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | iconMap: {}
9 | executionOrder: {}
10 | isPreloaded: 0
11 | isOverridable: 0
12 | platformData:
13 | - first:
14 | Any:
15 | second:
16 | enabled: 1
17 | settings: {}
18 | - first:
19 | Editor: Editor
20 | second:
21 | enabled: 0
22 | settings:
23 | DefaultValueInitialized: true
24 | - first:
25 | Windows Store Apps: WindowsStoreApps
26 | second:
27 | enabled: 0
28 | settings:
29 | CPU: AnyCPU
30 | userData:
31 | assetBundleName:
32 | assetBundleVariant:
33 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween43.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DOTween43
5 |
6 |
7 |
8 |
9 | Methods that extend known Unity objects and allow to directly create and control tweens from their instances.
10 | These, as all DOTween43 methods, require Unity 4.3 or later.
11 |
12 |
13 |
14 | Tweens a Material's color using the given gradient
15 | (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
16 | Also stores the image as the tween's target so it can be used for filtered operations
17 | The gradient to useThe duration of the tween
18 |
19 |
20 | Tweens a Material's named color property using the given gradient
21 | (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
22 | Also stores the image as the tween's target so it can be used for filtered operations
23 | The gradient to use
24 | The name of the material property to tween (like _Tint or _SpecColor)
25 | The duration of the tween
26 |
27 |
28 | Tweens a SpriteRenderer's color to the given value.
29 | Also stores the spriteRenderer as the tween's target so it can be used for filtered operations
30 | The end value to reachThe duration of the tween
31 |
32 |
33 | Tweens a Material's alpha color to the given value.
34 | Also stores the spriteRenderer as the tween's target so it can be used for filtered operations
35 | The end value to reachThe duration of the tween
36 |
37 |
38 | Tweens a SpriteRenderer's color using the given gradient
39 | (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
40 | Also stores the image as the tween's target so it can be used for filtered operations
41 | The gradient to useThe duration of the tween
42 |
43 |
44 | Tweens a Rigidbody2D's position to the given value.
45 | Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations
46 | The end value to reachThe duration of the tween
47 | If TRUE the tween will smoothly snap all values to integers
48 |
49 |
50 | Tweens a Rigidbody2D's X position to the given value.
51 | Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations
52 | The end value to reachThe duration of the tween
53 | If TRUE the tween will smoothly snap all values to integers
54 |
55 |
56 | Tweens a Rigidbody2D's Y position to the given value.
57 | Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations
58 | The end value to reachThe duration of the tween
59 | If TRUE the tween will smoothly snap all values to integers
60 |
61 |
62 | Tweens a Rigidbody2D's rotation to the given value.
63 | Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations
64 | The end value to reachThe duration of the tween
65 |
66 |
67 | Tweens a Rigidbody2D's position to the given value, while also applying a jump effect along the Y axis.
68 | Returns a Sequence instead of a Tweener.
69 | Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations.
70 | IMPORTANT: a rigidbody2D can't be animated in a jump arc using MovePosition, so the tween will directly set the position
71 | The end value to reach
72 | Power of the jump (the max height of the jump is represented by this plus the final Y offset)
73 | Total number of jumps
74 | The duration of the tween
75 | If TRUE the tween will smoothly snap all values to integers
76 |
77 |
78 | Tweens a SpriteRenderer's color to the given value,
79 | in a way that allows other DOBlendableColor tweens to work together on the same target,
80 | instead than fight each other as multiple DOColor would do.
81 | Also stores the SpriteRenderer as the tween's target so it can be used for filtered operations
82 | The value to tween toThe duration of the tween
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween43.xml.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 854b79c4ec304e945b11e219e2a2dc22
3 | timeCreated: 1516084799
4 | licenseType: Pro
5 | TextScriptImporter:
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween46.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Demigiant/DOTween/DOTween46.dll
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween46.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Demigiant/DOTween/DOTween46.dll.mdb
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween46.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 51fd898f07beae04bbcda0e2be285605
3 | timeCreated: 1516084796
4 | licenseType: Pro
5 | DefaultImporter:
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween46.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 981273e8123e98248b4c875e01ae3d0e
3 | timeCreated: 1516084797
4 | licenseType: Pro
5 | PluginImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | iconMap: {}
9 | executionOrder: {}
10 | isPreloaded: 0
11 | isOverridable: 0
12 | platformData:
13 | - first:
14 | Any:
15 | second:
16 | enabled: 1
17 | settings: {}
18 | - first:
19 | Editor: Editor
20 | second:
21 | enabled: 0
22 | settings:
23 | DefaultValueInitialized: true
24 | - first:
25 | Windows Store Apps: WindowsStoreApps
26 | second:
27 | enabled: 0
28 | settings:
29 | CPU: AnyCPU
30 | userData:
31 | assetBundleName:
32 | assetBundleVariant:
33 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween46.xml.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4a3479df492976e428546949deeb1804
3 | timeCreated: 1516084799
4 | licenseType: Pro
5 | TextScriptImporter:
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween50.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Demigiant/DOTween/DOTween50.dll
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween50.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Demigiant/DOTween/DOTween50.dll.mdb
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween50.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: db33eb21000ed5545abb4e3d01f448b3
3 | timeCreated: 1516084796
4 | licenseType: Pro
5 | DefaultImporter:
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween50.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a20ccc4f4901fbf48ad0b38062503353
3 | timeCreated: 1516084798
4 | licenseType: Pro
5 | PluginImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | iconMap: {}
9 | executionOrder: {}
10 | isPreloaded: 0
11 | isOverridable: 0
12 | platformData:
13 | - first:
14 | Any:
15 | second:
16 | enabled: 1
17 | settings: {}
18 | - first:
19 | Editor: Editor
20 | second:
21 | enabled: 0
22 | settings:
23 | DefaultValueInitialized: true
24 | - first:
25 | Windows Store Apps: WindowsStoreApps
26 | second:
27 | enabled: 0
28 | settings:
29 | CPU: AnyCPU
30 | userData:
31 | assetBundleName:
32 | assetBundleVariant:
33 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween50.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DOTween50
5 |
6 |
7 |
8 |
9 | Methods that extend known Unity objects and allow to directly create and control tweens from their instances.
10 | These, as all DOTween50 methods, require Unity 5.0 or later.
11 |
12 |
13 |
14 | Tweens an AudioMixer's exposed float to the given value.
15 | Also stores the AudioMixer as the tween's target so it can be used for filtered operations.
16 | Note that you need to manually expose a float in an AudioMixerGroup in order to be able to tween it from an AudioMixer.
17 | Name given to the exposed float to set
18 | The end value to reachThe duration of the tween
19 |
20 |
21 |
22 | Completes all tweens that have this target as a reference
23 | (meaning tweens that were started from this target, or that had this target added as an Id)
24 | and returns the total number of tweens completed
25 | (meaning the tweens that don't have infinite loops and were not already complete)
26 |
27 | For Sequences only: if TRUE also internal Sequence callbacks will be fired,
28 | otherwise they will be ignored
29 |
30 |
31 |
32 | Kills all tweens that have this target as a reference
33 | (meaning tweens that were started from this target, or that had this target added as an Id)
34 | and returns the total number of tweens killed.
35 |
36 | If TRUE completes the tween before killing it
37 |
38 |
39 |
40 | Flips the direction (backwards if it was going forward or viceversa) of all tweens that have this target as a reference
41 | (meaning tweens that were started from this target, or that had this target added as an Id)
42 | and returns the total number of tweens flipped.
43 |
44 |
45 |
46 |
47 | Sends to the given position all tweens that have this target as a reference
48 | (meaning tweens that were started from this target, or that had this target added as an Id)
49 | and returns the total number of tweens involved.
50 |
51 | Time position to reach
52 | (if higher than the whole tween duration the tween will simply reach its end)
53 | If TRUE will play the tween after reaching the given position, otherwise it will pause it
54 |
55 |
56 |
57 | Pauses all tweens that have this target as a reference
58 | (meaning tweens that were started from this target, or that had this target added as an Id)
59 | and returns the total number of tweens paused.
60 |
61 |
62 |
63 |
64 | Plays all tweens that have this target as a reference
65 | (meaning tweens that were started from this target, or that had this target added as an Id)
66 | and returns the total number of tweens played.
67 |
68 |
69 |
70 |
71 | Plays backwards all tweens that have this target as a reference
72 | (meaning tweens that were started from this target, or that had this target added as an Id)
73 | and returns the total number of tweens played.
74 |
75 |
76 |
77 |
78 | Plays forward all tweens that have this target as a reference
79 | (meaning tweens that were started from this target, or that had this target added as an Id)
80 | and returns the total number of tweens played.
81 |
82 |
83 |
84 |
85 | Restarts all tweens that have this target as a reference
86 | (meaning tweens that were started from this target, or that had this target added as an Id)
87 | and returns the total number of tweens restarted.
88 |
89 |
90 |
91 |
92 | Rewinds all tweens that have this target as a reference
93 | (meaning tweens that were started from this target, or that had this target added as an Id)
94 | and returns the total number of tweens rewinded.
95 |
96 |
97 |
98 |
99 | Smoothly rewinds all tweens that have this target as a reference
100 | (meaning tweens that were started from this target, or that had this target added as an Id)
101 | and returns the total number of tweens rewinded.
102 |
103 |
104 |
105 |
106 | Toggles the paused state (plays if it was paused, pauses if it was playing) of all tweens that have this target as a reference
107 | (meaning tweens that were started from this target, or that had this target added as an Id)
108 | and returns the total number of tweens involved.
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/DOTween50.xml.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 97bf689ed184118459c2bbc8e793345f
3 | timeCreated: 1516084799
4 | licenseType: Pro
5 | TextScriptImporter:
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 12696ebeec218654eb593084bd2db068
3 | folderAsset: yes
4 | timeCreated: 1516084772
5 | licenseType: Pro
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DOTweenEditor
5 |
6 |
7 |
8 |
9 | Checks that the given editor texture use the correct import settings,
10 | and applies them if they're incorrect.
11 |
12 |
13 |
14 |
15 | Returns TRUE if addons setup is required.
16 |
17 |
18 |
19 |
20 | Returns TRUE if the file/directory at the given path exists.
21 |
22 | Path, relative to Unity's project folder
23 |
24 |
25 |
26 |
27 | Converts the given project-relative path to a full path,
28 | with backward (\) slashes).
29 |
30 |
31 |
32 |
33 | Converts the given full path to a path usable with AssetDatabase methods
34 | (relative to Unity's project folder, and with the correct Unity forward (/) slashes).
35 |
36 |
37 |
38 |
39 | Connects to a asset.
40 | If the asset already exists at the given path, loads it and returns it.
41 | Otherwise, either returns NULL or automatically creates it before loading and returning it
42 | (depending on the given parameters).
43 |
44 | Asset type
45 | File path (relative to Unity's project folder)
46 | If TRUE and the requested asset doesn't exist, forces its creation
47 |
48 |
49 |
50 | Full path for the given loaded assembly, assembly file included
51 |
52 |
53 |
54 |
55 | Not used as menu item anymore, but as a utiity function
56 |
57 |
58 |
59 |
60 | Setups DOTween
61 |
62 | If TRUE, no warning window appears in case there is no need for setup
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor/DOTweenEditor.XML.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5405503ee5afddc42bf1b95cabc6ad89
3 | timeCreated: 18446744011573954816
4 | TextScriptImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3402d640d15ce8e4bb99cb4cbb26ea7d
3 | timeCreated: 18446744011573954816
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0d6555af380a7264a9cd5a9083b1c4ad
3 | timeCreated: 18446744011573954816
4 | PluginImporter:
5 | externalObjects: {}
6 | serializedVersion: 2
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | isOverridable: 0
11 | platformData:
12 | - first:
13 | Any:
14 | second:
15 | enabled: 1
16 | settings: {}
17 | userData:
18 | assetBundleName:
19 | assetBundleVariant:
20 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor/Imgs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7793b6fa484644542bfd0f3b233036f6
3 | folderAsset: yes
4 | timeCreated: 1516084773
5 | licenseType: Pro
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0d7e06117784ff44bacb9c9e551592b3
3 | timeCreated: 18446744011573954816
4 | TextureImporter:
5 | fileIDToRecycleName: {}
6 | externalObjects: {}
7 | serializedVersion: 4
8 | mipmaps:
9 | mipMapMode: 0
10 | enableMipMap: 1
11 | sRGBTexture: 1
12 | linearTexture: 0
13 | fadeOut: 0
14 | borderMipMap: 0
15 | mipMapsPreserveCoverage: 0
16 | alphaTestReferenceValue: 0.5
17 | mipMapFadeDistanceStart: 1
18 | mipMapFadeDistanceEnd: 3
19 | bumpmap:
20 | convertToNormalMap: 0
21 | externalNormalMap: 0
22 | heightScale: 0.25
23 | normalMapFilter: 0
24 | isReadable: 0
25 | grayScaleToAlpha: 0
26 | generateCubemap: 6
27 | cubemapConvolution: 0
28 | seamlessCubemap: 0
29 | textureFormat: -1
30 | maxTextureSize: 1024
31 | textureSettings:
32 | serializedVersion: 2
33 | filterMode: -1
34 | aniso: -1
35 | mipBias: -1
36 | wrapU: -1
37 | wrapV: -1
38 | wrapW: -1
39 | nPOTScale: 1
40 | lightmap: 0
41 | compressionQuality: 50
42 | spriteMode: 0
43 | spriteExtrude: 1
44 | spriteMeshType: 1
45 | alignment: 0
46 | spritePivot: {x: 0.5, y: 0.5}
47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
48 | spritePixelsToUnits: 100
49 | alphaUsage: 1
50 | alphaIsTransparency: 0
51 | spriteTessellationDetail: -1
52 | textureType: 0
53 | textureShape: 1
54 | maxTextureSizeSet: 0
55 | compressionQualitySet: 0
56 | textureFormatSet: 0
57 | platformSettings:
58 | - buildTarget: DefaultTexturePlatform
59 | maxTextureSize: 1024
60 | resizeAlgorithm: 0
61 | textureFormat: -1
62 | textureCompression: 1
63 | compressionQuality: 50
64 | crunchedCompression: 0
65 | allowsAlphaSplitting: 0
66 | overridden: 0
67 | androidETC2FallbackOverride: 0
68 | spriteSheet:
69 | serializedVersion: 2
70 | sprites: []
71 | outline: []
72 | physicsShape: []
73 | spritePackingTag:
74 | userData:
75 | assetBundleName:
76 | assetBundleVariant:
77 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor/Imgs/Footer.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0ce7b533e9764c141a068fadd859f9a6
3 | timeCreated: 18446744011573954816
4 | TextureImporter:
5 | fileIDToRecycleName: {}
6 | externalObjects: {}
7 | serializedVersion: 4
8 | mipmaps:
9 | mipMapMode: 0
10 | enableMipMap: 0
11 | sRGBTexture: 0
12 | linearTexture: 1
13 | fadeOut: 0
14 | borderMipMap: 0
15 | mipMapsPreserveCoverage: 0
16 | alphaTestReferenceValue: 0.5
17 | mipMapFadeDistanceStart: 1
18 | mipMapFadeDistanceEnd: 3
19 | bumpmap:
20 | convertToNormalMap: 0
21 | externalNormalMap: 0
22 | heightScale: 0.25
23 | normalMapFilter: 0
24 | isReadable: 0
25 | grayScaleToAlpha: 0
26 | generateCubemap: 6
27 | cubemapConvolution: 0
28 | seamlessCubemap: 0
29 | textureFormat: -3
30 | maxTextureSize: 256
31 | textureSettings:
32 | serializedVersion: 2
33 | filterMode: 1
34 | aniso: 1
35 | mipBias: -1
36 | wrapU: 1
37 | wrapV: 1
38 | wrapW: 1
39 | nPOTScale: 0
40 | lightmap: 0
41 | compressionQuality: 50
42 | spriteMode: 0
43 | spriteExtrude: 1
44 | spriteMeshType: 1
45 | alignment: 0
46 | spritePivot: {x: 0.5, y: 0.5}
47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
48 | spritePixelsToUnits: 100
49 | alphaUsage: 1
50 | alphaIsTransparency: 1
51 | spriteTessellationDetail: -1
52 | textureType: 2
53 | textureShape: 1
54 | maxTextureSizeSet: 0
55 | compressionQualitySet: 0
56 | textureFormatSet: 0
57 | platformSettings:
58 | - buildTarget: DefaultTexturePlatform
59 | maxTextureSize: 256
60 | resizeAlgorithm: 0
61 | textureFormat: -1
62 | textureCompression: 0
63 | compressionQuality: 50
64 | crunchedCompression: 0
65 | allowsAlphaSplitting: 0
66 | overridden: 0
67 | androidETC2FallbackOverride: 0
68 | spriteSheet:
69 | serializedVersion: 2
70 | sprites: []
71 | outline: []
72 | physicsShape: []
73 | spritePackingTag:
74 | userData:
75 | assetBundleName:
76 | assetBundleVariant:
77 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor/Imgs/Footer_dark.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 073261fcf37d98645bac61b0e19ec84f
3 | timeCreated: 18446744011573954816
4 | TextureImporter:
5 | fileIDToRecycleName: {}
6 | externalObjects: {}
7 | serializedVersion: 4
8 | mipmaps:
9 | mipMapMode: 0
10 | enableMipMap: 1
11 | sRGBTexture: 1
12 | linearTexture: 0
13 | fadeOut: 0
14 | borderMipMap: 0
15 | mipMapsPreserveCoverage: 0
16 | alphaTestReferenceValue: 0.5
17 | mipMapFadeDistanceStart: 1
18 | mipMapFadeDistanceEnd: 3
19 | bumpmap:
20 | convertToNormalMap: 0
21 | externalNormalMap: 0
22 | heightScale: 0.25
23 | normalMapFilter: 0
24 | isReadable: 0
25 | grayScaleToAlpha: 0
26 | generateCubemap: 6
27 | cubemapConvolution: 0
28 | seamlessCubemap: 0
29 | textureFormat: -1
30 | maxTextureSize: 1024
31 | textureSettings:
32 | serializedVersion: 2
33 | filterMode: -1
34 | aniso: -1
35 | mipBias: -1
36 | wrapU: -1
37 | wrapV: -1
38 | wrapW: -1
39 | nPOTScale: 1
40 | lightmap: 0
41 | compressionQuality: 50
42 | spriteMode: 0
43 | spriteExtrude: 1
44 | spriteMeshType: 1
45 | alignment: 0
46 | spritePivot: {x: 0.5, y: 0.5}
47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
48 | spritePixelsToUnits: 100
49 | alphaUsage: 1
50 | alphaIsTransparency: 0
51 | spriteTessellationDetail: -1
52 | textureType: 0
53 | textureShape: 1
54 | maxTextureSizeSet: 0
55 | compressionQualitySet: 0
56 | textureFormatSet: 0
57 | platformSettings:
58 | - buildTarget: DefaultTexturePlatform
59 | maxTextureSize: 1024
60 | resizeAlgorithm: 0
61 | textureFormat: -1
62 | textureCompression: 1
63 | compressionQuality: 50
64 | crunchedCompression: 0
65 | allowsAlphaSplitting: 0
66 | overridden: 0
67 | androidETC2FallbackOverride: 0
68 | spriteSheet:
69 | serializedVersion: 2
70 | sprites: []
71 | outline: []
72 | physicsShape: []
73 | spritePackingTag:
74 | userData:
75 | assetBundleName:
76 | assetBundleVariant:
77 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Editor/Imgs/Header.jpg.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7741b4957200f0747a3c79d148de2402
3 | timeCreated: 18446744011573954816
4 | TextureImporter:
5 | fileIDToRecycleName: {}
6 | externalObjects: {}
7 | serializedVersion: 4
8 | mipmaps:
9 | mipMapMode: 0
10 | enableMipMap: 0
11 | sRGBTexture: 0
12 | linearTexture: 1
13 | fadeOut: 0
14 | borderMipMap: 0
15 | mipMapsPreserveCoverage: 0
16 | alphaTestReferenceValue: 0.5
17 | mipMapFadeDistanceStart: 1
18 | mipMapFadeDistanceEnd: 3
19 | bumpmap:
20 | convertToNormalMap: 0
21 | externalNormalMap: 0
22 | heightScale: 0.25
23 | normalMapFilter: 0
24 | isReadable: 0
25 | grayScaleToAlpha: 0
26 | generateCubemap: 6
27 | cubemapConvolution: 0
28 | seamlessCubemap: 0
29 | textureFormat: -3
30 | maxTextureSize: 512
31 | textureSettings:
32 | serializedVersion: 2
33 | filterMode: 1
34 | aniso: 1
35 | mipBias: -1
36 | wrapU: 1
37 | wrapV: 1
38 | wrapW: 1
39 | nPOTScale: 0
40 | lightmap: 0
41 | compressionQuality: 50
42 | spriteMode: 0
43 | spriteExtrude: 1
44 | spriteMeshType: 1
45 | alignment: 0
46 | spritePivot: {x: 0.5, y: 0.5}
47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
48 | spritePixelsToUnits: 100
49 | alphaUsage: 1
50 | alphaIsTransparency: 1
51 | spriteTessellationDetail: -1
52 | textureType: 2
53 | textureShape: 1
54 | maxTextureSizeSet: 0
55 | compressionQualitySet: 0
56 | textureFormatSet: 0
57 | platformSettings:
58 | - buildTarget: DefaultTexturePlatform
59 | maxTextureSize: 512
60 | resizeAlgorithm: 0
61 | textureFormat: -1
62 | textureCompression: 0
63 | compressionQuality: 50
64 | crunchedCompression: 0
65 | allowsAlphaSplitting: 0
66 | overridden: 0
67 | androidETC2FallbackOverride: 0
68 | spriteSheet:
69 | serializedVersion: 2
70 | sprites: []
71 | outline: []
72 | physicsShape: []
73 | spritePackingTag:
74 | userData:
75 | assetBundleName:
76 | assetBundleVariant:
77 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Examples.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 323035bab23c56841967ddaea1b82217
3 | folderAsset: yes
4 | timeCreated: 1516084772
5 | licenseType: Pro
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Examples/Basics.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using DG.Tweening;
4 |
5 | public class Basics : MonoBehaviour
6 | {
7 | public Transform cubeA, cubeB;
8 |
9 | void Start()
10 | {
11 | // Initialize DOTween (needs to be done only once).
12 | // If you don't initialize DOTween yourself,
13 | // it will be automatically initialized with default values.
14 | DOTween.Init(false, true, LogBehaviour.ErrorsOnly);
15 |
16 | // Create two identical infinitely looping tweens,
17 | // one with the shortcuts way and the other with the generic way.
18 | // Both will be set to "relative" so the given movement will be calculated
19 | // relative to each target's position.
20 |
21 | // cubeA > SHORTCUTS WAY
22 | cubeA.DOMove(new Vector3(-2, 2, 0), 1).SetRelative().SetLoops(-1, LoopType.Yoyo);
23 |
24 | // cubeB > GENERIC WAY
25 | DOTween.To(()=> cubeB.position, x=> cubeB.position = x, new Vector3(-2, 2, 0), 1).SetRelative().SetLoops(-1, LoopType.Yoyo);
26 |
27 | // Voilà.
28 | // To see all available shortcuts check out DOTween's online documentation.
29 | }
30 | }
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Examples/Basics.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bd8fbb7a4676fb2489baf12d089a3487
3 | timeCreated: 18446744011573954816
4 | MonoImporter:
5 | externalObjects: {}
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Examples/Basics.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 428aaae50d293ae4e90c063ad86e6d8d
3 | timeCreated: 18446744011573954816
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Examples/Sequences.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using DG.Tweening;
4 |
5 | public class Sequences : MonoBehaviour
6 | {
7 | public Transform target;
8 |
9 | void Start()
10 | {
11 | // FIRST OF ALL, note this!
12 | // Sequences contain and animate other tweens,
13 | // but they DON'T need to be one after each other:
14 | // you can overlap them how you want :)
15 |
16 | // Let's create a Sequence which will first rotate AND move the target's Y at the same time,
17 | // then when the move + rotation is finished it will scale it.
18 | // Also, during all the tween, we will make sure that the target also moves on the X axis.
19 |
20 | // Create new Sequence object
21 | Sequence mySequence = DOTween.Sequence();
22 | // Add a 1 second move tween only on the Y axis
23 | mySequence.Append(target.DOMoveY(2, 1));
24 | // Add a 1 second rotation tween, using Join so it will start when the previous one starts
25 | mySequence.Join(target.DORotate(new Vector3(0, 135, 0), 1));
26 | // Add a 1 second scale Y tween, using Append so it will start after the previously added tweens end
27 | mySequence.Append(target.DOScaleY(0.2f, 1));
28 | // Add an X axis relative move tween that will start from the beginning of the Sequence
29 | // and last for the whole Sequence duration
30 | mySequence.Insert(0, target.DOMoveX(4, mySequence.Duration()).SetRelative());
31 |
32 | // Oh, and let's also make the whole Sequence loop backward and forward 4 times
33 | mySequence.SetLoops(4, LoopType.Yoyo);
34 | }
35 | }
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Examples/Sequences.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8451d6e43ee8ba44f94370248b8c589f
3 | timeCreated: 18446744011573954816
4 | MonoImporter:
5 | externalObjects: {}
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/Examples/Sequences.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: eddd6e3d3a7e7e044a19b9b98e73c66c
3 | timeCreated: 18446744011573954816
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/readme.txt:
--------------------------------------------------------------------------------
1 | DOTween and DOTween Pro are copyright (c) 2014 Daniele Giardini - Demigiant
2 |
3 | // GET STARTED //////////////////////////////////////////////
4 |
5 | - After importing a new DOTween update, select DOTween's Utility Panel from the Tools menu (if it doesn't open automatically) and press the "Setup DOTween..." button to set up additional features based on your Unity version.
6 | - In your code, add "using DG.Tweening" to each class where you want to use DOTween.
7 | - You're ready to tween. Check out the links below for full documentation and license info.
8 |
9 |
10 | // LINKS ///////////////////////////////////////////////////////
11 |
12 | DOTween website (documentation, examples, etc): http://dotween.demigiant.com
13 | DOTween license: http://dotween.demigiant.com/license.php
14 | DOTween repository (Google Code): https://code.google.com/p/dotween/
15 |
16 | // NOTES //////////////////////////////////////////////////////
17 |
18 | - DOTween's Utility Panel can be found under "Tools > DOTween Utility Panel" and also contains other useful options, plus a tab to set DOTween's preferences
--------------------------------------------------------------------------------
/jumpjump/Assets/Demigiant/DOTween/readme.txt.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6a094c30a6fab4a479d30af956a423f0
3 | timeCreated: 18446744011573954816
4 | TextScriptImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Logo.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ddfdcb1dda6592241a97a6dc00d37e47
3 | folderAsset: yes
4 | timeCreated: 1516980995
5 | licenseType: Pro
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Logo/洪流学堂logo - 横板.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/Logo/洪流学堂logo - 横板.png
--------------------------------------------------------------------------------
/jumpjump/Assets/Logo/洪流学堂logo - 横板.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c8086baafd787e34b86ca17390f9b086
3 | timeCreated: 1516981028
4 | licenseType: Pro
5 | TextureImporter:
6 | fileIDToRecycleName: {}
7 | externalObjects: {}
8 | serializedVersion: 4
9 | mipmaps:
10 | mipMapMode: 0
11 | enableMipMap: 0
12 | sRGBTexture: 1
13 | linearTexture: 0
14 | fadeOut: 0
15 | borderMipMap: 0
16 | mipMapsPreserveCoverage: 0
17 | alphaTestReferenceValue: 0.5
18 | mipMapFadeDistanceStart: 1
19 | mipMapFadeDistanceEnd: 3
20 | bumpmap:
21 | convertToNormalMap: 0
22 | externalNormalMap: 0
23 | heightScale: 0.25
24 | normalMapFilter: 0
25 | isReadable: 0
26 | grayScaleToAlpha: 0
27 | generateCubemap: 6
28 | cubemapConvolution: 0
29 | seamlessCubemap: 0
30 | textureFormat: 1
31 | maxTextureSize: 2048
32 | textureSettings:
33 | serializedVersion: 2
34 | filterMode: -1
35 | aniso: -1
36 | mipBias: -1
37 | wrapU: 1
38 | wrapV: 1
39 | wrapW: -1
40 | nPOTScale: 0
41 | lightmap: 0
42 | compressionQuality: 50
43 | spriteMode: 1
44 | spriteExtrude: 1
45 | spriteMeshType: 1
46 | alignment: 0
47 | spritePivot: {x: 0.5, y: 0.5}
48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
49 | spritePixelsToUnits: 100
50 | alphaUsage: 1
51 | alphaIsTransparency: 1
52 | spriteTessellationDetail: -1
53 | textureType: 8
54 | textureShape: 1
55 | maxTextureSizeSet: 0
56 | compressionQualitySet: 0
57 | textureFormatSet: 0
58 | platformSettings:
59 | - buildTarget: DefaultTexturePlatform
60 | maxTextureSize: 2048
61 | resizeAlgorithm: 0
62 | textureFormat: -1
63 | textureCompression: 1
64 | compressionQuality: 50
65 | crunchedCompression: 0
66 | allowsAlphaSplitting: 0
67 | overridden: 0
68 | androidETC2FallbackOverride: 0
69 | - buildTarget: Standalone
70 | maxTextureSize: 2048
71 | resizeAlgorithm: 0
72 | textureFormat: -1
73 | textureCompression: 1
74 | compressionQuality: 50
75 | crunchedCompression: 0
76 | allowsAlphaSplitting: 0
77 | overridden: 0
78 | androidETC2FallbackOverride: 0
79 | - buildTarget: WebGL
80 | maxTextureSize: 2048
81 | resizeAlgorithm: 0
82 | textureFormat: -1
83 | textureCompression: 1
84 | compressionQuality: 50
85 | crunchedCompression: 0
86 | allowsAlphaSplitting: 0
87 | overridden: 0
88 | androidETC2FallbackOverride: 0
89 | spriteSheet:
90 | serializedVersion: 2
91 | sprites: []
92 | outline: []
93 | physicsShape: []
94 | spritePackingTag:
95 | userData:
96 | assetBundleName:
97 | assetBundleVariant:
98 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 11630fa83cc8b4194b94352e3e6cdb9d
3 | folderAsset: yes
4 | timeCreated: 1504127524
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 67b4fb0b937cc471eae742addf6bda86
3 | folderAsset: yes
4 | timeCreated: 1503177274
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Editor/BrainEditor.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | using UnityEditor;
6 | using System.Linq;
7 | /*
8 | This code is meant to modify the behavior of the inspector on Brain Components.
9 | Depending on the type of brain that is used, the available fields will be modified in the inspector accordingly.
10 | */
11 | [CustomEditor (typeof(Brain))]
12 | public class BrainEditor : Editor
13 | {
14 | public override void OnInspectorGUI ()
15 | {
16 | Brain myBrain = (Brain)target;
17 | SerializedObject serializedBrain = serializedObject;
18 |
19 | if (myBrain.transform.parent == null) {
20 | EditorGUILayout.HelpBox ("A Brain GameObject must be a child of an Academy GameObject!", MessageType.Error);
21 | } else if (myBrain.transform.parent.GetComponent () == null) {
22 | EditorGUILayout.HelpBox ("The Parent of a Brain must have an Academy Component attached to it!", MessageType.Error);
23 | }
24 |
25 | BrainParameters parameters = myBrain.brainParameters;
26 | if (parameters.actionDescriptions == null || parameters.actionDescriptions.Length != parameters.actionSize)
27 | parameters.actionDescriptions = new string[parameters.actionSize];
28 |
29 | serializedBrain.Update();
30 |
31 | SerializedProperty bp = serializedBrain.FindProperty ("brainParameters");
32 | EditorGUILayout.PropertyField(bp, true);
33 |
34 | SerializedProperty bt = serializedBrain.FindProperty("brainType");
35 | EditorGUILayout.PropertyField(bt);
36 |
37 | if (bt.enumValueIndex < 0) {
38 | bt.enumValueIndex = (int)BrainType.Player;
39 | }
40 |
41 | serializedBrain.ApplyModifiedProperties();
42 |
43 | myBrain.UpdateCoreBrains ();
44 | myBrain.coreBrain.OnInspector ();
45 |
46 | #if !NET_4_6 && ENABLE_TENSORFLOW
47 | EditorGUILayout.HelpBox ("You cannot have ENABLE_TENSORFLOW without NET_4_6", MessageType.Error);
48 | #endif
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Editor/BrainEditor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f1895a43ed0f54ffd9ee06234c4399e7
3 | timeCreated: 1503270350
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Plugins.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d6d56028f4c564724878c82cfa3c9e14
3 | folderAsset: yes
4 | timeCreated: 1502996258
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Plugins/Computer.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 26e04a3daab454dc59ee4cbb4e1268ec
3 | folderAsset: yes
4 | timeCreated: 1495643996
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Plugins/Computer/TensorFlowSharp.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/ML-Agents/Plugins/Computer/TensorFlowSharp.dll
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Plugins/Computer/TensorFlowSharp.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 76aeb08f442d443b586dac551f4939d8
3 | timeCreated: 1495643828
4 | licenseType: Pro
5 | PluginImporter:
6 | serializedVersion: 2
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | isOverridable: 0
11 | platformData:
12 | data:
13 | first:
14 | '': Any
15 | second:
16 | enabled: 0
17 | settings:
18 | Exclude Editor: 0
19 | Exclude Linux: 0
20 | Exclude Linux64: 0
21 | Exclude LinuxUniversal: 0
22 | Exclude OSXIntel: 0
23 | Exclude OSXIntel64: 0
24 | Exclude OSXUniversal: 0
25 | Exclude Win: 0
26 | Exclude Win64: 0
27 | Exclude iOS: 1
28 | data:
29 | first:
30 | Any:
31 | second:
32 | enabled: 0
33 | settings: {}
34 | data:
35 | first:
36 | Editor: Editor
37 | second:
38 | enabled: 1
39 | settings:
40 | CPU: AnyCPU
41 | DefaultValueInitialized: true
42 | OS: AnyOS
43 | data:
44 | first:
45 | Facebook: Win
46 | second:
47 | enabled: 0
48 | settings:
49 | CPU: AnyCPU
50 | data:
51 | first:
52 | Facebook: Win64
53 | second:
54 | enabled: 0
55 | settings:
56 | CPU: AnyCPU
57 | data:
58 | first:
59 | Standalone: Linux
60 | second:
61 | enabled: 1
62 | settings:
63 | CPU: x86
64 | data:
65 | first:
66 | Standalone: Linux64
67 | second:
68 | enabled: 1
69 | settings:
70 | CPU: x86_64
71 | data:
72 | first:
73 | Standalone: LinuxUniversal
74 | second:
75 | enabled: 1
76 | settings:
77 | CPU: AnyCPU
78 | data:
79 | first:
80 | Standalone: OSXIntel
81 | second:
82 | enabled: 1
83 | settings:
84 | CPU: AnyCPU
85 | data:
86 | first:
87 | Standalone: OSXIntel64
88 | second:
89 | enabled: 1
90 | settings:
91 | CPU: AnyCPU
92 | data:
93 | first:
94 | Standalone: OSXUniversal
95 | second:
96 | enabled: 1
97 | settings:
98 | CPU: AnyCPU
99 | data:
100 | first:
101 | Standalone: Win
102 | second:
103 | enabled: 1
104 | settings:
105 | CPU: AnyCPU
106 | data:
107 | first:
108 | Standalone: Win64
109 | second:
110 | enabled: 1
111 | settings:
112 | CPU: AnyCPU
113 | data:
114 | first:
115 | Windows Store Apps: WindowsStoreApps
116 | second:
117 | enabled: 0
118 | settings:
119 | CPU: AnyCPU
120 | data:
121 | first:
122 | iPhone: iOS
123 | second:
124 | enabled: 0
125 | settings:
126 | CompileFlags:
127 | FrameworkDependencies:
128 | userData:
129 | assetBundleName:
130 | assetBundleVariant:
131 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Plugins/Computer/libtensorflow.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/ML-Agents/Plugins/Computer/libtensorflow.dll
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Plugins/Computer/libtensorflow.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c857dec6285d44dbda6b3bbea6da2a35
3 | timeCreated: 1500263118
4 | licenseType: Free
5 | PluginImporter:
6 | serializedVersion: 2
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | isOverridable: 0
11 | platformData:
12 | data:
13 | first:
14 | '': Any
15 | second:
16 | enabled: 0
17 | settings:
18 | Exclude Android: 1
19 | Exclude Editor: 0
20 | Exclude Linux: 0
21 | Exclude Linux64: 0
22 | Exclude LinuxUniversal: 0
23 | Exclude OSXIntel: 0
24 | Exclude OSXIntel64: 0
25 | Exclude OSXUniversal: 0
26 | Exclude Win: 0
27 | Exclude Win64: 0
28 | Exclude iOS: 1
29 | data:
30 | first:
31 | '': Editor
32 | second:
33 | enabled: 0
34 | settings:
35 | CPU: AnyCPU
36 | OS: AnyOS
37 | data:
38 | first:
39 | Android: Android
40 | second:
41 | enabled: 0
42 | settings:
43 | CPU: ARMv7
44 | data:
45 | first:
46 | Any:
47 | second:
48 | enabled: 0
49 | settings: {}
50 | data:
51 | first:
52 | Editor: Editor
53 | second:
54 | enabled: 1
55 | settings:
56 | DefaultValueInitialized: true
57 | data:
58 | first:
59 | Facebook: Win
60 | second:
61 | enabled: 0
62 | settings:
63 | CPU: AnyCPU
64 | data:
65 | first:
66 | Facebook: Win64
67 | second:
68 | enabled: 0
69 | settings:
70 | CPU: AnyCPU
71 | data:
72 | first:
73 | Standalone: Linux
74 | second:
75 | enabled: 1
76 | settings:
77 | CPU: x86
78 | data:
79 | first:
80 | Standalone: Linux64
81 | second:
82 | enabled: 1
83 | settings:
84 | CPU: x86_64
85 | data:
86 | first:
87 | Standalone: LinuxUniversal
88 | second:
89 | enabled: 1
90 | settings: {}
91 | data:
92 | first:
93 | Standalone: OSXIntel
94 | second:
95 | enabled: 1
96 | settings:
97 | CPU: AnyCPU
98 | data:
99 | first:
100 | Standalone: OSXIntel64
101 | second:
102 | enabled: 1
103 | settings:
104 | CPU: AnyCPU
105 | data:
106 | first:
107 | Standalone: OSXUniversal
108 | second:
109 | enabled: 1
110 | settings: {}
111 | data:
112 | first:
113 | Standalone: Win
114 | second:
115 | enabled: 1
116 | settings:
117 | CPU: AnyCPU
118 | data:
119 | first:
120 | Standalone: Win64
121 | second:
122 | enabled: 1
123 | settings:
124 | CPU: AnyCPU
125 | data:
126 | first:
127 | iPhone: iOS
128 | second:
129 | enabled: 0
130 | settings:
131 | CompileFlags:
132 | FrameworkDependencies:
133 | userData:
134 | assetBundleName:
135 | assetBundleVariant:
136 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Plugins/JSON.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 19240955c74d74ddf87ba8e888965f7b
3 | folderAsset: yes
4 | timeCreated: 1504198536
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Plugins/JSON/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/ML-Agents/Plugins/JSON/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Plugins/JSON/Newtonsoft.Json.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2471d838da1db4d07ad5ad6a2c196a5b
3 | timeCreated: 1489286987
4 | licenseType: Pro
5 | PluginImporter:
6 | serializedVersion: 1
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | isOverridable: 0
11 | platformData:
12 | Any:
13 | enabled: 1
14 | settings: {}
15 | Editor:
16 | enabled: 0
17 | settings:
18 | DefaultValueInitialized: true
19 | WindowsStoreApps:
20 | enabled: 0
21 | settings:
22 | CPU: AnyCPU
23 | userData:
24 | assetBundleName:
25 | assetBundleVariant:
26 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Plugins/System.Numerics.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/ML-Agents/Plugins/System.Numerics.dll
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Plugins/System.Numerics.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 20a40c3d586dd4579b7c0d5795606b80
3 | timeCreated: 1504463125
4 | licenseType: Pro
5 | PluginImporter:
6 | serializedVersion: 2
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | isOverridable: 0
11 | platformData:
12 | data:
13 | first:
14 | Any:
15 | second:
16 | enabled: 1
17 | settings: {}
18 | data:
19 | first:
20 | Editor: Editor
21 | second:
22 | enabled: 0
23 | settings:
24 | DefaultValueInitialized: true
25 | data:
26 | first:
27 | Windows Store Apps: WindowsStoreApps
28 | second:
29 | enabled: 0
30 | settings:
31 | CPU: AnyCPU
32 | userData:
33 | assetBundleName:
34 | assetBundleVariant:
35 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Plugins/System.ValueTuple.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/ML-Agents/Plugins/System.ValueTuple.dll
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Plugins/System.ValueTuple.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 20a642574115c41ce9fd833992de7585
3 | timeCreated: 1504463125
4 | licenseType: Pro
5 | PluginImporter:
6 | serializedVersion: 2
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | isOverridable: 0
11 | platformData:
12 | data:
13 | first:
14 | Any:
15 | second:
16 | enabled: 1
17 | settings: {}
18 | data:
19 | first:
20 | Editor: Editor
21 | second:
22 | enabled: 0
23 | settings:
24 | DefaultValueInitialized: true
25 | data:
26 | first:
27 | Windows Store Apps: WindowsStoreApps
28 | second:
29 | enabled: 0
30 | settings:
31 | CPU: AnyCPU
32 | userData:
33 | assetBundleName:
34 | assetBundleVariant:
35 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9a3740bf890474fc9857a8ec39739a35
3 | folderAsset: yes
4 | timeCreated: 1502223516
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/Academy.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | /*! \mainpage ML-Agents Index Page
6 | * Welcome to Unity Machine Learning Agents documentation.
7 | */
8 |
9 |
10 | [System.Serializable]
11 | public class ScreenConfiguration
12 | {
13 | public int width;
14 | public int height;
15 | [Range(0, 5)]
16 | public int qualityLevel;
17 | [Range(1f, 100f)]
18 | public float timeScale;
19 | public int targetFrameRate;
20 |
21 | public ScreenConfiguration(int w, int h, int q, float ts, int tf)
22 | {
23 | width = w;
24 | height = h;
25 | qualityLevel = q;
26 | timeScale = ts;
27 | targetFrameRate = tf;
28 | }
29 | }
30 |
31 |
32 | /** Create a child class to implement InitializeAcademy(), AcademyStep()
33 | * and AcademyReset(). The child class script must be attached to an empty game
34 | * object in your scene, and there can only be one such object within the scene.
35 | */
36 | public abstract class Academy : MonoBehaviour
37 | {
38 |
39 | [System.Serializable]
40 | private struct ResetParameter
41 | {
42 | public string key;
43 | public float value;
44 | }
45 |
46 |
47 |
48 | [SerializeField]
49 | private int maxSteps;
50 | [SerializeField]
51 | private int frameToSkip;
52 | [SerializeField]
53 | private float waitTime;
54 | [HideInInspector]
55 | public bool isInference = true;
56 | /**< \brief Do not modify : If true, the Academy will use inference
57 | * settings. */
58 | private bool _isCurrentlyInference;
59 | [SerializeField]
60 | private ScreenConfiguration trainingConfiguration = new ScreenConfiguration(80, 80, 1, 100.0f, -1);
61 | [SerializeField]
62 | private ScreenConfiguration inferenceConfiguration = new ScreenConfiguration(1280, 720, 5, 1.0f, 60);
63 | [SerializeField]
64 | private ResetParameter[] defaultResetParameters;
65 | public Dictionary resetParameters;
66 | /**< \brief Contains a mapping from parameter names to float values. */
67 | /**< You can specify the Default Reset Parameters in the Inspector of the
68 | * Academy. You can modify these parameters when training with an External
69 | * brain by passing a config dictionary at reset. Reference resetParameters
70 | * in your AcademyReset() or AcademyStep() to modify elements in your
71 | * environment at reset time. */
72 |
73 |
74 | [HideInInspector]
75 | private List brains = new List();
76 |
77 |
78 |
79 | ExternalCommand externalCommand;
80 |
81 | private bool acceptingSteps;
82 | private int framesSinceAction;
83 | private bool skippingFrames = true;
84 | [HideInInspector]
85 | public bool done;
86 | /**< \brief The done flag of the Academy. */
87 | /**< When set to true, the Academy will call AcademyReset() instead of
88 | * AcademyStep() at step time.
89 | * If true, all agents done flags will be set to true.*/
90 | [HideInInspector]
91 | public int episodeCount;
92 | /**< \brief Increments each time the environment is reset. */
93 | [HideInInspector]
94 | public int currentStep;
95 | /**< \brief Increments each time a step is taken in the environment. Is
96 | * reset to 0 during AcademyReset(). */
97 |
98 | public Communicator communicator;
99 | /**< \brief Do not modify : pointer to the communicator currently in
100 | * use by the Academy. */
101 |
102 | private float timeAtStep;
103 |
104 |
105 | void Awake()
106 | {
107 | resetParameters = new Dictionary();
108 | foreach (ResetParameter kv in defaultResetParameters)
109 | {
110 | resetParameters[kv.key] = kv.value;
111 | }
112 |
113 | GetBrains(gameObject, brains);
114 | InitializeAcademy();
115 |
116 | communicator = new ExternalCommunicator(this);
117 | if (!communicator.CommunicatorHandShake())
118 | {
119 | communicator = null;
120 | }
121 |
122 | foreach (Brain brain in brains)
123 | {
124 | brain.InitializeBrain();
125 | }
126 | if (communicator != null)
127 | {
128 | communicator.InitializeCommunicator();
129 | externalCommand = communicator.GetCommand();
130 | }
131 |
132 | isInference = (communicator == null);
133 | _isCurrentlyInference = !isInference;
134 | done = true;
135 | acceptingSteps = true;
136 | }
137 |
138 | /// Environment specific initialization.
139 | /**
140 | * Implemented in environment-specific child class.
141 | * This method is called once when the environment is loaded.
142 | */
143 | public virtual void InitializeAcademy()
144 | {
145 |
146 | }
147 |
148 |
149 | private void ConfigureEngine()
150 | {
151 | if ((!isInference))
152 | {
153 | Screen.SetResolution(trainingConfiguration.width, trainingConfiguration.height, false);
154 | QualitySettings.SetQualityLevel(trainingConfiguration.qualityLevel, true);
155 | Time.timeScale = trainingConfiguration.timeScale;
156 | Application.targetFrameRate = trainingConfiguration.targetFrameRate;
157 | QualitySettings.vSyncCount = 0;
158 | Monitor.SetActive(false);
159 | }
160 | else
161 | {
162 | Screen.SetResolution(inferenceConfiguration.width, inferenceConfiguration.height, false);
163 | QualitySettings.SetQualityLevel(inferenceConfiguration.qualityLevel, true);
164 | Time.timeScale = inferenceConfiguration.timeScale;
165 | Application.targetFrameRate = inferenceConfiguration.targetFrameRate;
166 | }
167 | }
168 |
169 | /// Environment specific step logic.
170 | /**
171 | * Implemented in environment-specific child class.
172 | * This method is called at every step.
173 | */
174 | public virtual void AcademyStep()
175 | {
176 |
177 | }
178 |
179 | /// Environment specific reset logic.
180 | /**
181 | * Implemented in environment-specific child class.
182 | * This method is called everytime the Academy resets (when the global done
183 | * flag is set to true).
184 | */
185 | public virtual void AcademyReset()
186 | {
187 |
188 | }
189 |
190 |
191 | // Called after AcademyStep().
192 | internal void Step()
193 | {
194 | // Reset all agents whose flags are set to done.
195 | foreach (Brain brain in brains)
196 | {
197 | // Set all agents to done if academy is done.
198 | if (done)
199 | {
200 | brain.SendDone();
201 | }
202 | brain.ResetIfDone();
203 | }
204 |
205 | SendState();
206 |
207 | foreach (Brain brain in brains)
208 | {
209 | brain.ResetDoneAndReward();
210 | }
211 | }
212 |
213 | // Called before AcademyReset().
214 | internal void Reset()
215 | {
216 | currentStep = 0;
217 | episodeCount++;
218 | done = false;
219 | AcademyReset();
220 |
221 |
222 | foreach (Brain brain in brains)
223 | {
224 | brain.Reset();
225 | brain.ResetDoneAndReward();
226 | }
227 |
228 | }
229 |
230 | // Instructs all brains to collect states from their agents.
231 | private void SendState()
232 | {
233 | foreach (Brain brain in brains)
234 | {
235 | brain.SendState();
236 | }
237 | }
238 |
239 | // Instructs all brains to process states to produce actions.
240 | private void DecideAction()
241 | {
242 | if (communicator != null)
243 | {
244 | communicator.UpdateActions();
245 | }
246 |
247 | foreach (Brain brain in brains)
248 | {
249 | brain.DecideAction();
250 | }
251 |
252 | framesSinceAction = 0;
253 | }
254 |
255 | void FixedUpdate()
256 | {
257 | if (acceptingSteps)
258 | {
259 | RunMdp();
260 | }
261 | }
262 |
263 | // Contains logic for taking steps in environment simulation.
264 | /** Based on presence of communicator, inference mode, and frameSkip,
265 | * decides whether the environment should be stepped or reset.
266 | */
267 | void RunMdp()
268 | {
269 | if (isInference != _isCurrentlyInference)
270 | {
271 | ConfigureEngine();
272 | _isCurrentlyInference = isInference;
273 | }
274 |
275 | if ((isInference) && (timeAtStep + waitTime > Time.time))
276 | {
277 | return;
278 | }
279 |
280 | timeAtStep = Time.time;
281 | framesSinceAction += 1;
282 |
283 | currentStep += 1;
284 | if ((currentStep >= maxSteps) && maxSteps > 0)
285 | {
286 | done = true;
287 | }
288 |
289 | if ((framesSinceAction > frameToSkip) || done)
290 | {
291 | skippingFrames = false;
292 | framesSinceAction = 0;
293 | }
294 | else
295 | {
296 | skippingFrames = true;
297 | }
298 |
299 |
300 | if (skippingFrames == false)
301 | {
302 |
303 | if (communicator != null)
304 | {
305 | if (externalCommand == ExternalCommand.STEP)
306 | {
307 | Step();
308 | externalCommand = communicator.GetCommand();
309 | }
310 | if (externalCommand == ExternalCommand.RESET)
311 | {
312 | Dictionary NewResetParameters = communicator.GetResetParameters();
313 | foreach (KeyValuePair kv in NewResetParameters)
314 | {
315 | resetParameters[kv.Key] = kv.Value;
316 | }
317 | Reset();
318 | externalCommand = ExternalCommand.STEP;
319 | RunMdp();
320 | return;
321 | }
322 | if (externalCommand == ExternalCommand.QUIT)
323 | {
324 | Application.Quit();
325 | return;
326 | }
327 | }
328 | else
329 | {
330 | if (done)
331 | {
332 | Reset();
333 | RunMdp();
334 | return;
335 | }
336 | else
337 | {
338 | Step();
339 | }
340 | }
341 |
342 | DecideAction();
343 |
344 | AcademyStep();
345 |
346 | foreach (Brain brain in brains)
347 | {
348 | brain.Step();
349 | }
350 | }
351 | }
352 |
353 | private static void GetBrains(GameObject gameObject, List brains)
354 | {
355 | var transform = gameObject.transform;
356 |
357 | for (var i = 0; i < transform.childCount; i++)
358 | {
359 | var child = transform.GetChild(i);
360 | var brain = child.GetComponent();
361 |
362 | if (brain != null)
363 | brains.Add(brain);
364 | }
365 | }
366 | }
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/Academy.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b1fc0029fee784d9cb9854f8912bfd07
3 | timeCreated: 1503613254
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/Agent.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 |
6 | /** Generic functions for parent Agent class.
7 | * Contains all logic for Brain-Agent communication and Agent-Environment
8 | * interaction.
9 | */
10 | public abstract class Agent : MonoBehaviour
11 | {
12 | public Brain brain;
13 | /**< \brief The brain that will control this agent. */
14 | /**< Use the inspector to drag the desired brain gameObject into
15 | * the Brain field */
16 |
17 | public List observations;
18 | /**< \brief The list of the cameras the Agent uses as observations. */
19 | /**< These cameras will be used to generate the observations */
20 |
21 | public int maxStep;
22 | /**< \brief The number of steps the agent takes before being done. */
23 | /**< If set to 0, the agent can only be set to done via a script.
24 | * If set to any positive integer, the agent will be set to done after that
25 | * many steps each episode. */
26 |
27 | public bool resetOnDone = true;
28 | /**< \brief Determines the behaviour of the Agent when done.*/
29 | /**< If true, the agent will reset when done.
30 | * If not, the agent will remain done, and no longer take actions.*/
31 |
32 | [HideInInspector]
33 | public float reward;
34 | /**< \brief Describes the reward for the given step of the agent.*/
35 | /**< It is reset to 0 at the beginning of every step.
36 | * Modify in AgentStep().
37 | * Should be set to positive to reinforcement desired behavior, and
38 | * set to a negative value to punish undesireable behavior.
39 | * Additionally, the magnitude of the reward should not exceed 1.0 */
40 |
41 | [HideInInspector]
42 | public bool done;
43 | /**< \brief Whether or not the agent is done*/
44 | /**< Set to true when the agent has acted in some way which ends the
45 | * episode for the given agent. */
46 |
47 | [HideInInspector]
48 | public float value;
49 | /**< \brief The current value estimate of the agent */
50 | /**< When using an External brain, you can pass value estimates to the
51 | * agent at every step using env.Step(actions, values).
52 | * If AgentMonitor is attached to the Agent, this value will be displayed.*/
53 |
54 | [HideInInspector]
55 | public float CumulativeReward;
56 | /**< \brief Do not modify: This keeps track of the cumulative reward.*/
57 |
58 | [HideInInspector]
59 | public int stepCounter;
60 | /**< \brief Do not modify: This keeps track of the number of steps taken by
61 | * the agent each episode.*/
62 |
63 | [HideInInspector]
64 | public float[] agentStoredAction;
65 | /**< \brief Do not modify: This keeps track of the last actions decided by
66 | * the brain.*/
67 |
68 | [HideInInspector]
69 | public float[] memory;
70 | /**< \brief Do not modify directly: This is used by the brain to store
71 | * information about the previous states of the agent*/
72 |
73 | [HideInInspector]
74 | public int id;
75 | /**< \brief Do not modify : This is the unique Identifier each agent
76 | * receives at initialization. It is used by the brain to identify
77 | * the agent.*/
78 |
79 | void OnEnable()
80 | {
81 | id = gameObject.GetInstanceID();
82 | if (brain != null)
83 | {
84 | brain.agents.Add(id, gameObject.GetComponent());
85 | if (brain.brainParameters.actionSpaceType == StateType.continuous)
86 | {
87 | agentStoredAction = new float[brain.brainParameters.actionSize];
88 | }
89 | else
90 | {
91 | agentStoredAction = new float[1];
92 | }
93 | memory = new float[brain.brainParameters.memorySize];
94 | }
95 | InitializeAgent();
96 | }
97 |
98 | void OnDisable()
99 | {
100 | //Remove the agent from the list of agents of the brain
101 | brain.agents.Remove(id);
102 | }
103 |
104 | /// When GiveBrain is called, the agent unsubscribes from its
105 | /// previous brain and subscribes to the one passed in argument.
106 | /** Use this method to provide a brain to the agent via script.
107 | * Do not modify brain directly.
108 | @param b The Brain component the agent will subscribe to.*/
109 | public void GiveBrain(Brain b)
110 | {
111 | RemoveBrain();
112 | brain = b;
113 | brain.agents.Add(id, gameObject.GetComponent());
114 | if (brain.brainParameters.actionSpaceType == StateType.continuous)
115 | {
116 | agentStoredAction = new float[brain.brainParameters.actionSize];
117 | }
118 | else
119 | {
120 | agentStoredAction = new float[1];
121 | }
122 | memory = new float[brain.brainParameters.memorySize];
123 | }
124 |
125 | /// When RemoveBrain is called, the agent unsubscribes from its brain.
126 | /** Use this method to give a brain to an agent via script.
127 | * Do not modify brain directly.
128 | * If an agent does not have a brain, it will not update its actions.*/
129 | public void RemoveBrain()
130 | {
131 | if (brain != null)
132 | {
133 | brain.agents.Remove(id);
134 | }
135 | }
136 |
137 | /// Initialize the agent with this method
138 | /** Must be implemented in agent-specific child class.
139 | * This method called only once when the agent is enabled.
140 | */
141 | public virtual void InitializeAgent()
142 | {
143 |
144 | }
145 |
146 | /// Collect the states of the agent with this method
147 | /** Must be implemented in agent-specific child class.
148 | * This method called at every step and collects the state of the agent.
149 | * The lenght of the output must be the same length as the state size field
150 | * in the brain parameters of the brain the agent subscribes to.
151 | * Note : The order of the elements in the state list is important.
152 | * @returns state A list of floats corresponding to the state of the agent.
153 | */
154 | public virtual List CollectState()
155 | {
156 | List state = new List();
157 | return state;
158 | }
159 |
160 | /// Defines agent-specific behavior at every step depending on the action.
161 | /** Must be implemented in agent-specific child class.
162 | * Note: If your state is discrete, you need to convert your
163 | * state into a list of float with length 1.
164 | * @param action The action the agent receives from the brain.
165 | */
166 | public virtual void AgentStep(float[] action)
167 | {
168 |
169 | }
170 |
171 |
172 | /// Defines agent-specific behaviour when done
173 | /** Must be implemented in agent-specific child class.
174 | * Is called when the Agent is done if ResetOneDone is false.
175 | * The agent will remain done.
176 | * You can use this method to remove the agent from the scene.
177 | */
178 | public virtual void AgentOnDone()
179 | {
180 |
181 | }
182 |
183 | /// Defines agent-specific reset logic
184 | /** Must be implemented in agent-specific child class.
185 | * Is called when the academy is done.
186 | * Is called when the Agent is done if ResetOneDone is true.
187 | */
188 | public virtual void AgentReset()
189 | {
190 |
191 | }
192 |
193 | /// Do not modify : Is used by the brain to reset the agent.
194 | public void Reset()
195 | {
196 | memory = new float[brain.brainParameters.memorySize];
197 | CumulativeReward = 0f;
198 | stepCounter = 0;
199 | AgentReset();
200 | }
201 |
202 | /// Do not modify : Is used by the brain to collect rewards.
203 | public float CollectReward()
204 | {
205 | return reward;
206 | }
207 |
208 | public void SetCumulativeReward()
209 | {
210 | CumulativeReward += reward;
211 | //Debug.Log(reward);
212 | }
213 |
214 | /// Do not modify : Is used by the brain to collect done.
215 | public bool CollectDone()
216 | {
217 | return done;
218 | }
219 |
220 | /// Do not modify : Is used by the brain give new action to the agent.
221 | public void UpdateAction(float[] a)
222 | {
223 | agentStoredAction = a;
224 | }
225 |
226 | /// Do not modify : Is used by the brain to make the agent perform a step.
227 | public void Step()
228 | {
229 | AgentStep(agentStoredAction);
230 | stepCounter += 1;
231 | if ((stepCounter > maxStep) && (maxStep > 0))
232 | {
233 | done = true;
234 | }
235 | }
236 |
237 | /// Do not modify : Is used by the brain to reset the Reward.
238 | public void ResetReward()
239 | {
240 | reward = 0;
241 | }
242 |
243 | }
244 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/Agent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 88b6042bc9a5d4aa58d931eae49442e5
3 | timeCreated: 1501802662
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/Brain.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c676a8ddf5a5f4f64b35e9ed5028679d
3 | timeCreated: 1503211687
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/Communicator.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | /** \brief AcademyParameters is a structure containing basic information about the
6 | * training environment. */
7 | /** The AcademyParameters will be sent via socket at the start of the Environment.
8 | * This structure does not need to be modified.
9 | */
10 | public struct AcademyParameters
11 | {
12 | public string AcademyName;
13 | /**< \brief The name of the Academy. If the communicator is External,
14 | * it will be the name of the Academy GameObject */
15 | public string apiNumber;
16 | /**< \brief The API number for the communicator. */
17 | public string logPath;
18 | /**< \brief The location of the logfile*/
19 | public Dictionary resetParameters;
20 | /**< \brief The default reset parameters are sent via socket*/
21 | public List brainNames;
22 | /**< \brief A list of the all the brains names sent via socket*/
23 | public List brainParameters;
24 | /**< \brief A list of the External brains parameters sent via socket*/
25 | public List externalBrainNames;
26 | /**< \brief A list of the External brains names sent via socket*/
27 | }
28 |
29 | public enum ExternalCommand
30 | {
31 | STEP,
32 | RESET,
33 | QUIT
34 | }
35 |
36 | /**
37 | * This is the interface used to generate coordinators.
38 | * This does not need to be modified nor implemented to create a
39 | * Unity environment.
40 | */
41 | public interface Communicator
42 | {
43 |
44 | /// Implement this method to allow brains to subscribe to the
45 | /// decisions made outside of Unity
46 | void SubscribeBrain(Brain brain);
47 |
48 | /// First contact between Communicator and external process
49 | bool CommunicatorHandShake();
50 |
51 | /// Implement this method to initialize the communicator
52 | void InitializeCommunicator();
53 |
54 | /// Implement this method to receive actions from outside of Unity and
55 | /// update the actions of the brains that subscribe
56 | void UpdateActions();
57 |
58 | /// Implement this method to return the ExternalCommand that
59 | /// was given outside of Unity
60 | ExternalCommand GetCommand();
61 |
62 | /// Implement this method to return the new dictionary of resetParameters
63 | /// that was given outside of Unity
64 | Dictionary GetResetParameters();
65 |
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/Communicator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 18600657fd7d241a199e6caf2ba7cceb
3 | timeCreated: 1504820023
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/CoreBrain.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | /** \brief An interface which defines the functions needed for a CoreBrain. */
6 | /** There is no need to modify or implement CoreBrain to create a Unity environment.
7 | */
8 | public interface CoreBrain
9 | {
10 |
11 | /// Implement setBrain so let the coreBrain know what brain is using it
12 | void SetBrain(Brain b);
13 | /// Implement this method to initialize CoreBrain
14 | void InitializeCoreBrain();
15 | /// Implement this method to define the logic for deciding actions
16 | void DecideAction();
17 | /// Implement this method to define the logic for sending the actions
18 | void SendState();
19 | /// Implement this method to define what should be displayed in the brain Inspector
20 | void OnInspector();
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/CoreBrain.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: dcbf9c1714a8d4b819ce2caa23b2eaf4
3 | timeCreated: 1504070234
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/CoreBrainExternal.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | /// CoreBrain which decides actions via communication with an external system such as Python.
6 | public class CoreBrainExternal : ScriptableObject, CoreBrain
7 | {
8 |
9 | public Brain brain;
10 | /**< Reference to the brain that uses this CoreBrainExternal */
11 |
12 | ExternalCommunicator coord;
13 |
14 | /// Creates the reference to the brain
15 | public void SetBrain(Brain b)
16 | {
17 | brain = b;
18 | }
19 |
20 | /// Generates the communicator for the Academy if none was present and
21 | /// subscribe to ExternalCommunicator if it was present.
22 | public void InitializeCoreBrain()
23 | {
24 | if (brain.gameObject.transform.parent.gameObject.GetComponent().communicator == null)
25 | {
26 | coord = null;
27 | throw new UnityAgentsException(string.Format("The brain {0} was set to" +
28 | " External mode" +
29 | " but Unity was unable to read the" +
30 | " arguments passed at launch.", brain.gameObject.name));
31 | }
32 | else if (brain.gameObject.transform.parent.gameObject.GetComponent().communicator is ExternalCommunicator)
33 | {
34 | coord = (ExternalCommunicator)brain.gameObject.transform.parent.gameObject.GetComponent().communicator;
35 | coord.SubscribeBrain(brain);
36 | }
37 |
38 | }
39 |
40 | /// Uses the communicator to retrieve the actions, memories and values and
41 | /// sends them to the agents
42 | public void DecideAction()
43 | {
44 | if (coord != null)
45 | {
46 | brain.SendActions(coord.GetDecidedAction(brain.gameObject.name));
47 | brain.SendMemories(coord.GetMemories(brain.gameObject.name));
48 | brain.SendValues(coord.GetValues(brain.gameObject.name));
49 | }
50 | }
51 |
52 | /// Uses the communicator to send the states, observations, rewards and
53 | /// dones outside of Unity
54 | public void SendState()
55 | {
56 | if (coord != null)
57 | {
58 | coord.giveBrainInfo(brain);
59 | }
60 | }
61 |
62 | /// Nothing needs to appear in the inspector
63 | public void OnInspector()
64 | {
65 |
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/CoreBrainExternal.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 35813a1be64e144f887d7d5f15b963fa
3 | timeCreated: 1504070319
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/CoreBrainHeuristic.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | #if UNITY_EDITOR
6 | using UnityEditor;
7 | #endif
8 |
9 | /// CoreBrain which decides actions using developer-provided Decision.cs script.
10 | public class CoreBrainHeuristic : ScriptableObject, CoreBrain
11 | {
12 | [SerializeField]
13 | private bool broadcast = true;
14 |
15 | public Brain brain;
16 | /**< Reference to the brain that uses this CoreBrainHeuristic */
17 |
18 | ExternalCommunicator coord;
19 |
20 | public Decision decision;
21 | /**< Reference to the Decision component used to decide the actions */
22 |
23 | /// Create the reference to the brain
24 | public void SetBrain(Brain b)
25 | {
26 | brain = b;
27 | }
28 |
29 | /// Create the reference to decision
30 | public void InitializeCoreBrain()
31 | {
32 | decision = brain.gameObject.GetComponent();
33 |
34 | if ((brain.gameObject.transform.parent.gameObject.GetComponent().communicator == null)
35 | || (!broadcast))
36 | {
37 | coord = null;
38 | }
39 | else if (brain.gameObject.transform.parent.gameObject.GetComponent().communicator is ExternalCommunicator)
40 | {
41 | coord = (ExternalCommunicator)brain.gameObject.transform.parent.gameObject.GetComponent().communicator;
42 | coord.SubscribeBrain(brain);
43 | }
44 | }
45 |
46 | /// Uses the Decision Component to decide that action to take
47 | public void DecideAction()
48 | {
49 | if (decision == null)
50 | {
51 | throw new UnityAgentsException("The Brain is set to Heuristic, but no decision script attached to it");
52 | }
53 |
54 | Dictionary actions = new Dictionary();
55 | Dictionary new_memories = new Dictionary();
56 | Dictionary> states = brain.CollectStates();
57 | Dictionary> observations = brain.CollectObservations();
58 | Dictionary rewards = brain.CollectRewards();
59 | Dictionary dones = brain.CollectDones();
60 | Dictionary old_memories = brain.CollectMemories();
61 |
62 | foreach (KeyValuePair idAgent in brain.agents)
63 | {
64 | actions.Add(idAgent.Key, decision.Decide(
65 | states[idAgent.Key],
66 | observations[idAgent.Key],
67 | rewards[idAgent.Key],
68 | dones[idAgent.Key],
69 | old_memories[idAgent.Key]));
70 | }
71 | foreach (KeyValuePair idAgent in brain.agents)
72 | {
73 | new_memories.Add(idAgent.Key, decision.MakeMemory(
74 | states[idAgent.Key],
75 | observations[idAgent.Key],
76 | rewards[idAgent.Key],
77 | dones[idAgent.Key],
78 | old_memories[idAgent.Key]));
79 | }
80 | brain.SendActions(actions);
81 | brain.SendMemories(new_memories);
82 | }
83 |
84 | /// Nothing needs to be implemented, the states are collected in DecideAction
85 | public void SendState()
86 | {
87 | if (coord!=null)
88 | {
89 | coord.giveBrainInfo(brain);
90 | }
91 | }
92 |
93 | /// Displays an error if no decision component is attached to the brain
94 | public void OnInspector()
95 | {
96 | #if UNITY_EDITOR
97 | EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
98 | broadcast = EditorGUILayout.Toggle("Broadcast", broadcast);
99 | if (brain.gameObject.GetComponent() == null)
100 | {
101 | EditorGUILayout.HelpBox("You need to add a 'Decision' component to this gameObject", MessageType.Error);
102 | }
103 | #endif
104 | }
105 |
106 | }
107 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/CoreBrainHeuristic.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 943466ab374444748a364f9d6c3e2fe2
3 | timeCreated: 1504070366
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/CoreBrainInternal.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8b23992c8eb17439887f5e944bf04a40
3 | timeCreated: 1504070347
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/CoreBrainPlayer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | #if UNITY_EDITOR
6 | using UnityEditor;
7 | #endif
8 |
9 |
10 | /// CoreBrain which decides actions using Player input.
11 | public class CoreBrainPlayer : ScriptableObject, CoreBrain
12 | {
13 | [SerializeField]
14 | private bool broadcast = true;
15 |
16 | [System.Serializable]
17 | private struct DiscretePlayerAction
18 | {
19 | public KeyCode key;
20 | public int value;
21 | }
22 |
23 | [System.Serializable]
24 | private struct ContinuousPlayerAction
25 | {
26 | public KeyCode key;
27 | public int index;
28 | public float value;
29 | }
30 |
31 | ExternalCommunicator coord;
32 |
33 | [SerializeField]
34 | /// Contains the mapping from input to continuous actions
35 | private ContinuousPlayerAction[] continuousPlayerActions;
36 | [SerializeField]
37 | /// Contains the mapping from input to discrete actions
38 | private DiscretePlayerAction[] discretePlayerActions;
39 | [SerializeField]
40 | private int defaultAction = 0;
41 |
42 | /// Reference to the brain that uses this CoreBrainPlayer
43 | public Brain brain;
44 |
45 | /// Create the reference to the brain
46 | public void SetBrain(Brain b)
47 | {
48 | brain = b;
49 | }
50 |
51 | /// Nothing to implement
52 | public void InitializeCoreBrain()
53 | {
54 | if ((brain.gameObject.transform.parent.gameObject.GetComponent().communicator == null)
55 | || (!broadcast))
56 | {
57 | coord = null;
58 | }
59 | else if (brain.gameObject.transform.parent.gameObject.GetComponent().communicator is ExternalCommunicator)
60 | {
61 | coord = (ExternalCommunicator)brain.gameObject.transform.parent.gameObject.GetComponent().communicator;
62 | coord.SubscribeBrain(brain);
63 | }
64 | }
65 |
66 | /// Uses the continuous inputs or dicrete inputs of the player to
67 | /// decide action
68 | public void DecideAction()
69 | {
70 | if (brain.brainParameters.actionSpaceType == StateType.continuous)
71 | {
72 | float[] action = new float[brain.brainParameters.actionSize];
73 | foreach (ContinuousPlayerAction cha in continuousPlayerActions)
74 | {
75 | if (Input.GetKey(cha.key))
76 | {
77 | action[cha.index] = cha.value;
78 | }
79 | }
80 | Dictionary actions = new Dictionary();
81 | foreach (KeyValuePair idAgent in brain.agents)
82 | {
83 | actions.Add(idAgent.Key, action);
84 | }
85 | brain.SendActions(actions);
86 | }
87 | else
88 | {
89 | float[] action = new float[1] { defaultAction };
90 | foreach (DiscretePlayerAction dha in discretePlayerActions)
91 | {
92 | if (Input.GetKey(dha.key))
93 | {
94 | action[0] = (float)dha.value;
95 | break;
96 | }
97 | }
98 | Dictionary actions = new Dictionary();
99 | foreach (KeyValuePair idAgent in brain.agents)
100 | {
101 | actions.Add(idAgent.Key, action);
102 | }
103 | brain.SendActions(actions);
104 | }
105 | }
106 |
107 | /// Nothing to implement, the Player does not use the state to make
108 | /// decisions
109 | public void SendState()
110 | {
111 | if (coord != null)
112 | {
113 | coord.giveBrainInfo(brain);
114 | }
115 | else
116 | {
117 | //The states are collected in order to debug the CollectStates method.
118 | brain.CollectStates();
119 | }
120 | }
121 |
122 | /// Displays continuous or discrete input mapping in the inspector
123 | public void OnInspector()
124 | {
125 | #if UNITY_EDITOR
126 | EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
127 | broadcast = EditorGUILayout.Toggle("Broadcast", broadcast);
128 | SerializedObject serializedBrain = new SerializedObject(this);
129 | if (brain.brainParameters.actionSpaceType == StateType.continuous)
130 | {
131 | GUILayout.Label("Edit the continuous inputs for you actions", EditorStyles.boldLabel);
132 | SerializedProperty chas = serializedBrain.FindProperty("continuousPlayerActions");
133 | serializedBrain.Update();
134 | EditorGUILayout.PropertyField(chas, true);
135 | serializedBrain.ApplyModifiedProperties();
136 | if (continuousPlayerActions == null)
137 | {
138 | continuousPlayerActions = new ContinuousPlayerAction[0];
139 | }
140 | foreach (ContinuousPlayerAction cha in continuousPlayerActions)
141 | {
142 | if (cha.index >= brain.brainParameters.actionSize)
143 | {
144 | EditorGUILayout.HelpBox(string.Format("Key {0} is assigned to index {1} but the action size is only of size {2}"
145 | , cha.key.ToString(), cha.index.ToString(), brain.brainParameters.actionSize.ToString()), MessageType.Error);
146 | }
147 | }
148 |
149 | }
150 | else
151 | {
152 | GUILayout.Label("Edit the discrete inputs for you actions", EditorStyles.boldLabel);
153 | defaultAction = EditorGUILayout.IntField("Default Action", defaultAction);
154 | SerializedProperty dhas = serializedBrain.FindProperty("discretePlayerActions");
155 | serializedBrain.Update();
156 | EditorGUILayout.PropertyField(dhas, true);
157 | serializedBrain.ApplyModifiedProperties();
158 | }
159 | #endif
160 | }
161 | }
162 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/CoreBrainPlayer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 41e9bda8f3cf1492fa74926a530f6f70
3 | timeCreated: 1504070375
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/Decision.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | /// Generic functions for Decision Interface
6 | public interface Decision
7 | {
8 | /// \brief Implement this method to define the logic of decision making
9 | /// for the CoreBrainHeuristic
10 | /** Given the information about the agent, return a vector of actions.
11 | * @param state The state of the agent
12 | * @param observation The cameras the agent uses
13 | * @param reward The reward the agent had at the previous step
14 | * @param done Weather or not the agent is done
15 | * @param memory The memories stored from the previous step with MakeMemory()
16 | * @return The vector of actions the agent will take at the next step
17 | */
18 | float[] Decide(List state, List observation, float reward, bool done, float[] memory);
19 |
20 | /// \brief Implement this method to define the logic of memory making for
21 | /// the CoreBrainHeuristic
22 | /** Given the information about the agent, return the new memory vector for the agent.
23 | * @param state The state of the agent
24 | * @param observation The cameras the agent uses
25 | * @param reward The reward the agent had at the previous step
26 | * @param done Weather or not the agent is done
27 | * @param memory The memories stored from the previous step with MakeMemory()
28 | * @return The vector of memories the agent will use at the next step
29 | */
30 | float[] MakeMemory(List state, List observation, float reward, bool done, float[] memory);
31 | }
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/Decision.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 13e74744309fd4571b76e46fafc6d37f
3 | timeCreated: 1503182472
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/ExternalCommunicator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9685de855ca1541409f4187c5ab7601d
3 | timeCreated: 1504820023
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/Monitor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e59a31a1cc2f5464d9a61bef0bc9a53b
3 | timeCreated: 1508031727
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/UnityAgentsException.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | using System;
6 | [System.Serializable]
7 | /// Contains exceptions specific to ML-Agents.
8 | public class UnityAgentsException : System.Exception
9 | {
10 | /// When a UnityAgentsException is called, the timeScale is set to 0.
11 | /// The simulation will end since no steps will be taken.
12 | public UnityAgentsException(string message) : base(message)
13 | {
14 | Time.timeScale = 0f;
15 | }
16 |
17 | /// A constructor is needed for serialization when an exception propagates
18 | /// from a remoting server to the client.
19 | protected UnityAgentsException(System.Runtime.Serialization.SerializationInfo info,
20 | System.Runtime.Serialization.StreamingContext context)
21 | { }
22 | }
23 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Scripts/UnityAgentsException.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e63e4a66d820245778f9a2abfa5b68e0
3 | timeCreated: 1504131359
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Template.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 11b74a3b21c094e088c0e9fb4d4167ee
3 | folderAsset: yes
4 | timeCreated: 1504127695
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Template/Scene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e81622878c805493fb0e3d0e0141e7c6
3 | timeCreated: 1504127824
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Template/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7180b2e9f97774db6a291c04dceba7ca
3 | folderAsset: yes
4 | timeCreated: 1503355437
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Template/Scripts/TemplateAcademy.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public class TemplateAcademy : Academy {
6 |
7 | public override void AcademyReset()
8 | {
9 |
10 |
11 | }
12 |
13 | public override void AcademyStep()
14 | {
15 |
16 |
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Template/Scripts/TemplateAcademy.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9af83cd96d4bc4088a966af174446d1b
3 | timeCreated: 1503355437
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Template/Scripts/TemplateAgent.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public class TemplateAgent : Agent {
6 |
7 |
8 |
9 | public override List CollectState()
10 | {
11 | List state = new List();
12 |
13 | return state;
14 | }
15 |
16 | public override void AgentStep(float[] act)
17 | {
18 |
19 | }
20 |
21 | public override void AgentReset()
22 | {
23 |
24 | }
25 |
26 | public override void AgentOnDone()
27 | {
28 |
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Template/Scripts/TemplateAgent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 33bb739f1138d40798114d667776a1d6
3 | timeCreated: 1503355437
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Template/Scripts/TemplateDecision.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public class TemplateDecision : MonoBehaviour, Decision
6 | {
7 |
8 | public float[] Decide(List state, List observation, float reward, bool done, float[] memory)
9 | {
10 | return new float[0];
11 |
12 | }
13 |
14 | public float[] MakeMemory(List state, List observation, float reward, bool done, float[] memory)
15 | {
16 | return new float[0];
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/jumpjump/Assets/ML-Agents/Template/Scripts/TemplateDecision.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3812a852e739e44d7ab2ad777eeb0212
3 | timeCreated: 1503355437
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Materials.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 426c0901c74700643875cbeda6f77db6
3 | folderAsset: yes
4 | timeCreated: 1516079825
5 | licenseType: Pro
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Materials/GroundMaterial.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_PrefabParentObject: {fileID: 0}
8 | m_PrefabInternal: {fileID: 0}
9 | m_Name: GroundMaterial
10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
11 | m_ShaderKeywords:
12 | m_LightmapFlags: 4
13 | m_EnableInstancingVariants: 0
14 | m_DoubleSidedGI: 0
15 | m_CustomRenderQueue: -1
16 | stringTagMap: {}
17 | disabledShaderPasses: []
18 | m_SavedProperties:
19 | serializedVersion: 3
20 | m_TexEnvs:
21 | - _BumpMap:
22 | m_Texture: {fileID: 0}
23 | m_Scale: {x: 1, y: 1}
24 | m_Offset: {x: 0, y: 0}
25 | - _DetailAlbedoMap:
26 | m_Texture: {fileID: 0}
27 | m_Scale: {x: 1, y: 1}
28 | m_Offset: {x: 0, y: 0}
29 | - _DetailMask:
30 | m_Texture: {fileID: 0}
31 | m_Scale: {x: 1, y: 1}
32 | m_Offset: {x: 0, y: 0}
33 | - _DetailNormalMap:
34 | m_Texture: {fileID: 0}
35 | m_Scale: {x: 1, y: 1}
36 | m_Offset: {x: 0, y: 0}
37 | - _EmissionMap:
38 | m_Texture: {fileID: 0}
39 | m_Scale: {x: 1, y: 1}
40 | m_Offset: {x: 0, y: 0}
41 | - _MainTex:
42 | m_Texture: {fileID: 0}
43 | m_Scale: {x: 1, y: 1}
44 | m_Offset: {x: 0, y: 0}
45 | - _MetallicGlossMap:
46 | m_Texture: {fileID: 0}
47 | m_Scale: {x: 1, y: 1}
48 | m_Offset: {x: 0, y: 0}
49 | - _OcclusionMap:
50 | m_Texture: {fileID: 0}
51 | m_Scale: {x: 1, y: 1}
52 | m_Offset: {x: 0, y: 0}
53 | - _ParallaxMap:
54 | m_Texture: {fileID: 0}
55 | m_Scale: {x: 1, y: 1}
56 | m_Offset: {x: 0, y: 0}
57 | m_Floats:
58 | - _BumpScale: 1
59 | - _Cutoff: 0.5
60 | - _DetailNormalMapScale: 1
61 | - _DstBlend: 0
62 | - _GlossMapScale: 1
63 | - _Glossiness: 0.5
64 | - _GlossyReflections: 1
65 | - _Metallic: 0
66 | - _Mode: 0
67 | - _OcclusionStrength: 1
68 | - _Parallax: 0.02
69 | - _SmoothnessTextureChannel: 0
70 | - _SpecularHighlights: 1
71 | - _SrcBlend: 1
72 | - _UVSec: 0
73 | - _ZWrite: 1
74 | m_Colors:
75 | - _Color: {r: 0.83823526, g: 0.83823526, b: 0.83823526, a: 1}
76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
77 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Materials/GroundMaterial.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: dfaf44f001e90de4baed319da62c2d4d
3 | timeCreated: 1516079834
4 | licenseType: Pro
5 | NativeFormatImporter:
6 | externalObjects: {}
7 | mainObjectFileID: 2100000
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Materials/Player.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_PrefabParentObject: {fileID: 0}
8 | m_PrefabInternal: {fileID: 0}
9 | m_Name: Player
10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
11 | m_ShaderKeywords:
12 | m_LightmapFlags: 4
13 | m_EnableInstancingVariants: 0
14 | m_DoubleSidedGI: 0
15 | m_CustomRenderQueue: -1
16 | stringTagMap: {}
17 | disabledShaderPasses: []
18 | m_SavedProperties:
19 | serializedVersion: 3
20 | m_TexEnvs:
21 | - _BumpMap:
22 | m_Texture: {fileID: 0}
23 | m_Scale: {x: 1, y: 1}
24 | m_Offset: {x: 0, y: 0}
25 | - _DetailAlbedoMap:
26 | m_Texture: {fileID: 0}
27 | m_Scale: {x: 1, y: 1}
28 | m_Offset: {x: 0, y: 0}
29 | - _DetailMask:
30 | m_Texture: {fileID: 0}
31 | m_Scale: {x: 1, y: 1}
32 | m_Offset: {x: 0, y: 0}
33 | - _DetailNormalMap:
34 | m_Texture: {fileID: 0}
35 | m_Scale: {x: 1, y: 1}
36 | m_Offset: {x: 0, y: 0}
37 | - _EmissionMap:
38 | m_Texture: {fileID: 0}
39 | m_Scale: {x: 1, y: 1}
40 | m_Offset: {x: 0, y: 0}
41 | - _MainTex:
42 | m_Texture: {fileID: 0}
43 | m_Scale: {x: 1, y: 1}
44 | m_Offset: {x: 0, y: 0}
45 | - _MetallicGlossMap:
46 | m_Texture: {fileID: 0}
47 | m_Scale: {x: 1, y: 1}
48 | m_Offset: {x: 0, y: 0}
49 | - _OcclusionMap:
50 | m_Texture: {fileID: 0}
51 | m_Scale: {x: 1, y: 1}
52 | m_Offset: {x: 0, y: 0}
53 | - _ParallaxMap:
54 | m_Texture: {fileID: 0}
55 | m_Scale: {x: 1, y: 1}
56 | m_Offset: {x: 0, y: 0}
57 | m_Floats:
58 | - _BumpScale: 1
59 | - _Cutoff: 0.5
60 | - _DetailNormalMapScale: 1
61 | - _DstBlend: 0
62 | - _GlossMapScale: 1
63 | - _Glossiness: 0.5
64 | - _GlossyReflections: 1
65 | - _Metallic: 0
66 | - _Mode: 0
67 | - _OcclusionStrength: 1
68 | - _Parallax: 0.02
69 | - _SmoothnessTextureChannel: 0
70 | - _SpecularHighlights: 1
71 | - _SrcBlend: 1
72 | - _UVSec: 0
73 | - _ZWrite: 1
74 | m_Colors:
75 | - _Color: {r: 0.30882353, g: 0.03179065, b: 0.30882353, a: 1}
76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
77 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Materials/Player.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9ec87f14d35aae64dbd15502ae3b8647
3 | timeCreated: 1515573212
4 | licenseType: Pro
5 | NativeFormatImporter:
6 | externalObjects: {}
7 | mainObjectFileID: 2100000
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Prefabs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 274a82a5d08732047ad1a64c6f129289
3 | folderAsset: yes
4 | timeCreated: 1516113080
5 | licenseType: Pro
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Prefabs/Game.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c76f19d57ef889f499743ad6b30a8cd8
3 | timeCreated: 1516936028
4 | licenseType: Pro
5 | NativeFormatImporter:
6 | externalObjects: {}
7 | mainObjectFileID: 100100000
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Resources.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2132c65a71d13ea41ac8a636ba5a9db8
3 | folderAsset: yes
4 | timeCreated: 1516084790
5 | licenseType: Pro
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Resources/DOTweenSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &11400000
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 0
6 | m_PrefabParentObject: {fileID: 0}
7 | m_PrefabInternal: {fileID: 0}
8 | m_GameObject: {fileID: 0}
9 | m_Enabled: 1
10 | m_EditorHideFlags: 0
11 | m_Script: {fileID: 16995157, guid: 6e38ac6b1c3556b4c888ca8552375e1e, type: 3}
12 | m_Name: DOTweenSettings
13 | m_EditorClassIdentifier:
14 | useSafeMode: 1
15 | timeScale: 1
16 | useSmoothDeltaTime: 0
17 | maxSmoothUnscaledTime: 0.15
18 | showUnityEditorReport: 0
19 | logBehaviour: 2
20 | drawGizmos: 1
21 | defaultRecyclable: 0
22 | defaultAutoPlay: 3
23 | defaultUpdateType: 0
24 | defaultTimeScaleIndependent: 0
25 | defaultEaseType: 6
26 | defaultEaseOvershootOrAmplitude: 1.70158
27 | defaultEasePeriod: 0
28 | defaultAutoKill: 1
29 | defaultLoopType: 0
30 | storeSettingsLocation: 0
31 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Resources/DOTweenSettings.asset.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8f1b72e22bb91ce4ab66738345c35c2b
3 | timeCreated: 1516084790
4 | licenseType: Pro
5 | NativeFormatImporter:
6 | externalObjects: {}
7 | mainObjectFileID: 11400000
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Scenes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7f11f9e4fbf1e214b8c838b2ebbde267
3 | folderAsset: yes
4 | timeCreated: 1515563991
5 | licenseType: Pro
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 92b8d44b17f687644abbffefcff0eeb4
3 | folderAsset: yes
4 | timeCreated: 1516077938
5 | licenseType: Pro
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Scripts/BottleFlipAcademy.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public class BottleFlipAcademy : Academy
6 | {
7 | public float MaxDistance;
8 | public float MinScale;
9 | public bool IsRandomDirection;
10 |
11 | public override void AcademyReset()
12 | {
13 | MaxDistance = resetParameters["max_distance"];
14 | MinScale = resetParameters["min_scale"];
15 | IsRandomDirection = resetParameters["random_direction"] > 0;
16 | }
17 |
18 | public override void AcademyStep()
19 | {
20 | }
21 | }
--------------------------------------------------------------------------------
/jumpjump/Assets/Scripts/BottleFlipAcademy.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: edeadfa5a807e794dbdeaf628cffb416
3 | timeCreated: 1503355437
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Scripts/BottleFlipAgent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 68fd2c8e40b9794408246a292ba640c2
3 | timeCreated: 1503355437
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Scripts/BottleFlipDecision.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public class BottleFlipDecision : MonoBehaviour, Decision
6 | {
7 | public bool FixedAction = false;
8 | public float Action;
9 |
10 | public float[] Decide(List state, List observation, float reward, bool done, float[] memory)
11 | {
12 | float[] action = new float[1];
13 | action[0] = FixedAction ? Action : Random.Range(0, 2f);
14 | return action;
15 | }
16 |
17 | public float[] MakeMemory(List state, List observation, float reward, bool done, float[] memory)
18 | {
19 | return default(float[]);
20 | }
21 | }
--------------------------------------------------------------------------------
/jumpjump/Assets/Scripts/BottleFlipDecision.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 95704aa2700d9c24b833ffe76a4fb733
3 | timeCreated: 1503355437
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/jumpjump/Assets/Scripts/Player.cs:
--------------------------------------------------------------------------------
1 | using DG.Tweening;
2 | using UnityEngine;
3 | using UnityEngine.SceneManagement;
4 | using UnityEngine.UI;
5 | using Random = UnityEngine.Random;
6 |
7 | public class Player : MonoBehaviour
8 | {
9 | public Transform Body;
10 | public Transform Head;
11 | public Transform Camera;
12 | public GameObject Stage;
13 | public Text SingleScoreText;
14 | public Text TotalScoreText;
15 | public GameObject Particle;
16 | public float Factor = 200;
17 | private Rigidbody _rigidbody;
18 | private float _startTime;
19 | private int _score;
20 |
21 | private Vector3 _distanceToCamera;
22 | private GameObject _currentStage;
23 |
24 | private Vector3 _direction;
25 |
26 | private bool _isPlayingScoreAnim;
27 | private float _scoreAnimStartTime;
28 |
29 | // Use this for initialization
30 | void Start()
31 | {
32 | _rigidbody = GetComponent();
33 | _rigidbody.centerOfMass = Vector3.zero;
34 | _distanceToCamera = Camera.position - transform.position;
35 |
36 | _currentStage = Stage;
37 | _currentStage.GetComponent().material.color =
38 | new Color(Random.Range(0, 1f), Random.Range(0, 1f), Random.Range(0, 1f));
39 |
40 | _direction = new Vector3(1, 0, 0);
41 |
42 | SpawnNextStage();
43 | }
44 |
45 | // Update is called once per frame
46 | void Update()
47 | {
48 | if (Input.GetKeyDown(KeyCode.Space))
49 | {
50 | _startTime = Time.time;
51 | OnTappingStart();
52 | }
53 |
54 | if (Input.GetKeyUp(KeyCode.Space))
55 | {
56 | var elapse = Time.time - _startTime;
57 | Jump(elapse);
58 | OnTappingEnd();
59 | }
60 |
61 | if (Input.GetKey(KeyCode.Space))
62 | {
63 | _currentStage.transform.localScale -= new Vector3(0, 0.15f, 0) * Time.deltaTime;
64 | _currentStage.transform.position -= new Vector3(0, 0.15f, 0) * Time.deltaTime;
65 |
66 | Body.transform.localScale -= new Vector3(-0.05f, 0.05f, -0.05f) * Time.deltaTime;
67 | Body.transform.position -= new Vector3(0, 0.05f, 0) * Time.deltaTime;
68 | Head.transform.position -= new Vector3(0, 0.1f, 0) * Time.deltaTime;
69 | }
70 |
71 | if (_isPlayingScoreAnim)
72 | {
73 | UpdateScoreAnim();
74 | }
75 | }
76 |
77 | private void OnTappingStart()
78 | {
79 | Particle.SetActive(true);
80 | }
81 |
82 | private void OnTappingEnd()
83 | {
84 | Particle.SetActive(false);
85 | _currentStage.transform.DOScaleY(0.5f, 0.2f);
86 | _currentStage.transform.DOMoveY(-0.25f, 0.2f);
87 |
88 | Body.transform.DOScale(0.1f, 0.2f);
89 | Body.transform.DOLocalMoveY(0.1f, 0.2f);
90 | Head.transform.DOLocalMoveY(0.29f, 0.2f);
91 | }
92 |
93 | void Jump(float elapse)
94 | {
95 | Debug.Log(elapse);
96 | _rigidbody.AddForce((_direction + new Vector3(0, 1, 0)) * elapse * Factor, ForceMode.Impulse);
97 | }
98 |
99 |
100 | private void ShowScoreAnim()
101 | {
102 | _isPlayingScoreAnim = true;
103 | _scoreAnimStartTime = Time.time;
104 | }
105 |
106 | private void UpdateScoreAnim()
107 | {
108 | if (Time.time - _scoreAnimStartTime > 1)
109 | {
110 | _isPlayingScoreAnim = false;
111 | }
112 |
113 | var pos = RectTransformUtility.WorldToScreenPoint(Camera.GetComponent(), transform.position);
114 | SingleScoreText.transform.position =
115 | pos + Vector2.Lerp(Vector2.zero, new Vector2(0, 200), Time.time - _scoreAnimStartTime);
116 |
117 | SingleScoreText.GetComponent().color =
118 | Color.Lerp(Color.black, new Color(0, 0, 0, 0), Time.time - _scoreAnimStartTime);
119 | }
120 |
121 | private void MoveCamera()
122 | {
123 | var nextPosition = transform.position + _distanceToCamera;
124 | Camera.DOMove(nextPosition, 1f);
125 | }
126 |
127 | private void SpawnNextStage()
128 | {
129 | var nextStage = Instantiate(Stage);
130 | nextStage.transform.position = _currentStage.transform.position + _direction * Random.Range(1.1f, 3);
131 |
132 | //random scale
133 | var originalScale = Stage.transform.localScale;
134 | var scaleFactor = Random.Range(0.5f, 1);
135 | var newScale = originalScale * scaleFactor;
136 | newScale.y = originalScale.y;
137 | nextStage.transform.localScale = newScale;
138 |
139 | //random color
140 | nextStage.GetComponent().material.color =
141 | new Color(Random.Range(0, 1f), Random.Range(0, 1f), Random.Range(0, 1f));
142 | }
143 |
144 | private void RandomDirection()
145 | {
146 | var dir = Random.Range(0, 2);
147 | _direction = dir == 0 ? new Vector3(1, 0, 0) : new Vector3(0, 0, 1);
148 | }
149 |
150 | private void Restart()
151 | {
152 | Debug.Log("restart");
153 | SceneManager.LoadScene(0, LoadSceneMode.Single);
154 | }
155 | }
--------------------------------------------------------------------------------
/jumpjump/Assets/Scripts/Player.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ae631af4128d6b14f8dbd8f975d88647
3 | timeCreated: 1516078521
4 | licenseType: Pro
5 | MonoImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | defaultReferences: []
9 | executionOrder: 0
10 | icon: {instanceID: 0}
11 | userData:
12 | assetBundleName:
13 | assetBundleVariant:
14 |
--------------------------------------------------------------------------------
/jumpjump/Assets/_Scenes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8ee89cc1b2f7c4d48be759ed8a571b14
3 | folderAsset: yes
4 | timeCreated: 1516077933
5 | licenseType: Pro
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/_Scenes/Game.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 60a3e1e49ebde5743b88876c0014b9e6
3 | folderAsset: yes
4 | timeCreated: 1516112352
5 | licenseType: Pro
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/_Scenes/Game.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1d1c17b1fec802944b964889e8daa89b
3 | timeCreated: 1516078027
4 | licenseType: Pro
5 | DefaultImporter:
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/_Scenes/Game/LightingData.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/_Scenes/Game/LightingData.asset
--------------------------------------------------------------------------------
/jumpjump/Assets/_Scenes/Game/LightingData.asset.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a19bf3d7108de8a40b663d793c544df9
3 | timeCreated: 1516112353
4 | licenseType: Pro
5 | NativeFormatImporter:
6 | externalObjects: {}
7 | mainObjectFileID: 25800000
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/jumpjump/Assets/_Scenes/Game/ReflectionProbe-0.exr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/jumpjump/Assets/_Scenes/Game/ReflectionProbe-0.exr
--------------------------------------------------------------------------------
/jumpjump/Assets/_Scenes/Game/ReflectionProbe-0.exr.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: aa7c86a5431bfb041a2a39e1321a3a2d
3 | timeCreated: 1516112352
4 | licenseType: Pro
5 | TextureImporter:
6 | fileIDToRecycleName:
7 | 8900000: generatedCubemap
8 | externalObjects: {}
9 | serializedVersion: 4
10 | mipmaps:
11 | mipMapMode: 0
12 | enableMipMap: 1
13 | sRGBTexture: 1
14 | linearTexture: 0
15 | fadeOut: 0
16 | borderMipMap: 0
17 | mipMapsPreserveCoverage: 0
18 | alphaTestReferenceValue: 0.5
19 | mipMapFadeDistanceStart: 1
20 | mipMapFadeDistanceEnd: 3
21 | bumpmap:
22 | convertToNormalMap: 0
23 | externalNormalMap: 0
24 | heightScale: 0.25
25 | normalMapFilter: 0
26 | isReadable: 0
27 | grayScaleToAlpha: 0
28 | generateCubemap: 6
29 | cubemapConvolution: 1
30 | seamlessCubemap: 1
31 | textureFormat: 1
32 | maxTextureSize: 2048
33 | textureSettings:
34 | serializedVersion: 2
35 | filterMode: 2
36 | aniso: 0
37 | mipBias: 0
38 | wrapU: 1
39 | wrapV: 1
40 | wrapW: 1
41 | nPOTScale: 1
42 | lightmap: 0
43 | compressionQuality: 50
44 | spriteMode: 0
45 | spriteExtrude: 1
46 | spriteMeshType: 1
47 | alignment: 0
48 | spritePivot: {x: 0.5, y: 0.5}
49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
50 | spritePixelsToUnits: 100
51 | alphaUsage: 1
52 | alphaIsTransparency: 0
53 | spriteTessellationDetail: -1
54 | textureType: 0
55 | textureShape: 2
56 | maxTextureSizeSet: 0
57 | compressionQualitySet: 0
58 | textureFormatSet: 0
59 | platformSettings:
60 | - buildTarget: DefaultTexturePlatform
61 | maxTextureSize: 2048
62 | resizeAlgorithm: 0
63 | textureFormat: -1
64 | textureCompression: 1
65 | compressionQuality: 100
66 | crunchedCompression: 0
67 | allowsAlphaSplitting: 0
68 | overridden: 0
69 | androidETC2FallbackOverride: 0
70 | spriteSheet:
71 | serializedVersion: 2
72 | sprites: []
73 | outline: []
74 | physicsShape: []
75 | spritePackingTag:
76 | userData:
77 | assetBundleName:
78 | assetBundleVariant:
79 |
--------------------------------------------------------------------------------
/jumpjump/Assets/_Scenes/GameAI.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2f9116b05230ff24fba4dc9eb042c21e
3 | timeCreated: 1516078027
4 | licenseType: Pro
5 | DefaultImporter:
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/Assets/_Scenes/GameAIMultiple.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5b23f2963c76f7443b1697d5415ea325
3 | timeCreated: 1516078027
4 | licenseType: Pro
5 | DefaultImporter:
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/jumpjump/ProjectSettings/AudioManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!11 &1
4 | AudioManager:
5 | m_ObjectHideFlags: 0
6 | m_Volume: 1
7 | Rolloff Scale: 1
8 | Doppler Factor: 1
9 | Default Speaker Mode: 2
10 | m_SampleRate: 0
11 | m_DSPBufferSize: 0
12 | m_VirtualVoiceCount: 512
13 | m_RealVoiceCount: 32
14 | m_SpatializerPlugin:
15 | m_AmbisonicDecoderPlugin:
16 | m_DisableAudio: 0
17 | m_VirtualizeEffects: 1
18 |
--------------------------------------------------------------------------------
/jumpjump/ProjectSettings/ClusterInputManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!236 &1
4 | ClusterInputManager:
5 | m_ObjectHideFlags: 0
6 | m_Inputs: []
7 |
--------------------------------------------------------------------------------
/jumpjump/ProjectSettings/DynamicsManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!55 &1
4 | PhysicsManager:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 7
7 | m_Gravity: {x: 0, y: -9.81, z: 0}
8 | m_DefaultMaterial: {fileID: 0}
9 | m_BounceThreshold: 2
10 | m_SleepThreshold: 0.005
11 | m_DefaultContactOffset: 0.001
12 | m_DefaultSolverIterations: 6
13 | m_DefaultSolverVelocityIterations: 1
14 | m_QueriesHitBackfaces: 0
15 | m_QueriesHitTriggers: 1
16 | m_EnableAdaptiveForce: 0
17 | m_ClothInterCollisionDistance: 0
18 | m_ClothInterCollisionStiffness: 0
19 | m_ContactsGeneration: 1
20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
21 | m_AutoSimulation: 1
22 | m_AutoSyncTransforms: 1
23 | m_ClothInterCollisionSettingsToggle: 0
24 | m_ContactPairsMode: 0
25 | m_BroadphaseType: 0
26 | m_WorldBounds:
27 | m_Center: {x: 0, y: 0, z: 0}
28 | m_Extent: {x: 250, y: 250, z: 250}
29 | m_WorldSubdivisions: 8
30 |
--------------------------------------------------------------------------------
/jumpjump/ProjectSettings/EditorBuildSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1045 &1
4 | EditorBuildSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Scenes:
8 | - enabled: 1
9 | path: Assets/_Scenes/GameAI.unity
10 | guid: 2f9116b05230ff24fba4dc9eb042c21e
11 |
--------------------------------------------------------------------------------
/jumpjump/ProjectSettings/EditorSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!159 &1
4 | EditorSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 7
7 | m_ExternalVersionControlSupport: Hidden Meta Files
8 | m_SerializationMode: 2
9 | m_LineEndingsForNewScripts: 2
10 | m_DefaultBehaviorMode: 0
11 | m_SpritePackerMode: 0
12 | m_SpritePackerPaddingPower: 1
13 | m_EtcTextureCompressorBehavior: 1
14 | m_EtcTextureFastCompressor: 1
15 | m_EtcTextureNormalCompressor: 2
16 | m_EtcTextureBestCompressor: 4
17 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp
18 | m_ProjectGenerationRootNamespace:
19 | m_UserGeneratedProjectSuffix:
20 | m_CollabEditorSettings:
21 | inProgressEnabled: 1
22 |
--------------------------------------------------------------------------------
/jumpjump/ProjectSettings/GraphicsSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!30 &1
4 | GraphicsSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 12
7 | m_Deferred:
8 | m_Mode: 1
9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
10 | m_DeferredReflections:
11 | m_Mode: 1
12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0}
13 | m_ScreenSpaceShadows:
14 | m_Mode: 1
15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0}
16 | m_LegacyDeferred:
17 | m_Mode: 1
18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}
19 | m_DepthNormals:
20 | m_Mode: 1
21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0}
22 | m_MotionVectors:
23 | m_Mode: 1
24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0}
25 | m_LightHalo:
26 | m_Mode: 1
27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0}
28 | m_LensFlare:
29 | m_Mode: 1
30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0}
31 | m_AlwaysIncludedShaders:
32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0}
34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0}
35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
38 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
39 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
40 | m_PreloadedShaders: []
41 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
42 | type: 0}
43 | m_CustomRenderPipeline: {fileID: 0}
44 | m_TransparencySortMode: 0
45 | m_TransparencySortAxis: {x: 0, y: 0, z: 1}
46 | m_DefaultRenderingPath: 1
47 | m_DefaultMobileRenderingPath: 1
48 | m_TierSettings: []
49 | m_LightmapStripping: 0
50 | m_FogStripping: 0
51 | m_InstancingStripping: 0
52 | m_LightmapKeepPlain: 1
53 | m_LightmapKeepDirCombined: 1
54 | m_LightmapKeepDynamicPlain: 1
55 | m_LightmapKeepDynamicDirCombined: 1
56 | m_LightmapKeepShadowMask: 1
57 | m_LightmapKeepSubtractive: 1
58 | m_FogKeepLinear: 1
59 | m_FogKeepExp: 1
60 | m_FogKeepExp2: 1
61 | m_AlbedoSwatchInfos: []
62 | m_LightsUseLinearIntensity: 0
63 | m_LightsUseColorTemperature: 0
64 |
--------------------------------------------------------------------------------
/jumpjump/ProjectSettings/InputManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!13 &1
4 | InputManager:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Axes:
8 | - serializedVersion: 3
9 | m_Name: Horizontal
10 | descriptiveName:
11 | descriptiveNegativeName:
12 | negativeButton: left
13 | positiveButton: right
14 | altNegativeButton: a
15 | altPositiveButton: d
16 | gravity: 3
17 | dead: 0.001
18 | sensitivity: 3
19 | snap: 1
20 | invert: 0
21 | type: 0
22 | axis: 0
23 | joyNum: 0
24 | - serializedVersion: 3
25 | m_Name: Vertical
26 | descriptiveName:
27 | descriptiveNegativeName:
28 | negativeButton: down
29 | positiveButton: up
30 | altNegativeButton: s
31 | altPositiveButton: w
32 | gravity: 3
33 | dead: 0.001
34 | sensitivity: 3
35 | snap: 1
36 | invert: 0
37 | type: 0
38 | axis: 0
39 | joyNum: 0
40 | - serializedVersion: 3
41 | m_Name: Fire1
42 | descriptiveName:
43 | descriptiveNegativeName:
44 | negativeButton:
45 | positiveButton: left ctrl
46 | altNegativeButton:
47 | altPositiveButton: mouse 0
48 | gravity: 1000
49 | dead: 0.001
50 | sensitivity: 1000
51 | snap: 0
52 | invert: 0
53 | type: 0
54 | axis: 0
55 | joyNum: 0
56 | - serializedVersion: 3
57 | m_Name: Fire2
58 | descriptiveName:
59 | descriptiveNegativeName:
60 | negativeButton:
61 | positiveButton: left alt
62 | altNegativeButton:
63 | altPositiveButton: mouse 1
64 | gravity: 1000
65 | dead: 0.001
66 | sensitivity: 1000
67 | snap: 0
68 | invert: 0
69 | type: 0
70 | axis: 0
71 | joyNum: 0
72 | - serializedVersion: 3
73 | m_Name: Fire3
74 | descriptiveName:
75 | descriptiveNegativeName:
76 | negativeButton:
77 | positiveButton: left shift
78 | altNegativeButton:
79 | altPositiveButton: mouse 2
80 | gravity: 1000
81 | dead: 0.001
82 | sensitivity: 1000
83 | snap: 0
84 | invert: 0
85 | type: 0
86 | axis: 0
87 | joyNum: 0
88 | - serializedVersion: 3
89 | m_Name: Jump
90 | descriptiveName:
91 | descriptiveNegativeName:
92 | negativeButton:
93 | positiveButton: space
94 | altNegativeButton:
95 | altPositiveButton:
96 | gravity: 1000
97 | dead: 0.001
98 | sensitivity: 1000
99 | snap: 0
100 | invert: 0
101 | type: 0
102 | axis: 0
103 | joyNum: 0
104 | - serializedVersion: 3
105 | m_Name: Mouse X
106 | descriptiveName:
107 | descriptiveNegativeName:
108 | negativeButton:
109 | positiveButton:
110 | altNegativeButton:
111 | altPositiveButton:
112 | gravity: 0
113 | dead: 0
114 | sensitivity: 0.1
115 | snap: 0
116 | invert: 0
117 | type: 1
118 | axis: 0
119 | joyNum: 0
120 | - serializedVersion: 3
121 | m_Name: Mouse Y
122 | descriptiveName:
123 | descriptiveNegativeName:
124 | negativeButton:
125 | positiveButton:
126 | altNegativeButton:
127 | altPositiveButton:
128 | gravity: 0
129 | dead: 0
130 | sensitivity: 0.1
131 | snap: 0
132 | invert: 0
133 | type: 1
134 | axis: 1
135 | joyNum: 0
136 | - serializedVersion: 3
137 | m_Name: Mouse ScrollWheel
138 | descriptiveName:
139 | descriptiveNegativeName:
140 | negativeButton:
141 | positiveButton:
142 | altNegativeButton:
143 | altPositiveButton:
144 | gravity: 0
145 | dead: 0
146 | sensitivity: 0.1
147 | snap: 0
148 | invert: 0
149 | type: 1
150 | axis: 2
151 | joyNum: 0
152 | - serializedVersion: 3
153 | m_Name: Horizontal
154 | descriptiveName:
155 | descriptiveNegativeName:
156 | negativeButton:
157 | positiveButton:
158 | altNegativeButton:
159 | altPositiveButton:
160 | gravity: 0
161 | dead: 0.19
162 | sensitivity: 1
163 | snap: 0
164 | invert: 0
165 | type: 2
166 | axis: 0
167 | joyNum: 0
168 | - serializedVersion: 3
169 | m_Name: Vertical
170 | descriptiveName:
171 | descriptiveNegativeName:
172 | negativeButton:
173 | positiveButton:
174 | altNegativeButton:
175 | altPositiveButton:
176 | gravity: 0
177 | dead: 0.19
178 | sensitivity: 1
179 | snap: 0
180 | invert: 1
181 | type: 2
182 | axis: 1
183 | joyNum: 0
184 | - serializedVersion: 3
185 | m_Name: Fire1
186 | descriptiveName:
187 | descriptiveNegativeName:
188 | negativeButton:
189 | positiveButton: joystick button 0
190 | altNegativeButton:
191 | altPositiveButton:
192 | gravity: 1000
193 | dead: 0.001
194 | sensitivity: 1000
195 | snap: 0
196 | invert: 0
197 | type: 0
198 | axis: 0
199 | joyNum: 0
200 | - serializedVersion: 3
201 | m_Name: Fire2
202 | descriptiveName:
203 | descriptiveNegativeName:
204 | negativeButton:
205 | positiveButton: joystick button 1
206 | altNegativeButton:
207 | altPositiveButton:
208 | gravity: 1000
209 | dead: 0.001
210 | sensitivity: 1000
211 | snap: 0
212 | invert: 0
213 | type: 0
214 | axis: 0
215 | joyNum: 0
216 | - serializedVersion: 3
217 | m_Name: Fire3
218 | descriptiveName:
219 | descriptiveNegativeName:
220 | negativeButton:
221 | positiveButton: joystick button 2
222 | altNegativeButton:
223 | altPositiveButton:
224 | gravity: 1000
225 | dead: 0.001
226 | sensitivity: 1000
227 | snap: 0
228 | invert: 0
229 | type: 0
230 | axis: 0
231 | joyNum: 0
232 | - serializedVersion: 3
233 | m_Name: Jump
234 | descriptiveName:
235 | descriptiveNegativeName:
236 | negativeButton:
237 | positiveButton: joystick button 3
238 | altNegativeButton:
239 | altPositiveButton:
240 | gravity: 1000
241 | dead: 0.001
242 | sensitivity: 1000
243 | snap: 0
244 | invert: 0
245 | type: 0
246 | axis: 0
247 | joyNum: 0
248 | - serializedVersion: 3
249 | m_Name: Submit
250 | descriptiveName:
251 | descriptiveNegativeName:
252 | negativeButton:
253 | positiveButton: return
254 | altNegativeButton:
255 | altPositiveButton: joystick button 0
256 | gravity: 1000
257 | dead: 0.001
258 | sensitivity: 1000
259 | snap: 0
260 | invert: 0
261 | type: 0
262 | axis: 0
263 | joyNum: 0
264 | - serializedVersion: 3
265 | m_Name: Submit
266 | descriptiveName:
267 | descriptiveNegativeName:
268 | negativeButton:
269 | positiveButton: enter
270 | altNegativeButton:
271 | altPositiveButton: space
272 | gravity: 1000
273 | dead: 0.001
274 | sensitivity: 1000
275 | snap: 0
276 | invert: 0
277 | type: 0
278 | axis: 0
279 | joyNum: 0
280 | - serializedVersion: 3
281 | m_Name: Cancel
282 | descriptiveName:
283 | descriptiveNegativeName:
284 | negativeButton:
285 | positiveButton: escape
286 | altNegativeButton:
287 | altPositiveButton: joystick button 1
288 | gravity: 1000
289 | dead: 0.001
290 | sensitivity: 1000
291 | snap: 0
292 | invert: 0
293 | type: 0
294 | axis: 0
295 | joyNum: 0
296 |
--------------------------------------------------------------------------------
/jumpjump/ProjectSettings/NavMeshAreas.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!126 &1
4 | NavMeshProjectSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | areas:
8 | - name: Walkable
9 | cost: 1
10 | - name: Not Walkable
11 | cost: 1
12 | - name: Jump
13 | cost: 2
14 | - name:
15 | cost: 1
16 | - name:
17 | cost: 1
18 | - name:
19 | cost: 1
20 | - name:
21 | cost: 1
22 | - name:
23 | cost: 1
24 | - name:
25 | cost: 1
26 | - name:
27 | cost: 1
28 | - name:
29 | cost: 1
30 | - name:
31 | cost: 1
32 | - name:
33 | cost: 1
34 | - name:
35 | cost: 1
36 | - name:
37 | cost: 1
38 | - name:
39 | cost: 1
40 | - name:
41 | cost: 1
42 | - name:
43 | cost: 1
44 | - name:
45 | cost: 1
46 | - name:
47 | cost: 1
48 | - name:
49 | cost: 1
50 | - name:
51 | cost: 1
52 | - name:
53 | cost: 1
54 | - name:
55 | cost: 1
56 | - name:
57 | cost: 1
58 | - name:
59 | cost: 1
60 | - name:
61 | cost: 1
62 | - name:
63 | cost: 1
64 | - name:
65 | cost: 1
66 | - name:
67 | cost: 1
68 | - name:
69 | cost: 1
70 | - name:
71 | cost: 1
72 | m_LastAgentTypeID: -887442657
73 | m_Settings:
74 | - serializedVersion: 2
75 | agentTypeID: 0
76 | agentRadius: 0.5
77 | agentHeight: 2
78 | agentSlope: 45
79 | agentClimb: 0.75
80 | ledgeDropHeight: 0
81 | maxJumpAcrossDistance: 0
82 | minRegionArea: 2
83 | manualCellSize: 0
84 | cellSize: 0.16666667
85 | manualTileSize: 0
86 | tileSize: 256
87 | accuratePlacement: 0
88 | debug:
89 | m_Flags: 0
90 | m_SettingNames:
91 | - Humanoid
92 |
--------------------------------------------------------------------------------
/jumpjump/ProjectSettings/NetworkManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!149 &1
4 | NetworkManager:
5 | m_ObjectHideFlags: 0
6 | m_DebugLevel: 0
7 | m_Sendrate: 15
8 | m_AssetToPrefab: {}
9 |
--------------------------------------------------------------------------------
/jumpjump/ProjectSettings/Physics2DSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!19 &1
4 | Physics2DSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 3
7 | m_Gravity: {x: 0, y: -9.81}
8 | m_DefaultMaterial: {fileID: 0}
9 | m_VelocityIterations: 8
10 | m_PositionIterations: 3
11 | m_VelocityThreshold: 1
12 | m_MaxLinearCorrection: 0.2
13 | m_MaxAngularCorrection: 8
14 | m_MaxTranslationSpeed: 100
15 | m_MaxRotationSpeed: 360
16 | m_BaumgarteScale: 0.2
17 | m_BaumgarteTimeOfImpactScale: 0.75
18 | m_TimeToSleep: 0.5
19 | m_LinearSleepTolerance: 0.01
20 | m_AngularSleepTolerance: 2
21 | m_DefaultContactOffset: 0.01
22 | m_AutoSimulation: 1
23 | m_QueriesHitTriggers: 1
24 | m_QueriesStartInColliders: 1
25 | m_ChangeStopsCallbacks: 0
26 | m_CallbacksOnDisable: 1
27 | m_AutoSyncTransforms: 1
28 | m_AlwaysShowColliders: 0
29 | m_ShowColliderSleep: 1
30 | m_ShowColliderContacts: 0
31 | m_ShowColliderAABB: 0
32 | m_ContactArrowScale: 0.2
33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412}
34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432}
35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745}
36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804}
37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
38 |
--------------------------------------------------------------------------------
/jumpjump/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 2017.3.0f3
2 |
--------------------------------------------------------------------------------
/jumpjump/ProjectSettings/QualitySettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!47 &1
4 | QualitySettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 5
7 | m_CurrentQuality: 5
8 | m_QualitySettings:
9 | - serializedVersion: 2
10 | name: Very Low
11 | pixelLightCount: 0
12 | shadows: 0
13 | shadowResolution: 0
14 | shadowProjection: 1
15 | shadowCascades: 1
16 | shadowDistance: 15
17 | shadowNearPlaneOffset: 3
18 | shadowCascade2Split: 0.33333334
19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
20 | shadowmaskMode: 0
21 | blendWeights: 1
22 | textureQuality: 1
23 | anisotropicTextures: 0
24 | antiAliasing: 0
25 | softParticles: 0
26 | softVegetation: 0
27 | realtimeReflectionProbes: 0
28 | billboardsFaceCameraPosition: 0
29 | vSyncCount: 0
30 | lodBias: 0.3
31 | maximumLODLevel: 0
32 | particleRaycastBudget: 4
33 | asyncUploadTimeSlice: 2
34 | asyncUploadBufferSize: 4
35 | resolutionScalingFixedDPIFactor: 1
36 | excludedTargetPlatforms: []
37 | - serializedVersion: 2
38 | name: Low
39 | pixelLightCount: 0
40 | shadows: 0
41 | shadowResolution: 0
42 | shadowProjection: 1
43 | shadowCascades: 1
44 | shadowDistance: 20
45 | shadowNearPlaneOffset: 3
46 | shadowCascade2Split: 0.33333334
47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
48 | shadowmaskMode: 0
49 | blendWeights: 2
50 | textureQuality: 0
51 | anisotropicTextures: 0
52 | antiAliasing: 0
53 | softParticles: 0
54 | softVegetation: 0
55 | realtimeReflectionProbes: 0
56 | billboardsFaceCameraPosition: 0
57 | vSyncCount: 0
58 | lodBias: 0.4
59 | maximumLODLevel: 0
60 | particleRaycastBudget: 16
61 | asyncUploadTimeSlice: 2
62 | asyncUploadBufferSize: 4
63 | resolutionScalingFixedDPIFactor: 1
64 | excludedTargetPlatforms: []
65 | - serializedVersion: 2
66 | name: Medium
67 | pixelLightCount: 1
68 | shadows: 1
69 | shadowResolution: 0
70 | shadowProjection: 1
71 | shadowCascades: 1
72 | shadowDistance: 20
73 | shadowNearPlaneOffset: 3
74 | shadowCascade2Split: 0.33333334
75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
76 | shadowmaskMode: 0
77 | blendWeights: 2
78 | textureQuality: 0
79 | anisotropicTextures: 1
80 | antiAliasing: 0
81 | softParticles: 0
82 | softVegetation: 0
83 | realtimeReflectionProbes: 0
84 | billboardsFaceCameraPosition: 0
85 | vSyncCount: 1
86 | lodBias: 0.7
87 | maximumLODLevel: 0
88 | particleRaycastBudget: 64
89 | asyncUploadTimeSlice: 2
90 | asyncUploadBufferSize: 4
91 | resolutionScalingFixedDPIFactor: 1
92 | excludedTargetPlatforms: []
93 | - serializedVersion: 2
94 | name: High
95 | pixelLightCount: 2
96 | shadows: 2
97 | shadowResolution: 1
98 | shadowProjection: 1
99 | shadowCascades: 2
100 | shadowDistance: 40
101 | shadowNearPlaneOffset: 3
102 | shadowCascade2Split: 0.33333334
103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
104 | shadowmaskMode: 1
105 | blendWeights: 2
106 | textureQuality: 0
107 | anisotropicTextures: 1
108 | antiAliasing: 0
109 | softParticles: 0
110 | softVegetation: 1
111 | realtimeReflectionProbes: 1
112 | billboardsFaceCameraPosition: 1
113 | vSyncCount: 1
114 | lodBias: 1
115 | maximumLODLevel: 0
116 | particleRaycastBudget: 256
117 | asyncUploadTimeSlice: 2
118 | asyncUploadBufferSize: 4
119 | resolutionScalingFixedDPIFactor: 1
120 | excludedTargetPlatforms: []
121 | - serializedVersion: 2
122 | name: Very High
123 | pixelLightCount: 3
124 | shadows: 2
125 | shadowResolution: 2
126 | shadowProjection: 1
127 | shadowCascades: 2
128 | shadowDistance: 70
129 | shadowNearPlaneOffset: 3
130 | shadowCascade2Split: 0.33333334
131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
132 | shadowmaskMode: 1
133 | blendWeights: 4
134 | textureQuality: 0
135 | anisotropicTextures: 2
136 | antiAliasing: 2
137 | softParticles: 1
138 | softVegetation: 1
139 | realtimeReflectionProbes: 1
140 | billboardsFaceCameraPosition: 1
141 | vSyncCount: 1
142 | lodBias: 1.5
143 | maximumLODLevel: 0
144 | particleRaycastBudget: 1024
145 | asyncUploadTimeSlice: 2
146 | asyncUploadBufferSize: 4
147 | resolutionScalingFixedDPIFactor: 1
148 | excludedTargetPlatforms: []
149 | - serializedVersion: 2
150 | name: Ultra
151 | pixelLightCount: 4
152 | shadows: 2
153 | shadowResolution: 2
154 | shadowProjection: 1
155 | shadowCascades: 4
156 | shadowDistance: 150
157 | shadowNearPlaneOffset: 3
158 | shadowCascade2Split: 0.33333334
159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
160 | shadowmaskMode: 1
161 | blendWeights: 4
162 | textureQuality: 0
163 | anisotropicTextures: 2
164 | antiAliasing: 2
165 | softParticles: 1
166 | softVegetation: 1
167 | realtimeReflectionProbes: 1
168 | billboardsFaceCameraPosition: 1
169 | vSyncCount: 1
170 | lodBias: 2
171 | maximumLODLevel: 0
172 | particleRaycastBudget: 4096
173 | asyncUploadTimeSlice: 2
174 | asyncUploadBufferSize: 4
175 | resolutionScalingFixedDPIFactor: 1
176 | excludedTargetPlatforms: []
177 | m_PerPlatformDefaultQuality:
178 | Android: 2
179 | Nintendo 3DS: 5
180 | Nintendo Switch: 5
181 | PS4: 5
182 | PSM: 5
183 | PSP2: 2
184 | Standalone: 5
185 | Tizen: 2
186 | WebGL: 3
187 | WiiU: 5
188 | Windows Store Apps: 5
189 | XboxOne: 5
190 | iPhone: 2
191 | tvOS: 2
192 |
--------------------------------------------------------------------------------
/jumpjump/ProjectSettings/TagManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!78 &1
4 | TagManager:
5 | serializedVersion: 2
6 | tags: []
7 | layers:
8 | - Default
9 | - TransparentFX
10 | - Ignore Raycast
11 | -
12 | - Water
13 | - UI
14 | -
15 | -
16 | -
17 | -
18 | -
19 | -
20 | -
21 | -
22 | -
23 | -
24 | -
25 | -
26 | -
27 | -
28 | -
29 | -
30 | -
31 | -
32 | -
33 | -
34 | -
35 | -
36 | -
37 | -
38 | -
39 | -
40 | m_SortingLayers:
41 | - name: Default
42 | uniqueID: 0
43 | locked: 0
44 |
--------------------------------------------------------------------------------
/jumpjump/ProjectSettings/TimeManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!5 &1
4 | TimeManager:
5 | m_ObjectHideFlags: 0
6 | Fixed Timestep: 0.01
7 | Maximum Allowed Timestep: 0.33333334
8 | m_TimeScale: 1
9 | Maximum Particle Timestep: 0.03
10 |
--------------------------------------------------------------------------------
/jumpjump/ProjectSettings/UnityConnectSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!310 &1
4 | UnityConnectSettings:
5 | m_ObjectHideFlags: 0
6 | m_Enabled: 0
7 | m_TestMode: 0
8 | m_TestEventUrl:
9 | m_TestConfigUrl:
10 | m_TestInitMode: 0
11 | CrashReportingSettings:
12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes
13 | m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate
14 | m_Enabled: 0
15 | m_CaptureEditorExceptions: 1
16 | UnityPurchasingSettings:
17 | m_Enabled: 0
18 | m_TestMode: 0
19 | UnityAnalyticsSettings:
20 | m_Enabled: 0
21 | m_InitializeOnStartup: 1
22 | m_TestMode: 0
23 | m_TestEventUrl:
24 | m_TestConfigUrl:
25 | UnityAdsSettings:
26 | m_Enabled: 0
27 | m_InitializeOnStartup: 1
28 | m_TestMode: 0
29 | m_IosGameId:
30 | m_AndroidGameId:
31 | m_GameIds: {}
32 | m_GameId:
33 | PerformanceReportingSettings:
34 | m_Enabled: 0
35 |
--------------------------------------------------------------------------------
/python/.gitignore:
--------------------------------------------------------------------------------
1 | build*/
2 | .ipynb_checkpoints/
3 | summaries/
4 | unity-environment.log
5 | *.pyc
6 | models/
--------------------------------------------------------------------------------
/python/jump#3.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Unity ML Agents\n",
8 | "## Proximal Policy Optimization (PPO)\n",
9 | "Contains an implementation of PPO as described [here](https://arxiv.org/abs/1707.06347)."
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {
16 | "collapsed": true
17 | },
18 | "outputs": [],
19 | "source": [
20 | "import numpy as np\n",
21 | "import os\n",
22 | "import tensorflow as tf\n",
23 | "\n",
24 | "from ppo.history import *\n",
25 | "from ppo.models import *\n",
26 | "from ppo.trainer import Trainer\n",
27 | "from unityagents import *"
28 | ]
29 | },
30 | {
31 | "cell_type": "markdown",
32 | "metadata": {},
33 | "source": [
34 | "### Hyperparameters"
35 | ]
36 | },
37 | {
38 | "cell_type": "code",
39 | "execution_count": null,
40 | "metadata": {
41 | "collapsed": true
42 | },
43 | "outputs": [],
44 | "source": [
45 | "### General parameters\n",
46 | "max_steps = 1e7 # Set maximum number of steps to run environment.\n",
47 | "run_path = \"jump4\" # The sub-directory name for model and summary statistics\n",
48 | "load_model = True # Whether to load a saved model.\n",
49 | "train_model = False # Whether to train the model.\n",
50 | "summary_freq = 1000 # Frequency at which to save training statistics.\n",
51 | "save_freq = 1000 # Frequency at which to save model.\n",
52 | "env_name = \"build3/jump.exe\" # Name of the training environment file.\n",
53 | "curriculum_file = \"jump3.json\"\n",
54 | "\n",
55 | "### Algorithm-specific parameters for tuning\n",
56 | "gamma = 0.99 # Reward discount rate.\n",
57 | "lambd = 0.95 # Lambda parameter for GAE.\n",
58 | "time_horizon = 64 # How many steps to collect per agent before adding to buffer.\n",
59 | "beta = 1e-4 # Strength of entropy regularization\n",
60 | "num_epoch = 3 # Number of gradient descent steps per batch of experiences.\n",
61 | "num_layers = 1 # Number of hidden layers between state/observation encoding and value/policy layers.\n",
62 | "epsilon = 0.2 # Acceptable threshold around ratio of old and new policy probabilities.\n",
63 | "buffer_size = 5120 # How large the experience buffer should be before gradient descent.\n",
64 | "learning_rate = 1e-4 # Model learning rate.\n",
65 | "hidden_units = 32 # Number of units in hidden layer.\n",
66 | "batch_size = 512 # How many experiences per gradient descent update step.\n",
67 | "normalize = False\n",
68 | "\n",
69 | "### Logging dictionary for hyperparameters\n",
70 | "hyperparameter_dict = {'max_steps':max_steps, 'run_path':run_path, 'env_name':env_name,\n",
71 | " 'curriculum_file':curriculum_file, 'gamma':gamma, 'lambd':lambd, 'time_horizon':time_horizon,\n",
72 | " 'beta':beta, 'num_epoch':num_epoch, 'epsilon':epsilon, 'buffe_size':buffer_size,\n",
73 | " 'leaning_rate':learning_rate, 'hidden_units':hidden_units, 'batch_size':batch_size}"
74 | ]
75 | },
76 | {
77 | "cell_type": "markdown",
78 | "metadata": {},
79 | "source": [
80 | "### Load the environment"
81 | ]
82 | },
83 | {
84 | "cell_type": "code",
85 | "execution_count": null,
86 | "metadata": {
87 | "scrolled": false
88 | },
89 | "outputs": [],
90 | "source": [
91 | "env = UnityEnvironment(file_name=env_name, curriculum=curriculum_file)\n",
92 | "print(str(env))\n",
93 | "brain_name = env.external_brain_names[0]"
94 | ]
95 | },
96 | {
97 | "cell_type": "markdown",
98 | "metadata": {},
99 | "source": [
100 | "### Train the Agent(s)"
101 | ]
102 | },
103 | {
104 | "cell_type": "code",
105 | "execution_count": null,
106 | "metadata": {
107 | "scrolled": false
108 | },
109 | "outputs": [],
110 | "source": [
111 | "tf.reset_default_graph()\n",
112 | "\n",
113 | "if curriculum_file == \"None\":\n",
114 | " curriculum_file = None\n",
115 | "\n",
116 | "\n",
117 | "def get_progress():\n",
118 | " if curriculum_file is not None:\n",
119 | " if env._curriculum.measure_type == \"progress\":\n",
120 | " return steps / max_steps\n",
121 | " elif env._curriculum.measure_type == \"reward\":\n",
122 | " return last_reward\n",
123 | " else:\n",
124 | " return None\n",
125 | " else:\n",
126 | " return None\n",
127 | "\n",
128 | "# Create the Tensorflow model graph\n",
129 | "ppo_model = create_agent_model(env, lr=learning_rate,\n",
130 | " h_size=hidden_units, epsilon=epsilon,\n",
131 | " beta=beta, max_step=max_steps, \n",
132 | " normalize=normalize, num_layers=num_layers)\n",
133 | "\n",
134 | "is_continuous = (env.brains[brain_name].action_space_type == \"continuous\")\n",
135 | "use_observations = (env.brains[brain_name].number_observations > 0)\n",
136 | "use_states = (env.brains[brain_name].state_space_size > 0)\n",
137 | "\n",
138 | "model_path = './models/{}'.format(run_path)\n",
139 | "summary_path = './summaries/{}'.format(run_path)\n",
140 | "\n",
141 | "if not os.path.exists(model_path):\n",
142 | " os.makedirs(model_path)\n",
143 | "\n",
144 | "if not os.path.exists(summary_path):\n",
145 | " os.makedirs(summary_path)\n",
146 | "\n",
147 | "init = tf.global_variables_initializer()\n",
148 | "saver = tf.train.Saver()\n",
149 | "\n",
150 | "with tf.Session() as sess:\n",
151 | " # Instantiate model parameters\n",
152 | " if load_model:\n",
153 | " print('Loading Model...')\n",
154 | " ckpt = tf.train.get_checkpoint_state(model_path)\n",
155 | " saver.restore(sess, ckpt.model_checkpoint_path)\n",
156 | " else:\n",
157 | " sess.run(init)\n",
158 | " steps, last_reward = sess.run([ppo_model.global_step, ppo_model.last_reward]) \n",
159 | " summary_writer = tf.summary.FileWriter(summary_path)\n",
160 | " info = env.reset(train_mode=train_model, progress=get_progress())[brain_name]\n",
161 | " trainer = Trainer(ppo_model, sess, info, is_continuous, use_observations, use_states, train_model)\n",
162 | " if train_model:\n",
163 | " trainer.write_text(summary_writer, 'Hyperparameters', hyperparameter_dict, steps)\n",
164 | " while steps <= max_steps:\n",
165 | " if env.global_done:\n",
166 | " info = env.reset(train_mode=train_model, progress=get_progress())[brain_name]\n",
167 | " # Decide and take an action\n",
168 | " new_info = trainer.take_action(info, env, brain_name, steps, normalize)\n",
169 | " info = new_info\n",
170 | " trainer.process_experiences(info, time_horizon, gamma, lambd)\n",
171 | " if len(trainer.training_buffer['actions']) > buffer_size and train_model:\n",
172 | " # Perform gradient descent with experience buffer\n",
173 | " trainer.update_model(batch_size, num_epoch)\n",
174 | " if steps % summary_freq == 0 and steps != 0 and train_model:\n",
175 | " # Write training statistics to tensorboard.\n",
176 | " trainer.write_summary(summary_writer, steps, env._curriculum.lesson_number)\n",
177 | " if steps % save_freq == 0 and steps != 0 and train_model:\n",
178 | " # Save Tensorflow model\n",
179 | " save_model(sess, model_path=model_path, steps=steps, saver=saver)\n",
180 | " steps += 1\n",
181 | " sess.run(ppo_model.increment_step)\n",
182 | " if len(trainer.stats['cumulative_reward']) > 0:\n",
183 | " mean_reward = np.mean(trainer.stats['cumulative_reward'])\n",
184 | " sess.run(ppo_model.update_reward, feed_dict={ppo_model.new_reward: mean_reward})\n",
185 | " # Final save Tensorflow model\n",
186 | " if steps != 0 and train_model:\n",
187 | " save_model(sess, model_path=model_path, steps=steps, saver=saver)\n",
188 | "env.close()\n",
189 | "export_graph(model_path, env_name)"
190 | ]
191 | },
192 | {
193 | "cell_type": "code",
194 | "execution_count": null,
195 | "metadata": {
196 | "collapsed": true
197 | },
198 | "outputs": [],
199 | "source": [
200 | "env.close()"
201 | ]
202 | },
203 | {
204 | "cell_type": "markdown",
205 | "metadata": {},
206 | "source": [
207 | "### Export the trained Tensorflow graph\n",
208 | "Once the model has been trained and saved, we can export it as a .bytes file which Unity can embed."
209 | ]
210 | },
211 | {
212 | "cell_type": "code",
213 | "execution_count": null,
214 | "metadata": {},
215 | "outputs": [],
216 | "source": [
217 | "export_graph(model_path, env_name)"
218 | ]
219 | },
220 | {
221 | "cell_type": "code",
222 | "execution_count": null,
223 | "metadata": {
224 | "collapsed": true
225 | },
226 | "outputs": [],
227 | "source": []
228 | }
229 | ],
230 | "metadata": {
231 | "anaconda-cloud": {},
232 | "kernelspec": {
233 | "display_name": "tensorflow",
234 | "language": "python",
235 | "name": "tensorflow"
236 | },
237 | "language_info": {
238 | "codemirror_mode": {
239 | "name": "ipython",
240 | "version": 3
241 | },
242 | "file_extension": ".py",
243 | "mimetype": "text/x-python",
244 | "name": "python",
245 | "nbconvert_exporter": "python",
246 | "pygments_lexer": "ipython3",
247 | "version": "3.5.4"
248 | }
249 | },
250 | "nbformat": 4,
251 | "nbformat_minor": 1
252 | }
253 |
--------------------------------------------------------------------------------
/python/jump.json:
--------------------------------------------------------------------------------
1 | {
2 | "measure" : "reward",
3 | "thresholds" : [2,3,2,3,2,3,2,3,2,3,2,3,2,3,2],
4 | "min_lesson_length" : 2,
5 | "signal_smoothing" : true,
6 | "parameters" :
7 | {
8 | "max_distance" : [1.2,1.2,1.2,1.2,1.5,1.5,1.5,1.5,2,2,2,2,3,3,3,3],
9 | "min_scale" : [1,1,0.5,0.5,1,1,0.5,0.5,1,1,0.5,0.5,1,1,0.5,0.5],
10 | "random_direction":[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/python/jump2.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Unity ML Agents\n",
8 | "## Proximal Policy Optimization (PPO)\n",
9 | "Contains an implementation of PPO as described [here](https://arxiv.org/abs/1707.06347)."
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {
16 | "collapsed": true
17 | },
18 | "outputs": [],
19 | "source": [
20 | "import numpy as np\n",
21 | "import os\n",
22 | "import tensorflow as tf\n",
23 | "\n",
24 | "from ppo.history import *\n",
25 | "from ppo.models import *\n",
26 | "from ppo.trainer import Trainer\n",
27 | "from unityagents import *"
28 | ]
29 | },
30 | {
31 | "cell_type": "markdown",
32 | "metadata": {},
33 | "source": [
34 | "### Hyperparameters"
35 | ]
36 | },
37 | {
38 | "cell_type": "code",
39 | "execution_count": null,
40 | "metadata": {
41 | "collapsed": true
42 | },
43 | "outputs": [],
44 | "source": [
45 | "### General parameters\n",
46 | "max_steps = 1e7 # Set maximum number of steps to run environment.\n",
47 | "run_path = \"jump2\" # The sub-directory name for model and summary statistics\n",
48 | "load_model = True # Whether to load a saved model.\n",
49 | "train_model = True # Whether to train the model.\n",
50 | "summary_freq = 10000 # Frequency at which to save training statistics.\n",
51 | "save_freq = 10000 # Frequency at which to save model.\n",
52 | "env_name = \"build2/jump.exe\" # Name of the training environment file.\n",
53 | "curriculum_file = \"jump2.json\"\n",
54 | "\n",
55 | "### Algorithm-specific parameters for tuning\n",
56 | "gamma = 0.99 # Reward discount rate.\n",
57 | "lambd = 0.95 # Lambda parameter for GAE.\n",
58 | "time_horizon = 2048 # How many steps to collect per agent before adding to buffer.\n",
59 | "beta = 1e-3 # Strength of entropy regularization\n",
60 | "num_epoch = 5 # Number of gradient descent steps per batch of experiences.\n",
61 | "num_layers = 1 # Number of hidden layers between state/observation encoding and value/policy layers.\n",
62 | "epsilon = 0.2 # Acceptable threshold around ratio of old and new policy probabilities.\n",
63 | "buffer_size = 2048 # How large the experience buffer should be before gradient descent.\n",
64 | "learning_rate = 3e-4 # Model learning rate.\n",
65 | "hidden_units = 32 # Number of units in hidden layer.\n",
66 | "batch_size = 512 # How many experiences per gradient descent update step.\n",
67 | "normalize = True\n",
68 | "\n",
69 | "### Logging dictionary for hyperparameters\n",
70 | "hyperparameter_dict = {'max_steps':max_steps, 'run_path':run_path, 'env_name':env_name,\n",
71 | " 'curriculum_file':curriculum_file, 'gamma':gamma, 'lambd':lambd, 'time_horizon':time_horizon,\n",
72 | " 'beta':beta, 'num_epoch':num_epoch, 'epsilon':epsilon, 'buffe_size':buffer_size,\n",
73 | " 'leaning_rate':learning_rate, 'hidden_units':hidden_units, 'batch_size':batch_size}"
74 | ]
75 | },
76 | {
77 | "cell_type": "markdown",
78 | "metadata": {},
79 | "source": [
80 | "### Load the environment"
81 | ]
82 | },
83 | {
84 | "cell_type": "code",
85 | "execution_count": null,
86 | "metadata": {
87 | "scrolled": true
88 | },
89 | "outputs": [],
90 | "source": [
91 | "env = UnityEnvironment(file_name=env_name, curriculum=curriculum_file)\n",
92 | "print(str(env))\n",
93 | "brain_name = env.external_brain_names[0]"
94 | ]
95 | },
96 | {
97 | "cell_type": "markdown",
98 | "metadata": {},
99 | "source": [
100 | "### Train the Agent(s)"
101 | ]
102 | },
103 | {
104 | "cell_type": "code",
105 | "execution_count": null,
106 | "metadata": {
107 | "scrolled": true
108 | },
109 | "outputs": [],
110 | "source": [
111 | "tf.reset_default_graph()\n",
112 | "\n",
113 | "if curriculum_file == \"None\":\n",
114 | " curriculum_file = None\n",
115 | "\n",
116 | "\n",
117 | "def get_progress():\n",
118 | " if curriculum_file is not None:\n",
119 | " if env._curriculum.measure_type == \"progress\":\n",
120 | " return steps / max_steps\n",
121 | " elif env._curriculum.measure_type == \"reward\":\n",
122 | " return last_reward\n",
123 | " else:\n",
124 | " return None\n",
125 | " else:\n",
126 | " return None\n",
127 | "\n",
128 | "# Create the Tensorflow model graph\n",
129 | "ppo_model = create_agent_model(env, lr=learning_rate,\n",
130 | " h_size=hidden_units, epsilon=epsilon,\n",
131 | " beta=beta, max_step=max_steps, \n",
132 | " normalize=normalize, num_layers=num_layers)\n",
133 | "\n",
134 | "is_continuous = (env.brains[brain_name].action_space_type == \"continuous\")\n",
135 | "use_observations = (env.brains[brain_name].number_observations > 0)\n",
136 | "use_states = (env.brains[brain_name].state_space_size > 0)\n",
137 | "\n",
138 | "model_path = './models/{}'.format(run_path)\n",
139 | "summary_path = './summaries/{}'.format(run_path)\n",
140 | "\n",
141 | "if not os.path.exists(model_path):\n",
142 | " os.makedirs(model_path)\n",
143 | "\n",
144 | "if not os.path.exists(summary_path):\n",
145 | " os.makedirs(summary_path)\n",
146 | "\n",
147 | "init = tf.global_variables_initializer()\n",
148 | "saver = tf.train.Saver()\n",
149 | "\n",
150 | "with tf.Session() as sess:\n",
151 | " # Instantiate model parameters\n",
152 | " if load_model:\n",
153 | " print('Loading Model...')\n",
154 | " ckpt = tf.train.get_checkpoint_state(model_path)\n",
155 | " saver.restore(sess, ckpt.model_checkpoint_path)\n",
156 | " else:\n",
157 | " sess.run(init)\n",
158 | " steps, last_reward = sess.run([ppo_model.global_step, ppo_model.last_reward]) \n",
159 | " summary_writer = tf.summary.FileWriter(summary_path)\n",
160 | " info = env.reset(train_mode=train_model, progress=get_progress())[brain_name]\n",
161 | " trainer = Trainer(ppo_model, sess, info, is_continuous, use_observations, use_states, train_model)\n",
162 | " if train_model:\n",
163 | " trainer.write_text(summary_writer, 'Hyperparameters', hyperparameter_dict, steps)\n",
164 | " while steps <= max_steps:\n",
165 | " if env.global_done:\n",
166 | " info = env.reset(train_mode=train_model, progress=get_progress())[brain_name]\n",
167 | " # Decide and take an action\n",
168 | " new_info = trainer.take_action(info, env, brain_name, steps, normalize)\n",
169 | " info = new_info\n",
170 | " trainer.process_experiences(info, time_horizon, gamma, lambd)\n",
171 | " if len(trainer.training_buffer['actions']) > buffer_size and train_model:\n",
172 | " # Perform gradient descent with experience buffer\n",
173 | " trainer.update_model(batch_size, num_epoch)\n",
174 | " if steps % summary_freq == 0 and steps != 0 and train_model:\n",
175 | " # Write training statistics to tensorboard.\n",
176 | " trainer.write_summary(summary_writer, steps, env._curriculum.lesson_number)\n",
177 | " if steps % save_freq == 0 and steps != 0 and train_model:\n",
178 | " # Save Tensorflow model\n",
179 | " save_model(sess, model_path=model_path, steps=steps, saver=saver)\n",
180 | " steps += 1\n",
181 | " sess.run(ppo_model.increment_step)\n",
182 | " if len(trainer.stats['cumulative_reward']) > 0:\n",
183 | " mean_reward = np.mean(trainer.stats['cumulative_reward'])\n",
184 | " sess.run(ppo_model.update_reward, feed_dict={ppo_model.new_reward: mean_reward})\n",
185 | " last_reward = sess.run(ppo_model.last_reward)\n",
186 | " # Final save Tensorflow model\n",
187 | " if steps != 0 and train_model:\n",
188 | " save_model(sess, model_path=model_path, steps=steps, saver=saver)\n",
189 | "env.close()\n",
190 | "export_graph(model_path, env_name)"
191 | ]
192 | },
193 | {
194 | "cell_type": "code",
195 | "execution_count": null,
196 | "metadata": {
197 | "collapsed": true
198 | },
199 | "outputs": [],
200 | "source": [
201 | "env.close()"
202 | ]
203 | },
204 | {
205 | "cell_type": "markdown",
206 | "metadata": {},
207 | "source": [
208 | "### Export the trained Tensorflow graph\n",
209 | "Once the model has been trained and saved, we can export it as a .bytes file which Unity can embed."
210 | ]
211 | },
212 | {
213 | "cell_type": "code",
214 | "execution_count": null,
215 | "metadata": {
216 | "collapsed": true
217 | },
218 | "outputs": [],
219 | "source": [
220 | "export_graph(model_path, env_name)"
221 | ]
222 | }
223 | ],
224 | "metadata": {
225 | "anaconda-cloud": {},
226 | "kernelspec": {
227 | "display_name": "tensorflow",
228 | "language": "python",
229 | "name": "tensorflow"
230 | },
231 | "language_info": {
232 | "codemirror_mode": {
233 | "name": "ipython",
234 | "version": 3
235 | },
236 | "file_extension": ".py",
237 | "mimetype": "text/x-python",
238 | "name": "python",
239 | "nbconvert_exporter": "python",
240 | "pygments_lexer": "ipython3",
241 | "version": "3.5.4"
242 | }
243 | },
244 | "nbformat": 4,
245 | "nbformat_minor": 1
246 | }
247 |
--------------------------------------------------------------------------------
/python/jump2.json:
--------------------------------------------------------------------------------
1 | {
2 | "measure" : "reward",
3 | "thresholds" : [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],
4 | "min_lesson_length" : 2,
5 | "signal_smoothing" : true,
6 | "parameters" :
7 | {
8 | "max_distance" : [1.2,1.2,1.2,1.2,1.5,1.5,1.5,1.5,2,2,2,2,3,3,3,3],
9 | "min_scale" : [1,0.9,0.7,0.5,1,0.9,0.7,0.5,1,0.9,0.7,0.5,1,0.9,0.7,0.5],
10 | "random_direction":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/python/jump3.json:
--------------------------------------------------------------------------------
1 | {
2 | "measure" : "reward",
3 | "thresholds" : [5,5,5],
4 | "min_lesson_length" : 2,
5 | "signal_smoothing" : true,
6 | "parameters" :
7 | {
8 | "max_distance" : [3,3,3,3],
9 | "min_scale" : [1,0.9,0.7,0.5],
10 | "random_direction":[0,0,0,0]
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/python/models/jump4/build3/jump.exe.bytes:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/python/models/jump4/build3/jump.exe.bytes
--------------------------------------------------------------------------------
/python/models/jump4/checkpoint:
--------------------------------------------------------------------------------
1 | model_checkpoint_path: "model-378000.cptk"
2 | all_model_checkpoint_paths: "model-377000.cptk"
3 | all_model_checkpoint_paths: "model-378000.cptk"
4 |
--------------------------------------------------------------------------------
/python/models/jump4/model-377000.cptk.data-00000-of-00001:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/python/models/jump4/model-377000.cptk.data-00000-of-00001
--------------------------------------------------------------------------------
/python/models/jump4/model-377000.cptk.index:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/python/models/jump4/model-377000.cptk.index
--------------------------------------------------------------------------------
/python/models/jump4/model-377000.cptk.meta:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/python/models/jump4/model-377000.cptk.meta
--------------------------------------------------------------------------------
/python/models/jump4/model-378000.cptk.data-00000-of-00001:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/python/models/jump4/model-378000.cptk.data-00000-of-00001
--------------------------------------------------------------------------------
/python/models/jump4/model-378000.cptk.index:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/python/models/jump4/model-378000.cptk.index
--------------------------------------------------------------------------------
/python/models/jump4/model-378000.cptk.meta:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/python/models/jump4/model-378000.cptk.meta
--------------------------------------------------------------------------------
/python/models/jump4/raw_graph_def.pb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/python/models/jump4/raw_graph_def.pb
--------------------------------------------------------------------------------
/python/ppo.py:
--------------------------------------------------------------------------------
1 | # # Unity ML Agents
2 | # ## Proximal Policy Optimization (PPO)
3 | # Contains an implementation of PPO as described [here](https://arxiv.org/abs/1707.06347).
4 |
5 | from docopt import docopt
6 |
7 | import os
8 | from ppo.models import *
9 | from ppo.trainer import Trainer
10 | from unityagents import UnityEnvironment
11 |
12 | _USAGE = '''
13 | Usage:
14 | ppo () [options]
15 |
16 | Options:
17 | --help Show this message.
18 | --batch-size= How many experiences per gradient descent update step [default: 64].
19 | --beta= Strength of entropy regularization [default: 2.5e-3].
20 | --buffer-size= How large the experience buffer should be before gradient descent [default: 2048].
21 | --curriculum= Curriculum json file for environment [default: None].
22 | --epsilon= Acceptable threshold around ratio of old and new policy probabilities [default: 0.2].
23 | --gamma= Reward discount rate [default: 0.99].
24 | --hidden-units= Number of units in hidden layer [default: 64].
25 | --keep-checkpoints= How many model checkpoints to keep [default: 5].
26 | --lambd= Lambda parameter for GAE [default: 0.95].
27 | --learning-rate= Model learning rate [default: 3e-4].
28 | --load Whether to load the model or randomly initialize [default: False].
29 | --max-steps= Maximum number of steps to run environment [default: 1e6].
30 | --normalize Whether to normalize the state input using running statistics [default: False].
31 | --num-epoch= Number of gradient descent steps per batch of experiences [default: 5].
32 | --num-layers= Number of hidden layers between state/observation and outputs [default: 2].
33 | --run-path= The sub-directory name for model and summary statistics [default: ppo].
34 | --save-freq= Frequency at which to save model [default: 50000].
35 | --summary-freq= Frequency at which to save training statistics [default: 10000].
36 | --time-horizon= How many steps to collect per agent before adding to buffer [default: 2048].
37 | --train Whether to train model, or only run inference [default: False].
38 | --worker-id= Number to add to communication port (5005). Used for multi-environment [default: 0].
39 | '''
40 |
41 | options = docopt(_USAGE)
42 | print(options)
43 |
44 | # General parameters
45 | max_steps = float(options['--max-steps'])
46 | model_path = './models/{}'.format(str(options['--run-path']))
47 | summary_path = './summaries/{}'.format(str(options['--run-path']))
48 | load_model = options['--load']
49 | train_model = options['--train']
50 | summary_freq = int(options['--summary-freq'])
51 | save_freq = int(options['--save-freq'])
52 | env_name = options['']
53 | keep_checkpoints = int(options['--keep-checkpoints'])
54 | worker_id = int(options['--worker-id'])
55 | curriculum_file = str(options['--curriculum'])
56 | if curriculum_file == "None":
57 | curriculum_file = None
58 |
59 | # Algorithm-specific parameters for tuning
60 | gamma = float(options['--gamma'])
61 | lambd = float(options['--lambd'])
62 | time_horizon = int(options['--time-horizon'])
63 | beta = float(options['--beta'])
64 | num_epoch = int(options['--num-epoch'])
65 | num_layers = int(options['--num-layers'])
66 | epsilon = float(options['--epsilon'])
67 | buffer_size = int(options['--buffer-size'])
68 | learning_rate = float(options['--learning-rate'])
69 | hidden_units = int(options['--hidden-units'])
70 | batch_size = int(options['--batch-size'])
71 | normalize = options['--normalize']
72 |
73 | env = UnityEnvironment(file_name=env_name, worker_id=worker_id, curriculum=curriculum_file)
74 | print(str(env))
75 | brain_name = env.external_brain_names[0]
76 |
77 | tf.reset_default_graph()
78 |
79 | # Create the Tensorflow model graph
80 | ppo_model = create_agent_model(env, lr=learning_rate,
81 | h_size=hidden_units, epsilon=epsilon,
82 | beta=beta, max_step=max_steps,
83 | normalize=normalize, num_layers=num_layers)
84 |
85 | is_continuous = (env.brains[brain_name].action_space_type == "continuous")
86 | use_observations = (env.brains[brain_name].number_observations > 0)
87 | use_states = (env.brains[brain_name].state_space_size > 0)
88 |
89 | if not os.path.exists(model_path):
90 | os.makedirs(model_path)
91 |
92 | if not os.path.exists(summary_path):
93 | os.makedirs(summary_path)
94 |
95 | init = tf.global_variables_initializer()
96 | saver = tf.train.Saver(max_to_keep=keep_checkpoints)
97 |
98 |
99 | def get_progress():
100 | if curriculum_file is not None:
101 | if env._curriculum.measure_type == "progress":
102 | return steps / max_steps
103 | elif env._curriculum.measure_type == "reward":
104 | return last_reward
105 | else:
106 | return None
107 | else:
108 | return None
109 |
110 | config = tf.ConfigProto()
111 | config.gpu_options.allow_growth = True
112 | with tf.Session(config=config) as sess:
113 | # Instantiate model parameters
114 | if load_model:
115 | print('Loading Model...')
116 | ckpt = tf.train.get_checkpoint_state(model_path)
117 | if ckpt == None:
118 | print('The model {0} could not be found. Make sure you specified the right '
119 | '--run-path'.format(model_path))
120 | saver.restore(sess, ckpt.model_checkpoint_path)
121 | else:
122 | sess.run(init)
123 | steps, last_reward = sess.run([ppo_model.global_step, ppo_model.last_reward])
124 | summary_writer = tf.summary.FileWriter(summary_path)
125 | info = env.reset(train_mode=train_model, progress=get_progress())[brain_name]
126 | trainer = Trainer(ppo_model, sess, info, is_continuous, use_observations, use_states, train_model)
127 | if train_model:
128 | trainer.write_text(summary_writer, 'Hyperparameters', options, steps)
129 | while steps <= max_steps or not train_model:
130 | if env.global_done:
131 | info = env.reset(train_mode=train_model, progress=get_progress())[brain_name]
132 | trainer.reset_buffers(info, total=True)
133 | # Decide and take an action
134 | new_info = trainer.take_action(info, env, brain_name, steps, normalize)
135 | info = new_info
136 | trainer.process_experiences(info, time_horizon, gamma, lambd)
137 | if len(trainer.training_buffer['actions']) > buffer_size and train_model:
138 | # Perform gradient descent with experience buffer
139 | trainer.update_model(batch_size, num_epoch)
140 | if steps % summary_freq == 0 and steps != 0 and train_model:
141 | # Write training statistics to tensorboard.
142 | trainer.write_summary(summary_writer, steps, env._curriculum.lesson_number)
143 | if steps % save_freq == 0 and steps != 0 and train_model:
144 | # Save Tensorflow model
145 | save_model(sess, model_path=model_path, steps=steps, saver=saver)
146 | if train_model:
147 | steps += 1
148 | sess.run(ppo_model.increment_step)
149 | if len(trainer.stats['cumulative_reward']) > 0:
150 | mean_reward = np.mean(trainer.stats['cumulative_reward'])
151 | sess.run(ppo_model.update_reward, feed_dict={ppo_model.new_reward: mean_reward})
152 | last_reward = sess.run(ppo_model.last_reward)
153 | # Final save Tensorflow model
154 | if steps != 0 and train_model:
155 | save_model(sess, model_path=model_path, steps=steps, saver=saver)
156 | env.close()
157 | graph_name = (env_name.strip()
158 | .replace('.app', '').replace('.exe', '').replace('.x86_64', '').replace('.x86', ''))
159 | graph_name = os.path.basename(os.path.normpath(graph_name))
160 | export_graph(model_path, graph_name)
161 |
--------------------------------------------------------------------------------
/python/ppo/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/python/ppo/__init__.py
--------------------------------------------------------------------------------
/python/ppo/history.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 |
3 | history_keys = ['states', 'actions', 'rewards', 'action_probs', 'epsilons',
4 | 'value_estimates', 'advantages', 'discounted_returns']
5 |
6 |
7 | def discount_rewards(r, gamma=0.99, value_next=0.0):
8 | """
9 | Computes discounted sum of future rewards for use in updating value estimate.
10 | :param r: List of rewards.
11 | :param gamma: Discount factor.
12 | :param value_next: T+1 value estimate for returns calculation.
13 | :return: discounted sum of future rewards as list.
14 | """
15 | discounted_r = np.zeros_like(r)
16 | running_add = value_next
17 | for t in reversed(range(0, r.size)):
18 | running_add = running_add * gamma + r[t]
19 | discounted_r[t] = running_add
20 | return discounted_r
21 |
22 |
23 | def get_gae(rewards, value_estimates, value_next=0.0, gamma=0.99, lambd=0.95):
24 | """
25 | Computes generalized advantage estimate for use in updating policy.
26 | :param rewards: list of rewards for time-steps t to T.
27 | :param value_next: Value estimate for time-step T+1.
28 | :param value_estimates: list of value estimates for time-steps t to T.
29 | :param gamma: Discount factor.
30 | :param lambd: GAE weighing factor.
31 | :return: list of advantage estimates for time-steps t to T.
32 | """
33 | value_estimates = np.asarray(value_estimates.tolist() + [value_next])
34 | delta_t = rewards + gamma * value_estimates[1:] - value_estimates[:-1]
35 | advantage = discount_rewards(r=delta_t, gamma=gamma*lambd)
36 | return advantage
37 |
38 |
39 | def empty_local_history(agent_dict):
40 | """
41 | Empties the experience history for a single agent.
42 | :param agent_dict: Dictionary of agent experience history.
43 | :return: Emptied dictionary (except for cumulative_reward and episode_steps).
44 | """
45 | for key in history_keys:
46 | agent_dict[key] = []
47 | for i, _ in enumerate(key for key in agent_dict.keys() if key.startswith('observations')):
48 | agent_dict['observations%d' % i] = []
49 | return agent_dict
50 |
51 |
52 | def vectorize_history(agent_dict):
53 | """
54 | Converts dictionary of lists into dictionary of numpy arrays.
55 | :param agent_dict: Dictionary of agent experience history.
56 | :return: dictionary of numpy arrays.
57 | """
58 | for key in history_keys:
59 | agent_dict[key] = np.array(agent_dict[key])
60 | for key in (key for key in agent_dict.keys() if key.startswith('observations')):
61 | agent_dict[key] = np.array(agent_dict[key])
62 | return agent_dict
63 |
64 |
65 | def empty_all_history(agent_info):
66 | """
67 | Clears all agent histories and resets reward and episode length counters.
68 | :param agent_info: a BrainInfo object.
69 | :return: an emptied history dictionary.
70 | """
71 | history_dict = {}
72 | for agent in agent_info.agents:
73 | history_dict[agent] = {}
74 | history_dict[agent] = empty_local_history(history_dict[agent])
75 | history_dict[agent]['cumulative_reward'] = 0
76 | history_dict[agent]['episode_steps'] = 0
77 | for i, _ in enumerate(agent_info.observations):
78 | history_dict[agent]['observations%d' % i] = []
79 | return history_dict
80 |
81 |
82 | def append_history(global_buffer, local_buffer=None):
83 | """
84 | Appends agent experience history to global history buffer.
85 | :param global_buffer: Global buffer for all agents experiences.
86 | :param local_buffer: Local history for individual agents experiences.
87 | :return: Global buffer with new experiences added.
88 | """
89 | for key in history_keys:
90 | global_buffer[key] = np.concatenate([global_buffer[key], local_buffer[key]], axis=0)
91 | for key in (key for key in local_buffer.keys() if key.startswith('observations')):
92 | global_buffer[key] = np.concatenate([global_buffer[key], local_buffer[key]], axis=0)
93 | return global_buffer
94 |
95 |
96 | def set_history(global_buffer, local_buffer=None):
97 | """
98 | Creates new global_buffer from existing local_buffer
99 | :param global_buffer: Global buffer for all agents experiences.
100 | :param local_buffer: Local history for individual agents experiences.
101 | :return: Global buffer with new experiences.
102 | """
103 | for key in history_keys:
104 | global_buffer[key] = np.copy(local_buffer[key])
105 | for key in (key for key in local_buffer.keys() if key.startswith('observations')):
106 | global_buffer[key] = np.array(local_buffer[key])
107 | return global_buffer
108 |
109 |
110 | def shuffle_buffer(global_buffer):
111 | """
112 | Randomizes experiences in global_buffer
113 | :param global_buffer: training_buffer to randomize.
114 | :return: Randomized buffer
115 | """
116 | s = np.arange(global_buffer[history_keys[2]].shape[0])
117 | np.random.shuffle(s)
118 | for key in history_keys:
119 | if len(global_buffer[key]) > 0:
120 | global_buffer[key] = global_buffer[key][s]
121 | for key in (key for key in global_buffer.keys() if key.startswith('observations')):
122 | if len(global_buffer[key]) > 0:
123 | global_buffer[key] = global_buffer[key][s]
124 | return global_buffer
125 |
--------------------------------------------------------------------------------
/python/unityagents/__init__.py:
--------------------------------------------------------------------------------
1 | from .environment import *
2 | from .brain import *
3 | from .exception import *
4 | from .curriculum import *
5 |
--------------------------------------------------------------------------------
/python/unityagents/brain.py:
--------------------------------------------------------------------------------
1 | class BrainInfo:
2 | def __init__(self, observation, state, memory=None, reward=None, agents=None, local_done=None, action =None):
3 | """
4 | Describes experience at current step of all agents linked to a brain.
5 | """
6 | self.observations = observation
7 | self.states = state
8 | self.memories = memory
9 | self.rewards = reward
10 | self.local_done = local_done
11 | self.agents = agents
12 | self.previous_actions = action
13 |
14 |
15 | class BrainParameters:
16 | def __init__(self, brain_name, brain_param):
17 | """
18 | Contains all brain-specific parameters.
19 | :param brain_name: Name of brain.
20 | :param brain_param: Dictionary of brain parameters.
21 | """
22 | self.brain_name = brain_name
23 | self.state_space_size = brain_param["stateSize"]
24 | self.number_observations = len(brain_param["cameraResolutions"])
25 | self.camera_resolutions = brain_param["cameraResolutions"]
26 | self.action_space_size = brain_param["actionSize"]
27 | self.memory_space_size = brain_param["memorySize"]
28 | self.action_descriptions = brain_param["actionDescriptions"]
29 | self.action_space_type = ["discrete", "continuous"][brain_param["actionSpaceType"]]
30 | self.state_space_type = ["discrete", "continuous"][brain_param["stateSpaceType"]]
31 |
32 | def __str__(self):
33 | return '''Unity brain name: {0}
34 | Number of observations (per agent): {1}
35 | State space type: {2}
36 | State space size (per agent): {3}
37 | Action space type: {4}
38 | Action space size (per agent): {5}
39 | Memory space size (per agent): {6}
40 | Action descriptions: {7}'''.format(self.brain_name,
41 | str(self.number_observations), self.state_space_type,
42 | str(self.state_space_size), self.action_space_type,
43 | str(self.action_space_size),
44 | str(self.memory_space_size),
45 | ', '.join(self.action_descriptions))
46 |
--------------------------------------------------------------------------------
/python/unityagents/curriculum.py:
--------------------------------------------------------------------------------
1 | import json
2 | import numpy as np
3 |
4 | from .exception import UnityEnvironmentException
5 |
6 |
7 | class Curriculum(object):
8 | def __init__(self, location, default_reset_parameters):
9 | """
10 | Initializes a Curriculum object.
11 | :param location: Path to JSON defining curriculum.
12 | :param default_reset_parameters: Set of reset parameters for environment.
13 | """
14 | self.lesson_number = 0
15 | self.lesson_length = 0
16 | self.measure_type = None
17 | if location is None:
18 | self.data = None
19 | else:
20 | try:
21 | with open(location) as data_file:
22 | self.data = json.load(data_file)
23 | except FileNotFoundError:
24 | raise UnityEnvironmentException(
25 | "The file {0} could not be found.".format(location))
26 | except UnicodeDecodeError:
27 | raise UnityEnvironmentException("There was an error decoding {}".format(location))
28 | self.smoothing_value = 0
29 | for key in ['parameters', 'measure', 'thresholds',
30 | 'min_lesson_length', 'signal_smoothing']:
31 | if key not in self.data:
32 | raise UnityEnvironmentException("{0} does not contain a "
33 | "{1} field.".format(location, key))
34 | parameters = self.data['parameters']
35 | self.measure_type = self.data['measure']
36 | self.max_lesson_number = len(self.data['thresholds'])
37 | for key in parameters:
38 | if key not in default_reset_parameters:
39 | raise UnityEnvironmentException(
40 | "The parameter {0} in Curriculum {1} is not present in "
41 | "the Environment".format(key, location))
42 | for key in parameters:
43 | if len(parameters[key]) != self.max_lesson_number + 1:
44 | raise UnityEnvironmentException(
45 | "The parameter {0} in Curriculum {1} must have {2} values "
46 | "but {3} were found".format(key, location,
47 | self.max_lesson_number + 1, len(parameters[key])))
48 |
49 | @property
50 | def measure(self):
51 | return self.measure_type
52 |
53 | def get_lesson_number(self):
54 | return self.lesson_number
55 |
56 | def set_lesson_number(self, value):
57 | self.lesson_length = 0
58 | self.lesson_number = max(0, min(value, self.max_lesson_number))
59 |
60 | def get_lesson(self, progress):
61 | """
62 | Returns reset parameters which correspond to current lesson.
63 | :param progress: Measure of progress (either reward or percentage steps completed).
64 | :return: Dictionary containing reset parameters.
65 | """
66 | if self.data is None or progress is None:
67 | return {}
68 | if self.data["signal_smoothing"]:
69 | progress = self.smoothing_value * 0.25 + 0.75 * progress
70 | self.smoothing_value = progress
71 | self.lesson_length += 1
72 | if self.lesson_number < self.max_lesson_number:
73 | if ((progress > self.data['thresholds'][self.lesson_number]) and
74 | (self.lesson_length > self.data['min_lesson_length'])):
75 | self.lesson_length = 0
76 | self.lesson_number += 1
77 | config = {}
78 | parameters = self.data["parameters"]
79 | for key in parameters:
80 | config[key] = parameters[key][self.lesson_number]
81 | return config
82 |
--------------------------------------------------------------------------------
/python/unityagents/exception.py:
--------------------------------------------------------------------------------
1 | import logging
2 | logger = logging.getLogger("unityagents")
3 |
4 | class UnityEnvironmentException(Exception):
5 | """
6 | Related to errors starting and closing environment.
7 | """
8 | pass
9 |
10 |
11 | class UnityActionException(Exception):
12 | """
13 | Related to errors with sending actions.
14 | """
15 | pass
16 |
17 | class UnityTimeOutException(Exception):
18 | """
19 | Related to errors with communication timeouts.
20 | """
21 | def __init__(self, message, log_file_path = None):
22 | if log_file_path is not None:
23 | try:
24 | with open(log_file_path, "r") as f:
25 | printing = False
26 | unity_error = '\n'
27 | for l in f:
28 | l=l.strip()
29 | if (l == 'Exception') or (l=='Error'):
30 | printing = True
31 | unity_error += '----------------------\n'
32 | if (l == ''):
33 | printing = False
34 | if printing:
35 | unity_error += l + '\n'
36 | logger.info(unity_error)
37 | logger.error("An error might have occured in the environment. "
38 | "You can check the logfile for more information at {}".format(log_file_path))
39 | except:
40 | logger.error("An error might have occured in the environment. "
41 | "No unity-environment.log file could be found.")
42 | super(UnityTimeOutException, self).__init__(message)
43 |
44 |
--------------------------------------------------------------------------------
/training.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/training.gif
--------------------------------------------------------------------------------
/关注“洪流学堂”公众号,让你快人几步.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaZhi/unity-jumpjump-ml-agents/a7afa5fdcbc4f38a2060b636677055a749a2606f/关注“洪流学堂”公众号,让你快人几步.jpg
--------------------------------------------------------------------------------