62 lines
1.5 KiB
Plaintext
62 lines
1.5 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from mlagents_envs.environment import UnityEnvironment\n",
|
|
"from gym_unity.envs import UnityToGymWrapper\n",
|
|
"\n",
|
|
"ENV_PATH = \"../Build-CloseEnemyCut/Aimbot-PPO\"\n",
|
|
"WORKER_ID = 2\n",
|
|
"BASE_PORT = 2002\n",
|
|
"\n",
|
|
"def main():\n",
|
|
" unity_env = UnityEnvironment(file_name=ENV_PATH,seed = 1,side_channels=[],worker_id = WORKER_ID,base_port=BASE_PORT)\n",
|
|
" env = UnityToGymWrapper(unity_env, uint8_visual=True,allow_multiple_obs=True)\n",
|
|
" env.reset()\n",
|
|
" for _ in range(1000):\n",
|
|
" env.render()\n",
|
|
" o,r,d,_ = env.step(env.action_space.sample()) #random action\n",
|
|
" if d:\n",
|
|
" env.reset()\n",
|
|
" env.close() \n",
|
|
" \n",
|
|
"\n",
|
|
"\n",
|
|
"if __name__ == '__main__':\n",
|
|
" main()"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3.9.7 64-bit",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.9.7"
|
|
},
|
|
"orig_nbformat": 4,
|
|
"vscode": {
|
|
"interpreter": {
|
|
"hash": "86e2db13b09bd6be22cb599ea60c1572b9ef36ebeaa27a4c8e961d6df315ac32"
|
|
}
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|