Datasets:
Formats:
imagefolder
Size:
< 1K
Commit
•
7b240d2
1
Parent(s):
7631ff2
Upload folder using huggingface_hub
Browse files- AIController3D.gd +45 -0
- FlyBy.csproj +1 -1
- FlyBy.csproj.old +1 -1
- FlyBy.gd +5 -13
- FlyBy.tscn +22 -6
- Goal.tscn +11 -11
- Plane.gd +39 -113
- Plane.tscn +8 -3
- PlaneModel.gd +0 -8
- addons/godot_rl_agents/controller/ai_controller_2d.gd +76 -2
- addons/godot_rl_agents/controller/ai_controller_3d.gd +74 -2
- addons/godot_rl_agents/onnx/csharp/ONNXInference.cs +85 -75
- addons/godot_rl_agents/onnx/csharp/SessionConfigurator.cs +121 -96
- addons/godot_rl_agents/onnx/wrapper/ONNX_wrapper.gd +6 -1
- addons/godot_rl_agents/sensors/sensors_2d/ExampleRaycastSensor2D.tscn +1 -1
- addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd +7 -3
- addons/godot_rl_agents/sync.gd +15 -13
- alps_field_2k.hdr.import +7 -6
- bin/FlyBy.console.exe +0 -0
- bin/FlyBy.exe +2 -2
- bin/FlyBy.pck +2 -2
- bin/FlyBy.x86_64 +2 -2
- concrete_wall_004_ao_1k.jpg.import +9 -8
- concrete_wall_004_arm_1k.jpg.import +7 -6
- concrete_wall_004_diff_1k.jpg.import +7 -6
- concrete_wall_004_nor_gl_1k.jpg.import +10 -9
- project.godot +2 -2
AIController3D.gd
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends AIController3D
|
2 |
+
|
3 |
+
|
4 |
+
func get_obs():
|
5 |
+
if _player.cur_goal == null:
|
6 |
+
_player.game_over()
|
7 |
+
var goal_vector = to_local(_player.cur_goal.position)
|
8 |
+
var goal_distance = goal_vector.length()
|
9 |
+
goal_vector = goal_vector.normalized()
|
10 |
+
goal_distance = clamp(goal_distance, 0.0, 50.0)
|
11 |
+
|
12 |
+
var next_goal = _player.environment.get_next_goal(_player.cur_goal)
|
13 |
+
var next_goal_vector = to_local(next_goal.position)
|
14 |
+
var next_goal_distance = next_goal_vector.length()
|
15 |
+
next_goal_vector = next_goal_vector.normalized()
|
16 |
+
next_goal_distance = clamp(next_goal_distance, 0.0, 50.0)
|
17 |
+
|
18 |
+
var obs = [
|
19 |
+
goal_vector.x,
|
20 |
+
goal_vector.y,
|
21 |
+
goal_vector.z,
|
22 |
+
goal_distance / 50.0,
|
23 |
+
next_goal_vector.x,
|
24 |
+
next_goal_vector.y,
|
25 |
+
next_goal_vector.z,
|
26 |
+
next_goal_distance / 50.0
|
27 |
+
]
|
28 |
+
|
29 |
+
return {"obs": obs}
|
30 |
+
|
31 |
+
|
32 |
+
func get_action_space():
|
33 |
+
return {
|
34 |
+
"pitch": {"size": 1, "action_type": "continuous"},
|
35 |
+
"turn": {"size": 1, "action_type": "continuous"}
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
func set_action(action):
|
40 |
+
_player.turn_input = action["turn"][0]
|
41 |
+
_player.pitch_input = action["pitch"][0]
|
42 |
+
|
43 |
+
|
44 |
+
func get_reward():
|
45 |
+
return reward
|
FlyBy.csproj
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<Project Sdk="Godot.NET.Sdk/4.
|
2 |
<PropertyGroup>
|
3 |
<TargetFramework>net6.0</TargetFramework>
|
4 |
<EnableDynamicLoading>true</EnableDynamicLoading>
|
|
|
1 |
+
<Project Sdk="Godot.NET.Sdk/4.2.1">
|
2 |
<PropertyGroup>
|
3 |
<TargetFramework>net6.0</TargetFramework>
|
4 |
<EnableDynamicLoading>true</EnableDynamicLoading>
|
FlyBy.csproj.old
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<Project Sdk="Godot.NET.Sdk/4.
|
2 |
<PropertyGroup>
|
3 |
<TargetFramework>net6.0</TargetFramework>
|
4 |
<EnableDynamicLoading>true</EnableDynamicLoading>
|
|
|
1 |
+
<Project Sdk="Godot.NET.Sdk/4.1.3">
|
2 |
<PropertyGroup>
|
3 |
<TargetFramework>net6.0</TargetFramework>
|
4 |
<EnableDynamicLoading>true</EnableDynamicLoading>
|
FlyBy.gd
CHANGED
@@ -1,15 +1,12 @@
|
|
1 |
extends Node3D
|
2 |
|
3 |
-
|
4 |
-
# Declare member variables here. Examples:
|
5 |
-
# var a = 2
|
6 |
-
# var b = "text"
|
7 |
var goals = null
|
8 |
|
|
|
9 |
# Called when the node enters the scene tree for the first time.
|
10 |
func _ready():
|
11 |
goals = $Goals.get_children()
|
12 |
-
|
13 |
|
14 |
func get_next_goal(current_goal):
|
15 |
if current_goal == null:
|
@@ -17,16 +14,11 @@ func get_next_goal(current_goal):
|
|
17 |
var index = null
|
18 |
for i in len(goals):
|
19 |
if goals[i] == current_goal:
|
20 |
-
index = (i+1) % len(goals)
|
21 |
break
|
22 |
-
|
23 |
return goals[index]
|
24 |
|
|
|
25 |
func get_last_goal():
|
26 |
return goals[-1]
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
31 |
-
#func _process(delta):
|
32 |
-
# pass
|
|
|
1 |
extends Node3D
|
2 |
|
|
|
|
|
|
|
|
|
3 |
var goals = null
|
4 |
|
5 |
+
|
6 |
# Called when the node enters the scene tree for the first time.
|
7 |
func _ready():
|
8 |
goals = $Goals.get_children()
|
9 |
+
|
10 |
|
11 |
func get_next_goal(current_goal):
|
12 |
if current_goal == null:
|
|
|
14 |
var index = null
|
15 |
for i in len(goals):
|
16 |
if goals[i] == current_goal:
|
17 |
+
index = (i + 1) % len(goals)
|
18 |
break
|
19 |
+
|
20 |
return goals[index]
|
21 |
|
22 |
+
|
23 |
func get_last_goal():
|
24 |
return goals[-1]
|
|
|
|
|
|
|
|
|
|
|
|
FlyBy.tscn
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
|
3 |
[ext_resource type="Script" path="res://addons/godot_rl_agents/sync.gd" id="1"]
|
4 |
[ext_resource type="Script" path="res://GameArea.gd" id="2"]
|
5 |
-
[ext_resource type="Texture2D" uid="uid://
|
6 |
-
[ext_resource type="PackedScene" path="res://Goal.tscn" id="3"]
|
7 |
[ext_resource type="Script" path="res://FlyBy.gd" id="4"]
|
8 |
[ext_resource type="PackedScene" uid="uid://3xxv82w5v8bo" path="res://Plane.tscn" id="5"]
|
9 |
-
[ext_resource type="Texture2D" uid="uid://
|
10 |
-
[ext_resource type="Texture2D" uid="uid://
|
11 |
-
[ext_resource type="Texture2D" uid="uid://
|
12 |
-
[ext_resource type="Texture2D" uid="uid://
|
13 |
|
14 |
[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_88xh0"]
|
15 |
panorama = ExtResource("2_retnu")
|
@@ -229,51 +229,67 @@ script = ExtResource("1")
|
|
229 |
|
230 |
[node name="Plane" parent="." instance=ExtResource("5")]
|
231 |
transform = Transform3D(-0.372224, 0.0145406, -0.928029, 0, 0.999877, 0.0156663, 0.928143, 0.00583138, -0.372178, -111.001, 77.3255, -109.24)
|
|
|
232 |
|
233 |
[node name="Plane2" parent="." instance=ExtResource("5")]
|
234 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
|
|
235 |
|
236 |
[node name="Plane3" parent="." instance=ExtResource("5")]
|
237 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
|
|
238 |
|
239 |
[node name="Plane4" parent="." instance=ExtResource("5")]
|
240 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
|
|
241 |
|
242 |
[node name="Plane5" parent="." instance=ExtResource("5")]
|
243 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
|
|
244 |
|
245 |
[node name="Plane6" parent="." instance=ExtResource("5")]
|
246 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
|
|
247 |
|
248 |
[node name="Plane7" parent="." instance=ExtResource("5")]
|
249 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
|
|
250 |
|
251 |
[node name="Plane8" parent="." instance=ExtResource("5")]
|
252 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
|
|
253 |
|
254 |
[node name="Plane9" parent="." instance=ExtResource("5")]
|
255 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
|
|
256 |
|
257 |
[node name="Plane10" parent="." instance=ExtResource("5")]
|
258 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
|
|
259 |
|
260 |
[node name="Plane11" parent="." instance=ExtResource("5")]
|
261 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
|
|
262 |
|
263 |
[node name="Plane12" parent="." instance=ExtResource("5")]
|
264 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
|
|
265 |
|
266 |
[node name="Plane13" parent="." instance=ExtResource("5")]
|
267 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
|
|
268 |
|
269 |
[node name="Plane14" parent="." instance=ExtResource("5")]
|
270 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
|
|
271 |
|
272 |
[node name="Plane15" parent="." instance=ExtResource("5")]
|
273 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 14, 27, -1)
|
|
|
274 |
|
275 |
[node name="Plane16" parent="." instance=ExtResource("5")]
|
276 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 14, 27, -1)
|
|
|
277 |
|
278 |
[node name="Walls" type="Node" parent="."]
|
279 |
|
|
|
2 |
|
3 |
[ext_resource type="Script" path="res://addons/godot_rl_agents/sync.gd" id="1"]
|
4 |
[ext_resource type="Script" path="res://GameArea.gd" id="2"]
|
5 |
+
[ext_resource type="Texture2D" uid="uid://cc7fd3cl63ky1" path="res://alps_field_2k.hdr" id="2_retnu"]
|
6 |
+
[ext_resource type="PackedScene" uid="uid://bjx0dykb8q6kf" path="res://Goal.tscn" id="3"]
|
7 |
[ext_resource type="Script" path="res://FlyBy.gd" id="4"]
|
8 |
[ext_resource type="PackedScene" uid="uid://3xxv82w5v8bo" path="res://Plane.tscn" id="5"]
|
9 |
+
[ext_resource type="Texture2D" uid="uid://bddbiy7gwtdyh" path="res://concrete_wall_004_diff_1k.jpg" id="7_mnp35"]
|
10 |
+
[ext_resource type="Texture2D" uid="uid://bj56jsr1idhhk" path="res://concrete_wall_004_ao_1k.jpg" id="8_mhe64"]
|
11 |
+
[ext_resource type="Texture2D" uid="uid://ow81638q14o" path="res://concrete_wall_004_arm_1k.jpg" id="9_1x60u"]
|
12 |
+
[ext_resource type="Texture2D" uid="uid://drkdgeq22xo2f" path="res://concrete_wall_004_nor_gl_1k.jpg" id="10_x6htc"]
|
13 |
|
14 |
[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_88xh0"]
|
15 |
panorama = ExtResource("2_retnu")
|
|
|
229 |
|
230 |
[node name="Plane" parent="." instance=ExtResource("5")]
|
231 |
transform = Transform3D(-0.372224, 0.0145406, -0.928029, 0, 0.999877, 0.0156663, 0.928143, 0.00583138, -0.372178, -111.001, 77.3255, -109.24)
|
232 |
+
turn_acc = 4.0
|
233 |
|
234 |
[node name="Plane2" parent="." instance=ExtResource("5")]
|
235 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
236 |
+
turn_acc = 4.0
|
237 |
|
238 |
[node name="Plane3" parent="." instance=ExtResource("5")]
|
239 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
240 |
+
turn_acc = 4.0
|
241 |
|
242 |
[node name="Plane4" parent="." instance=ExtResource("5")]
|
243 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
244 |
+
turn_acc = 4.0
|
245 |
|
246 |
[node name="Plane5" parent="." instance=ExtResource("5")]
|
247 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
248 |
+
turn_acc = 4.0
|
249 |
|
250 |
[node name="Plane6" parent="." instance=ExtResource("5")]
|
251 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
252 |
+
turn_acc = 4.0
|
253 |
|
254 |
[node name="Plane7" parent="." instance=ExtResource("5")]
|
255 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
256 |
+
turn_acc = 4.0
|
257 |
|
258 |
[node name="Plane8" parent="." instance=ExtResource("5")]
|
259 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
260 |
+
turn_acc = 4.0
|
261 |
|
262 |
[node name="Plane9" parent="." instance=ExtResource("5")]
|
263 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
264 |
+
turn_acc = 4.0
|
265 |
|
266 |
[node name="Plane10" parent="." instance=ExtResource("5")]
|
267 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
268 |
+
turn_acc = 4.0
|
269 |
|
270 |
[node name="Plane11" parent="." instance=ExtResource("5")]
|
271 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
272 |
+
turn_acc = 4.0
|
273 |
|
274 |
[node name="Plane12" parent="." instance=ExtResource("5")]
|
275 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
276 |
+
turn_acc = 4.0
|
277 |
|
278 |
[node name="Plane13" parent="." instance=ExtResource("5")]
|
279 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
280 |
+
turn_acc = 4.0
|
281 |
|
282 |
[node name="Plane14" parent="." instance=ExtResource("5")]
|
283 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 27, 0)
|
284 |
+
turn_acc = 4.0
|
285 |
|
286 |
[node name="Plane15" parent="." instance=ExtResource("5")]
|
287 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 14, 27, -1)
|
288 |
+
turn_acc = 4.0
|
289 |
|
290 |
[node name="Plane16" parent="." instance=ExtResource("5")]
|
291 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 14, 27, -1)
|
292 |
+
turn_acc = 4.0
|
293 |
|
294 |
[node name="Walls" type="Node" parent="."]
|
295 |
|
Goal.tscn
CHANGED
@@ -1,27 +1,27 @@
|
|
1 |
-
[gd_scene load_steps=4 format=
|
2 |
|
3 |
-
[ext_resource path="res://Goal.gd"
|
4 |
|
5 |
-
[sub_resource type="StandardMaterial3D" id=1]
|
6 |
-
|
7 |
-
albedo_color = Color(
|
8 |
|
9 |
-
[sub_resource type="CylinderShape3D" id=2]
|
10 |
-
radius = 5.0
|
11 |
height = 1.0
|
|
|
12 |
|
13 |
[node name="Goal" type="CSGTorus3D"]
|
14 |
-
transform = Transform3D(
|
15 |
inner_radius = 8.0
|
16 |
outer_radius = 10.0
|
17 |
sides = 32
|
18 |
ring_sides = 12
|
19 |
-
material = SubResource(
|
20 |
-
script = ExtResource(
|
21 |
|
22 |
[node name="Area3D" type="Area3D" parent="."]
|
23 |
|
24 |
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
|
25 |
-
shape = SubResource(
|
26 |
|
27 |
[connection signal="body_entered" from="Area3D" to="." method="_on_Area_body_entered"]
|
|
|
1 |
+
[gd_scene load_steps=4 format=3 uid="uid://bjx0dykb8q6kf"]
|
2 |
|
3 |
+
[ext_resource type="Script" path="res://Goal.gd" id="1"]
|
4 |
|
5 |
+
[sub_resource type="StandardMaterial3D" id="1"]
|
6 |
+
transparency = 1
|
7 |
+
albedo_color = Color(0.372549, 0.0823529, 0.109804, 0.705882)
|
8 |
|
9 |
+
[sub_resource type="CylinderShape3D" id="2"]
|
|
|
10 |
height = 1.0
|
11 |
+
radius = 5.0
|
12 |
|
13 |
[node name="Goal" type="CSGTorus3D"]
|
14 |
+
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 34, 11)
|
15 |
inner_radius = 8.0
|
16 |
outer_radius = 10.0
|
17 |
sides = 32
|
18 |
ring_sides = 12
|
19 |
+
material = SubResource("1")
|
20 |
+
script = ExtResource("1")
|
21 |
|
22 |
[node name="Area3D" type="Area3D" parent="."]
|
23 |
|
24 |
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
|
25 |
+
shape = SubResource("2")
|
26 |
|
27 |
[connection signal="body_entered" from="Area3D" to="." method="_on_Area_body_entered"]
|
Plane.gd
CHANGED
@@ -23,142 +23,67 @@ var found_goal = false
|
|
23 |
var exited_arena = false
|
24 |
var cur_goal = null
|
25 |
@onready var environment = get_parent()
|
|
|
26 |
# ------- #
|
27 |
var turn_input = 0
|
28 |
var pitch_input = 0
|
29 |
-
var done = false
|
30 |
-
var _heuristic = "human"
|
31 |
var best_goal_distance := 10000.0
|
32 |
var transform_backup = null
|
33 |
-
var n_steps = 0
|
34 |
-
const MAX_STEPS = 200000
|
35 |
-
var needs_reset = false
|
36 |
-
var reward = 0.0
|
37 |
|
38 |
|
39 |
func _ready():
|
|
|
40 |
transform_backup = transform
|
41 |
-
|
42 |
-
|
43 |
-
func
|
44 |
-
needs_reset = false
|
45 |
-
|
46 |
cur_goal = environment.get_next_goal(null)
|
47 |
transform_backup = transform_backup
|
48 |
-
position.x = 0 + randf_range(-2,2)
|
49 |
-
position.y = 27 + randf_range(-2,2)
|
50 |
-
position.z = 0 + randf_range(-2,2)
|
51 |
velocity = Vector3.ZERO
|
52 |
rotation = Vector3.ZERO
|
53 |
-
n_steps = 0
|
54 |
found_goal = false
|
55 |
-
exited_arena = false
|
56 |
-
done = false
|
57 |
best_goal_distance = to_local(cur_goal.position).length()
|
58 |
-
|
59 |
-
|
60 |
-
func reset_if_done():
|
61 |
-
if done:
|
62 |
-
reset()
|
63 |
-
|
64 |
-
func get_done():
|
65 |
-
return done
|
66 |
-
|
67 |
-
func set_done_false():
|
68 |
-
done = false
|
69 |
-
|
70 |
-
func get_obs():
|
71 |
-
if cur_goal == null:
|
72 |
-
reset()
|
73 |
-
#var goal_vector = (cur_goal.position - position).normalized() # global frame of reference
|
74 |
-
var goal_vector = to_local(cur_goal.position)
|
75 |
-
var goal_distance = goal_vector.length()
|
76 |
-
goal_vector = goal_vector.normalized()
|
77 |
-
goal_distance = clamp(goal_distance, 0.0, 50.0)
|
78 |
-
|
79 |
-
var next_goal = environment.get_next_goal(cur_goal)
|
80 |
-
var next_goal_vector = to_local(next_goal.position)
|
81 |
-
var next_goal_distance = next_goal_vector.length()
|
82 |
-
next_goal_vector = next_goal_vector.normalized()
|
83 |
-
next_goal_distance = clamp(next_goal_distance, 0.0, 50.0)
|
84 |
-
|
85 |
-
var obs = [
|
86 |
-
goal_vector.x,
|
87 |
-
goal_vector.y,
|
88 |
-
goal_vector.z,
|
89 |
-
goal_distance / 50.0 ,
|
90 |
-
next_goal_vector.x,
|
91 |
-
next_goal_vector.y,
|
92 |
-
next_goal_vector.z,
|
93 |
-
next_goal_distance / 50.0
|
94 |
-
]
|
95 |
-
|
96 |
-
return {"obs":obs}
|
97 |
|
98 |
|
99 |
func update_reward():
|
100 |
-
reward -= 0.01
|
101 |
-
reward += shaping_reward()
|
|
|
102 |
|
103 |
-
func get_reward():
|
104 |
-
return reward
|
105 |
-
|
106 |
func shaping_reward():
|
107 |
var s_reward = 0.0
|
108 |
var goal_distance = to_local(cur_goal.position).length()
|
109 |
if goal_distance < best_goal_distance:
|
110 |
s_reward += best_goal_distance - goal_distance
|
111 |
best_goal_distance = goal_distance
|
112 |
-
|
113 |
s_reward /= 1.0
|
114 |
-
return s_reward
|
|
|
115 |
|
116 |
func set_heuristic(heuristic):
|
117 |
self._heuristic = heuristic
|
118 |
|
119 |
-
|
120 |
-
func get_obs_space():
|
121 |
-
# typs of obs space: box, discrete, repeated
|
122 |
-
return {
|
123 |
-
"obs": {
|
124 |
-
"size": [len(get_obs()["obs"])],
|
125 |
-
"space": "box"
|
126 |
-
}
|
127 |
-
}
|
128 |
-
func get_action_space():
|
129 |
-
return {
|
130 |
-
"turn" : {
|
131 |
-
"size": 1,
|
132 |
-
"action_type": "continuous"
|
133 |
-
},
|
134 |
-
"pitch" : {
|
135 |
-
"size": 1,
|
136 |
-
"action_type": "continuous"
|
137 |
-
}
|
138 |
-
}
|
139 |
-
|
140 |
-
func set_action(action):
|
141 |
-
turn_input = action["turn"][0]
|
142 |
-
pitch_input = action["pitch"][0]
|
143 |
|
144 |
func _physics_process(delta):
|
145 |
-
|
146 |
-
|
147 |
-
done = true
|
148 |
-
needs_reset = true
|
149 |
-
|
150 |
-
if needs_reset:
|
151 |
-
needs_reset = false
|
152 |
-
reset()
|
153 |
return
|
154 |
-
|
155 |
if cur_goal == null:
|
156 |
-
|
157 |
set_input()
|
158 |
if Input.is_action_just_pressed("r_key"):
|
159 |
-
|
160 |
# Rotate the transform based checked the input values
|
161 |
-
transform.basis = transform.basis.rotated(
|
|
|
|
|
162 |
transform.basis = transform.basis.rotated(Vector3.UP, turn_input * turn_speed * delta)
|
163 |
$PlaneModel.rotation.z = lerp($PlaneModel.rotation.z, -float(turn_input), level_speed * delta)
|
164 |
$PlaneModel.rotation.x = lerp($PlaneModel.rotation.x, -float(pitch_input), level_speed * delta)
|
@@ -169,28 +94,29 @@ func _physics_process(delta):
|
|
169 |
set_velocity(velocity)
|
170 |
set_up_direction(Vector3.UP)
|
171 |
move_and_slide()
|
172 |
-
n_steps += 1
|
173 |
-
|
174 |
update_reward()
|
175 |
-
|
176 |
-
|
177 |
-
reward = 0.0
|
178 |
-
|
179 |
func set_input():
|
180 |
-
if
|
181 |
return
|
182 |
else:
|
183 |
-
turn_input =
|
184 |
-
|
|
|
|
|
|
|
|
|
185 |
|
186 |
|
187 |
func goal_reached(goal):
|
188 |
if goal == cur_goal:
|
189 |
-
reward += 100.0
|
190 |
cur_goal = environment.get_next_goal(cur_goal)
|
191 |
-
|
|
|
192 |
func exited_game_area():
|
193 |
-
done = true
|
194 |
-
reward -= 10.0
|
195 |
exited_arena = true
|
196 |
-
|
|
|
23 |
var exited_arena = false
|
24 |
var cur_goal = null
|
25 |
@onready var environment = get_parent()
|
26 |
+
@onready var ai_controller = $AIController3D
|
27 |
# ------- #
|
28 |
var turn_input = 0
|
29 |
var pitch_input = 0
|
|
|
|
|
30 |
var best_goal_distance := 10000.0
|
31 |
var transform_backup = null
|
|
|
|
|
|
|
|
|
32 |
|
33 |
|
34 |
func _ready():
|
35 |
+
ai_controller.init(self)
|
36 |
transform_backup = transform
|
37 |
+
|
38 |
+
|
39 |
+
func game_over():
|
|
|
|
|
40 |
cur_goal = environment.get_next_goal(null)
|
41 |
transform_backup = transform_backup
|
42 |
+
position.x = 0 + randf_range(-2, 2)
|
43 |
+
position.y = 27 + randf_range(-2, 2)
|
44 |
+
position.z = 0 + randf_range(-2, 2)
|
45 |
velocity = Vector3.ZERO
|
46 |
rotation = Vector3.ZERO
|
|
|
47 |
found_goal = false
|
48 |
+
exited_arena = false
|
|
|
49 |
best_goal_distance = to_local(cur_goal.position).length()
|
50 |
+
ai_controller.reset()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
|
53 |
func update_reward():
|
54 |
+
ai_controller.reward -= 0.01 # step penalty
|
55 |
+
ai_controller.reward += shaping_reward()
|
56 |
+
|
57 |
|
|
|
|
|
|
|
58 |
func shaping_reward():
|
59 |
var s_reward = 0.0
|
60 |
var goal_distance = to_local(cur_goal.position).length()
|
61 |
if goal_distance < best_goal_distance:
|
62 |
s_reward += best_goal_distance - goal_distance
|
63 |
best_goal_distance = goal_distance
|
64 |
+
|
65 |
s_reward /= 1.0
|
66 |
+
return s_reward
|
67 |
+
|
68 |
|
69 |
func set_heuristic(heuristic):
|
70 |
self._heuristic = heuristic
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
func _physics_process(delta):
|
74 |
+
if ai_controller.needs_reset:
|
75 |
+
game_over()
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
return
|
77 |
+
|
78 |
if cur_goal == null:
|
79 |
+
game_over()
|
80 |
set_input()
|
81 |
if Input.is_action_just_pressed("r_key"):
|
82 |
+
game_over()
|
83 |
# Rotate the transform based checked the input values
|
84 |
+
transform.basis = transform.basis.rotated(
|
85 |
+
transform.basis.x.normalized(), pitch_input * pitch_speed * delta
|
86 |
+
)
|
87 |
transform.basis = transform.basis.rotated(Vector3.UP, turn_input * turn_speed * delta)
|
88 |
$PlaneModel.rotation.z = lerp($PlaneModel.rotation.z, -float(turn_input), level_speed * delta)
|
89 |
$PlaneModel.rotation.x = lerp($PlaneModel.rotation.x, -float(pitch_input), level_speed * delta)
|
|
|
94 |
set_velocity(velocity)
|
95 |
set_up_direction(Vector3.UP)
|
96 |
move_and_slide()
|
|
|
|
|
97 |
update_reward()
|
98 |
+
|
99 |
+
|
|
|
|
|
100 |
func set_input():
|
101 |
+
if ai_controller.heuristic == "model":
|
102 |
return
|
103 |
else:
|
104 |
+
turn_input = (
|
105 |
+
Input.get_action_strength("roll_left") - Input.get_action_strength("roll_right")
|
106 |
+
)
|
107 |
+
pitch_input = (
|
108 |
+
Input.get_action_strength("pitch_up") - Input.get_action_strength("pitch_down")
|
109 |
+
)
|
110 |
|
111 |
|
112 |
func goal_reached(goal):
|
113 |
if goal == cur_goal:
|
114 |
+
ai_controller.reward += 100.0
|
115 |
cur_goal = environment.get_next_goal(cur_goal)
|
116 |
+
|
117 |
+
|
118 |
func exited_game_area():
|
119 |
+
ai_controller.done = true
|
120 |
+
ai_controller.reward -= 10.0
|
121 |
exited_arena = true
|
122 |
+
game_over()
|
Plane.tscn
CHANGED
@@ -1,12 +1,13 @@
|
|
1 |
-
[gd_scene load_steps=
|
2 |
|
3 |
[ext_resource type="Script" path="res://Plane.gd" id="2"]
|
4 |
-
[ext_resource type="PackedScene" uid="uid://
|
|
|
5 |
|
6 |
[sub_resource type="CylinderShape3D" id="27"]
|
7 |
height = 7.77792
|
8 |
|
9 |
-
[node name="Plane" type="CharacterBody3D"
|
10 |
collision_mask = 2
|
11 |
script = ExtResource("2")
|
12 |
turn_speed = 2.0
|
@@ -21,3 +22,7 @@ transform = Transform3D(-0.01, 0, -8.74228e-10, 0, 0.01, 0, 8.74228e-10, 0, -0.0
|
|
21 |
|
22 |
[node name="Camera3D" type="Camera3D" parent="."]
|
23 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 21.4392)
|
|
|
|
|
|
|
|
|
|
1 |
+
[gd_scene load_steps=5 format=3 uid="uid://3xxv82w5v8bo"]
|
2 |
|
3 |
[ext_resource type="Script" path="res://Plane.gd" id="2"]
|
4 |
+
[ext_resource type="PackedScene" uid="uid://bo7tjnr5viqq" path="res://cartoon_plane/scene.gltf" id="2_0hy0d"]
|
5 |
+
[ext_resource type="Script" path="res://AIController3D.gd" id="3_y1d1w"]
|
6 |
|
7 |
[sub_resource type="CylinderShape3D" id="27"]
|
8 |
height = 7.77792
|
9 |
|
10 |
+
[node name="Plane" type="CharacterBody3D"]
|
11 |
collision_mask = 2
|
12 |
script = ExtResource("2")
|
13 |
turn_speed = 2.0
|
|
|
22 |
|
23 |
[node name="Camera3D" type="Camera3D" parent="."]
|
24 |
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 21.4392)
|
25 |
+
|
26 |
+
[node name="AIController3D" type="Node3D" parent="." groups=["AGENT"]]
|
27 |
+
script = ExtResource("3_y1d1w")
|
28 |
+
reset_after = 200000
|
PlaneModel.gd
CHANGED
@@ -1,17 +1,9 @@
|
|
1 |
extends Node3D
|
2 |
|
3 |
|
4 |
-
# Declare member variables here. Examples:
|
5 |
-
# var a = 2
|
6 |
-
# var b = "text"
|
7 |
@onready var anim = $AnimationPlayer
|
8 |
|
9 |
# Called when the node enters the scene tree for the first time.
|
10 |
func _ready():
|
11 |
get_node("AnimationPlayer").get_animation("Main")#.set_loop(true)
|
12 |
anim.play("Main")
|
13 |
-
|
14 |
-
|
15 |
-
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
16 |
-
#func _process(delta):
|
17 |
-
# pass
|
|
|
1 |
extends Node3D
|
2 |
|
3 |
|
|
|
|
|
|
|
4 |
@onready var anim = $AnimationPlayer
|
5 |
|
6 |
# Called when the node enters the scene tree for the first time.
|
7 |
func _ready():
|
8 |
get_node("AnimationPlayer").get_animation("Main")#.set_loop(true)
|
9 |
anim.play("Main")
|
|
|
|
|
|
|
|
|
|
addons/godot_rl_agents/controller/ai_controller_2d.gd
CHANGED
@@ -1,8 +1,82 @@
|
|
1 |
-
extends
|
2 |
class_name AIController2D
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
var _player: Node2D
|
6 |
|
|
|
|
|
|
|
7 |
func init(player: Node2D):
|
8 |
_player = player
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends Node2D
|
2 |
class_name AIController2D
|
3 |
|
4 |
+
@export var reset_after := 1000
|
5 |
+
|
6 |
+
var heuristic := "human"
|
7 |
+
var done := false
|
8 |
+
var reward := 0.0
|
9 |
+
var n_steps := 0
|
10 |
+
var needs_reset := false
|
11 |
+
|
12 |
var _player: Node2D
|
13 |
|
14 |
+
func _ready():
|
15 |
+
add_to_group("AGENT")
|
16 |
+
|
17 |
func init(player: Node2D):
|
18 |
_player = player
|
19 |
+
|
20 |
+
#-- Methods that need implementing using the "extend script" option in Godot --#
|
21 |
+
func get_obs() -> Dictionary:
|
22 |
+
assert(false, "the get_obs method is not implemented when extending from ai_controller")
|
23 |
+
return {"obs":[]}
|
24 |
+
|
25 |
+
func get_reward() -> float:
|
26 |
+
assert(false, "the get_reward method is not implemented when extending from ai_controller")
|
27 |
+
return 0.0
|
28 |
+
|
29 |
+
func get_action_space() -> Dictionary:
|
30 |
+
assert(false, "the get get_action_space method is not implemented when extending from ai_controller")
|
31 |
+
return {
|
32 |
+
"example_actions_continous" : {
|
33 |
+
"size": 2,
|
34 |
+
"action_type": "continuous"
|
35 |
+
},
|
36 |
+
"example_actions_discrete" : {
|
37 |
+
"size": 2,
|
38 |
+
"action_type": "discrete"
|
39 |
+
},
|
40 |
+
}
|
41 |
+
|
42 |
+
func set_action(action) -> void:
|
43 |
+
assert(false, "the get set_action method is not implemented when extending from ai_controller")
|
44 |
+
# -----------------------------------------------------------------------------#
|
45 |
+
|
46 |
+
func _physics_process(delta):
|
47 |
+
n_steps += 1
|
48 |
+
if n_steps > reset_after:
|
49 |
+
needs_reset = true
|
50 |
+
|
51 |
+
func get_obs_space():
|
52 |
+
# may need overriding if the obs space is complex
|
53 |
+
var obs = get_obs()
|
54 |
+
return {
|
55 |
+
"obs": {
|
56 |
+
"size": [len(obs["obs"])],
|
57 |
+
"space": "box"
|
58 |
+
},
|
59 |
+
}
|
60 |
+
|
61 |
+
func reset():
|
62 |
+
n_steps = 0
|
63 |
+
needs_reset = false
|
64 |
+
|
65 |
+
func reset_if_done():
|
66 |
+
if done:
|
67 |
+
reset()
|
68 |
+
|
69 |
+
func set_heuristic(h):
|
70 |
+
# sets the heuristic from "human" or "model" nothing to change here
|
71 |
+
heuristic = h
|
72 |
+
|
73 |
+
func get_done():
|
74 |
+
return done
|
75 |
+
|
76 |
+
func set_done_false():
|
77 |
+
done = false
|
78 |
+
|
79 |
+
func zero_reward():
|
80 |
+
reward = 0.0
|
81 |
+
|
82 |
+
|
addons/godot_rl_agents/controller/ai_controller_3d.gd
CHANGED
@@ -1,8 +1,80 @@
|
|
1 |
-
extends
|
2 |
class_name AIController3D
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
var _player: Node3D
|
6 |
|
|
|
|
|
|
|
7 |
func init(player: Node3D):
|
8 |
_player = player
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends Node3D
|
2 |
class_name AIController3D
|
3 |
|
4 |
+
@export var reset_after := 1000
|
5 |
+
|
6 |
+
var heuristic := "human"
|
7 |
+
var done := false
|
8 |
+
var reward := 0.0
|
9 |
+
var n_steps := 0
|
10 |
+
var needs_reset := false
|
11 |
+
|
12 |
var _player: Node3D
|
13 |
|
14 |
+
func _ready():
|
15 |
+
add_to_group("AGENT")
|
16 |
+
|
17 |
func init(player: Node3D):
|
18 |
_player = player
|
19 |
+
|
20 |
+
#-- Methods that need implementing using the "extend script" option in Godot --#
|
21 |
+
func get_obs() -> Dictionary:
|
22 |
+
assert(false, "the get_obs method is not implemented when extending from ai_controller")
|
23 |
+
return {"obs":[]}
|
24 |
+
|
25 |
+
func get_reward() -> float:
|
26 |
+
assert(false, "the get_reward method is not implemented when extending from ai_controller")
|
27 |
+
return 0.0
|
28 |
+
|
29 |
+
func get_action_space() -> Dictionary:
|
30 |
+
assert(false, "the get get_action_space method is not implemented when extending from ai_controller")
|
31 |
+
return {
|
32 |
+
"example_actions_continous" : {
|
33 |
+
"size": 2,
|
34 |
+
"action_type": "continuous"
|
35 |
+
},
|
36 |
+
"example_actions_discrete" : {
|
37 |
+
"size": 2,
|
38 |
+
"action_type": "discrete"
|
39 |
+
},
|
40 |
+
}
|
41 |
+
|
42 |
+
func set_action(action) -> void:
|
43 |
+
assert(false, "the get set_action method is not implemented when extending from ai_controller")
|
44 |
+
# -----------------------------------------------------------------------------#
|
45 |
+
|
46 |
+
func _physics_process(delta):
|
47 |
+
n_steps += 1
|
48 |
+
if n_steps > reset_after:
|
49 |
+
needs_reset = true
|
50 |
+
|
51 |
+
func get_obs_space():
|
52 |
+
# may need overriding if the obs space is complex
|
53 |
+
var obs = get_obs()
|
54 |
+
return {
|
55 |
+
"obs": {
|
56 |
+
"size": [len(obs["obs"])],
|
57 |
+
"space": "box"
|
58 |
+
},
|
59 |
+
}
|
60 |
+
|
61 |
+
func reset():
|
62 |
+
n_steps = 0
|
63 |
+
needs_reset = false
|
64 |
+
|
65 |
+
func reset_if_done():
|
66 |
+
if done:
|
67 |
+
reset()
|
68 |
+
|
69 |
+
func set_heuristic(h):
|
70 |
+
# sets the heuristic from "human" or "model" nothing to change here
|
71 |
+
heuristic = h
|
72 |
+
|
73 |
+
func get_done():
|
74 |
+
return done
|
75 |
+
|
76 |
+
func set_done_false():
|
77 |
+
done = false
|
78 |
+
|
79 |
+
func zero_reward():
|
80 |
+
reward = 0.0
|
addons/godot_rl_agents/onnx/csharp/ONNXInference.cs
CHANGED
@@ -1,93 +1,103 @@
|
|
1 |
using Godot;
|
2 |
-
using System.Collections.Generic;
|
3 |
-
using System.Linq;
|
4 |
using Microsoft.ML.OnnxRuntime;
|
5 |
using Microsoft.ML.OnnxRuntime.Tensors;
|
|
|
|
|
6 |
|
7 |
-
namespace GodotONNX
|
8 |
-
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/ONNXInference/*'/>
|
9 |
-
public partial class ONNXInference : Node
|
10 |
{
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
/// Path to the ONNX model. Use Initialize to change it.
|
15 |
-
/// </summary>
|
16 |
-
private string modelPath;
|
17 |
-
private int batchSize;
|
18 |
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
-
|
22 |
-
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/Initialize/*'/>
|
23 |
-
public void Initialize(string Path, int BatchSize)
|
24 |
-
{
|
25 |
-
modelPath = Path;
|
26 |
-
batchSize = BatchSize;
|
27 |
-
SessionConfigurator.SystemCheck();
|
28 |
-
SessionOpt = SessionConfigurator.GetSessionOptions();
|
29 |
-
session = LoadModel(modelPath);
|
30 |
|
31 |
-
|
32 |
-
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/
|
33 |
-
|
34 |
-
{
|
35 |
-
//Current model: Any (Godot Rl Agents)
|
36 |
-
//Expects a tensor of shape [batch_size, input_size] type float named obs and a tensor of shape [batch_size] type float named state_ins
|
37 |
-
|
38 |
-
//Fill the input tensors
|
39 |
-
// create span from inputSize
|
40 |
-
var span = new float[obs.Count]; //There's probably a better way to do this
|
41 |
-
for (int i = 0; i < obs.Count; i++)
|
42 |
{
|
43 |
-
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
{
|
48 |
NamedOnnxValue.CreateFromTensor("obs", new DenseTensor<float>(span, new int[] { batchSize, obs.Count })),
|
49 |
NamedOnnxValue.CreateFromTensor("state_ins", new DenseTensor<float>(new float[] { state_ins }, new int[] { batchSize }))
|
50 |
-
};
|
51 |
-
|
52 |
|
53 |
-
IDisposableReadOnlyCollection<DisposableNamedOnnxValue> results;
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
}
|
93 |
-
}
|
|
|
1 |
using Godot;
|
|
|
|
|
2 |
using Microsoft.ML.OnnxRuntime;
|
3 |
using Microsoft.ML.OnnxRuntime.Tensors;
|
4 |
+
using System.Collections.Generic;
|
5 |
+
using System.Linq;
|
6 |
|
7 |
+
namespace GodotONNX
|
|
|
|
|
8 |
{
|
9 |
+
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/ONNXInference/*'/>
|
10 |
+
public partial class ONNXInference : GodotObject
|
11 |
+
{
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
private InferenceSession session;
|
14 |
+
/// <summary>
|
15 |
+
/// Path to the ONNX model. Use Initialize to change it.
|
16 |
+
/// </summary>
|
17 |
+
private string modelPath;
|
18 |
+
private int batchSize;
|
19 |
|
20 |
+
private SessionOptions SessionOpt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
+
//init function
|
23 |
+
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/Initialize/*'/>
|
24 |
+
public void Initialize(string Path, int BatchSize)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
{
|
26 |
+
modelPath = Path;
|
27 |
+
batchSize = BatchSize;
|
28 |
+
SessionOpt = SessionConfigurator.MakeConfiguredSessionOptions();
|
29 |
+
session = LoadModel(modelPath);
|
30 |
+
|
31 |
}
|
32 |
+
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/Run/*'/>
|
33 |
+
public Godot.Collections.Dictionary<string, Godot.Collections.Array<float>> RunInference(Godot.Collections.Array<float> obs, int state_ins)
|
34 |
+
{
|
35 |
+
//Current model: Any (Godot Rl Agents)
|
36 |
+
//Expects a tensor of shape [batch_size, input_size] type float named obs and a tensor of shape [batch_size] type float named state_ins
|
37 |
+
|
38 |
+
//Fill the input tensors
|
39 |
+
// create span from inputSize
|
40 |
+
var span = new float[obs.Count]; //There's probably a better way to do this
|
41 |
+
for (int i = 0; i < obs.Count; i++)
|
42 |
+
{
|
43 |
+
span[i] = obs[i];
|
44 |
+
}
|
45 |
+
|
46 |
+
IReadOnlyCollection<NamedOnnxValue> inputs = new List<NamedOnnxValue>
|
47 |
{
|
48 |
NamedOnnxValue.CreateFromTensor("obs", new DenseTensor<float>(span, new int[] { batchSize, obs.Count })),
|
49 |
NamedOnnxValue.CreateFromTensor("state_ins", new DenseTensor<float>(new float[] { state_ins }, new int[] { batchSize }))
|
50 |
+
};
|
51 |
+
IReadOnlyCollection<string> outputNames = new List<string> { "output", "state_outs" }; //ONNX is sensible to these names, as well as the input names
|
52 |
|
53 |
+
IDisposableReadOnlyCollection<DisposableNamedOnnxValue> results;
|
54 |
+
//We do not use "using" here so we get a better exception explaination later
|
55 |
+
try
|
56 |
+
{
|
57 |
+
results = session.Run(inputs, outputNames);
|
58 |
+
}
|
59 |
+
catch (OnnxRuntimeException e)
|
60 |
+
{
|
61 |
+
//This error usually means that the model is not compatible with the input, beacause of the input shape (size)
|
62 |
+
GD.Print("Error at inference: ", e);
|
63 |
+
return null;
|
64 |
+
}
|
65 |
+
//Can't convert IEnumerable<float> to Variant, so we have to convert it to an array or something
|
66 |
+
Godot.Collections.Dictionary<string, Godot.Collections.Array<float>> output = new Godot.Collections.Dictionary<string, Godot.Collections.Array<float>>();
|
67 |
+
DisposableNamedOnnxValue output1 = results.First();
|
68 |
+
DisposableNamedOnnxValue output2 = results.Last();
|
69 |
+
Godot.Collections.Array<float> output1Array = new Godot.Collections.Array<float>();
|
70 |
+
Godot.Collections.Array<float> output2Array = new Godot.Collections.Array<float>();
|
71 |
|
72 |
+
foreach (float f in output1.AsEnumerable<float>())
|
73 |
+
{
|
74 |
+
output1Array.Add(f);
|
75 |
+
}
|
76 |
|
77 |
+
foreach (float f in output2.AsEnumerable<float>())
|
78 |
+
{
|
79 |
+
output2Array.Add(f);
|
80 |
+
}
|
81 |
|
82 |
+
output.Add(output1.Name, output1Array);
|
83 |
+
output.Add(output2.Name, output2Array);
|
84 |
+
|
85 |
+
//Output is a dictionary of arrays, ex: { "output" : [0.1, 0.2, 0.3, 0.4, ...], "state_outs" : [0.5, ...]}
|
86 |
+
results.Dispose();
|
87 |
+
return output;
|
88 |
+
}
|
89 |
+
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/Load/*'/>
|
90 |
+
public InferenceSession LoadModel(string Path)
|
91 |
+
{
|
92 |
+
using Godot.FileAccess file = FileAccess.Open(Path, Godot.FileAccess.ModeFlags.Read);
|
93 |
+
byte[] model = file.GetBuffer((int)file.GetLength());
|
94 |
+
//file.Close(); file.Dispose(); //Close the file, then dispose the reference.
|
95 |
+
return new InferenceSession(model, SessionOpt); //Load the model
|
96 |
+
}
|
97 |
+
public void FreeDisposables()
|
98 |
+
{
|
99 |
+
session.Dispose();
|
100 |
+
SessionOpt.Dispose();
|
101 |
+
}
|
102 |
}
|
103 |
+
}
|
addons/godot_rl_agents/onnx/csharp/SessionConfigurator.cs
CHANGED
@@ -1,106 +1,131 @@
|
|
1 |
using Godot;
|
2 |
using Microsoft.ML.OnnxRuntime;
|
3 |
|
4 |
-
namespace GodotONNX
|
5 |
-
|
6 |
-
|
7 |
-
public static class SessionConfigurator {
|
8 |
-
|
9 |
-
private static SessionOptions options = new SessionOptions();
|
10 |
-
|
11 |
-
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/GetSessionOptions/*'/>
|
12 |
-
public static SessionOptions GetSessionOptions() {
|
13 |
-
options = new SessionOptions();
|
14 |
-
options.LogSeverityLevel = OrtLoggingLevel.ORT_LOGGING_LEVEL_WARNING;
|
15 |
-
// see warnings
|
16 |
-
SystemCheck();
|
17 |
-
return options;
|
18 |
-
}
|
19 |
-
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/SystemCheck/*'/>
|
20 |
|
21 |
-
static
|
22 |
{
|
23 |
-
|
24 |
-
//implementation progress of the different compute APIs.
|
25 |
-
|
26 |
-
//December 2022: CUDA is not working.
|
27 |
-
|
28 |
-
string OSName = OS.GetName(); //Get OS Name
|
29 |
-
int ComputeAPIID = ComputeCheck(); //Get Compute API
|
30 |
-
//TODO: Get CPU architecture
|
31 |
-
|
32 |
-
//Linux can use OpenVINO (C#) on x64 and ROCm on x86 (GDNative/C++)
|
33 |
-
//Windows can use OpenVINO (C#) on x64
|
34 |
-
//TODO: try TensorRT instead of CUDA
|
35 |
-
//TODO: Use OpenVINO for Intel Graphics
|
36 |
-
|
37 |
-
string [] ComputeNames = {"CUDA", "DirectML/ROCm", "DirectML", "CoreML", "CPU"};
|
38 |
-
//match OS and Compute API
|
39 |
-
options.AppendExecutionProvider_CPU(0); // Always use CPU
|
40 |
-
GD.Print("OS: " + OSName, " | Compute API: " + ComputeNames[ComputeAPIID]);
|
41 |
-
|
42 |
-
switch (OSName)
|
43 |
{
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
options.AppendExecutionProvider_DML(0);
|
50 |
-
}
|
51 |
-
else if (ComputeAPIID == 1)
|
52 |
-
{
|
53 |
-
//DirectML
|
54 |
-
options.AppendExecutionProvider_DML(0);
|
55 |
-
}
|
56 |
-
break;
|
57 |
-
case "X11": //Can use CUDA, ROCm
|
58 |
-
if (ComputeAPIID == 0)
|
59 |
-
{
|
60 |
-
//CUDA
|
61 |
-
//options.AppendExecutionProvider_CUDA(0);
|
62 |
-
}
|
63 |
-
if (ComputeAPIID == 1)
|
64 |
-
{
|
65 |
-
//ROCm, only works on x86
|
66 |
-
//Research indicates that this has to be compiled as a GDNative plugin
|
67 |
-
GD.Print("ROCm not supported yet, using CPU.");
|
68 |
-
options.AppendExecutionProvider_CPU(0);
|
69 |
-
}
|
70 |
-
|
71 |
-
break;
|
72 |
-
case "OSX": //Can use CoreML
|
73 |
-
if (ComputeAPIID == 0) { //CoreML
|
74 |
-
//TODO: Needs testing
|
75 |
-
options.AppendExecutionProvider_CoreML(0);
|
76 |
-
//CoreML on ARM64, out of the box, on x64 needs .tar file from GitHub
|
77 |
-
}
|
78 |
-
break;
|
79 |
-
default:
|
80 |
-
GD.Print("OS not Supported.");
|
81 |
-
break;
|
82 |
}
|
83 |
-
}
|
84 |
-
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/ComputeCheck/*'/>
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
}
|
|
|
|
|
|
|
105 |
}
|
106 |
-
}
|
|
|
|
1 |
using Godot;
|
2 |
using Microsoft.ML.OnnxRuntime;
|
3 |
|
4 |
+
namespace GodotONNX
|
5 |
+
{
|
6 |
+
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/SessionConfigurator/*'/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
public static class SessionConfigurator
|
9 |
{
|
10 |
+
public enum ComputeName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
{
|
12 |
+
CUDA,
|
13 |
+
ROCm,
|
14 |
+
DirectML,
|
15 |
+
CoreML,
|
16 |
+
CPU
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
}
|
|
|
|
|
18 |
|
19 |
+
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/GetSessionOptions/*'/>
|
20 |
+
public static SessionOptions MakeConfiguredSessionOptions()
|
21 |
+
{
|
22 |
+
SessionOptions sessionOptions = new();
|
23 |
+
SetOptions(sessionOptions);
|
24 |
+
return sessionOptions;
|
25 |
+
}
|
26 |
+
|
27 |
+
private static void SetOptions(SessionOptions sessionOptions)
|
28 |
+
{
|
29 |
+
sessionOptions.LogSeverityLevel = OrtLoggingLevel.ORT_LOGGING_LEVEL_WARNING;
|
30 |
+
ApplySystemSpecificOptions(sessionOptions);
|
31 |
+
}
|
32 |
+
|
33 |
+
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/SystemCheck/*'/>
|
34 |
+
static public void ApplySystemSpecificOptions(SessionOptions sessionOptions)
|
35 |
+
{
|
36 |
+
//Most code for this function is verbose only, the only reason it exists is to track
|
37 |
+
//implementation progress of the different compute APIs.
|
38 |
+
|
39 |
+
//December 2022: CUDA is not working.
|
40 |
+
|
41 |
+
string OSName = OS.GetName(); //Get OS Name
|
42 |
+
|
43 |
+
//ComputeName ComputeAPI = ComputeCheck(); //Get Compute API
|
44 |
+
// //TODO: Get CPU architecture
|
45 |
+
|
46 |
+
//Linux can use OpenVINO (C#) on x64 and ROCm on x86 (GDNative/C++)
|
47 |
+
//Windows can use OpenVINO (C#) on x64
|
48 |
+
//TODO: try TensorRT instead of CUDA
|
49 |
+
//TODO: Use OpenVINO for Intel Graphics
|
50 |
+
|
51 |
+
// Temporarily using CPU on all platforms to avoid errors detected with DML
|
52 |
+
ComputeName ComputeAPI = ComputeName.CPU;
|
53 |
+
|
54 |
+
//match OS and Compute API
|
55 |
+
GD.Print($"OS: {OSName} Compute API: {ComputeAPI}");
|
56 |
+
|
57 |
+
// CPU is set by default without appending necessary
|
58 |
+
// sessionOptions.AppendExecutionProvider_CPU(0);
|
59 |
+
|
60 |
+
/*
|
61 |
+
switch (OSName)
|
62 |
+
{
|
63 |
+
case "Windows": //Can use CUDA, DirectML
|
64 |
+
if (ComputeAPI is ComputeName.CUDA)
|
65 |
+
{
|
66 |
+
//CUDA
|
67 |
+
//sessionOptions.AppendExecutionProvider_CUDA(0);
|
68 |
+
//sessionOptions.AppendExecutionProvider_DML(0);
|
69 |
+
}
|
70 |
+
else if (ComputeAPI is ComputeName.DirectML)
|
71 |
+
{
|
72 |
+
//DirectML
|
73 |
+
//sessionOptions.AppendExecutionProvider_DML(0);
|
74 |
+
}
|
75 |
+
break;
|
76 |
+
case "X11": //Can use CUDA, ROCm
|
77 |
+
if (ComputeAPI is ComputeName.CUDA)
|
78 |
+
{
|
79 |
+
//CUDA
|
80 |
+
//sessionOptions.AppendExecutionProvider_CUDA(0);
|
81 |
+
}
|
82 |
+
if (ComputeAPI is ComputeName.ROCm)
|
83 |
+
{
|
84 |
+
//ROCm, only works on x86
|
85 |
+
//Research indicates that this has to be compiled as a GDNative plugin
|
86 |
+
//GD.Print("ROCm not supported yet, using CPU.");
|
87 |
+
//sessionOptions.AppendExecutionProvider_CPU(0);
|
88 |
+
}
|
89 |
+
break;
|
90 |
+
case "macOS": //Can use CoreML
|
91 |
+
if (ComputeAPI is ComputeName.CoreML)
|
92 |
+
{ //CoreML
|
93 |
+
//TODO: Needs testing
|
94 |
+
//sessionOptions.AppendExecutionProvider_CoreML(0);
|
95 |
+
//CoreML on ARM64, out of the box, on x64 needs .tar file from GitHub
|
96 |
+
}
|
97 |
+
break;
|
98 |
+
default:
|
99 |
+
GD.Print("OS not Supported.");
|
100 |
+
break;
|
101 |
+
}
|
102 |
+
*/
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/ComputeCheck/*'/>
|
107 |
+
public static ComputeName ComputeCheck()
|
108 |
+
{
|
109 |
+
string adapterName = Godot.RenderingServer.GetVideoAdapterName();
|
110 |
+
//string adapterVendor = Godot.RenderingServer.GetVideoAdapterVendor();
|
111 |
+
adapterName = adapterName.ToUpper(new System.Globalization.CultureInfo(""));
|
112 |
+
//TODO: GPU vendors for MacOS, what do they even use these days?
|
113 |
+
|
114 |
+
if (adapterName.Contains("INTEL"))
|
115 |
+
{
|
116 |
+
return ComputeName.DirectML;
|
117 |
+
}
|
118 |
+
if (adapterName.Contains("AMD") || adapterName.Contains("RADEON"))
|
119 |
+
{
|
120 |
+
return ComputeName.DirectML;
|
121 |
+
}
|
122 |
+
if (adapterName.Contains("NVIDIA"))
|
123 |
+
{
|
124 |
+
return ComputeName.CUDA;
|
125 |
}
|
126 |
+
|
127 |
+
GD.Print("Graphics Card not recognized."); //Should use CPU
|
128 |
+
return ComputeName.CPU;
|
129 |
}
|
130 |
+
}
|
131 |
+
}
|
addons/godot_rl_agents/onnx/wrapper/ONNX_wrapper.gd
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
extends
|
2 |
class_name ONNXModel
|
3 |
var inferencer_script = load("res://addons/godot_rl_agents/onnx/csharp/ONNXInference.cs")
|
4 |
|
@@ -17,3 +17,8 @@ func run_inference(obs : Array, state_ins : int) -> Dictionary:
|
|
17 |
printerr("Inferencer not initialized")
|
18 |
return {}
|
19 |
return inferencer.RunInference(obs, state_ins)
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends Resource
|
2 |
class_name ONNXModel
|
3 |
var inferencer_script = load("res://addons/godot_rl_agents/onnx/csharp/ONNXInference.cs")
|
4 |
|
|
|
17 |
printerr("Inferencer not initialized")
|
18 |
return {}
|
19 |
return inferencer.RunInference(obs, state_ins)
|
20 |
+
|
21 |
+
func _notification(what):
|
22 |
+
if what == NOTIFICATION_PREDELETE:
|
23 |
+
inferencer.FreeDisposables()
|
24 |
+
inferencer.free()
|
addons/godot_rl_agents/sensors/sensors_2d/ExampleRaycastSensor2D.tscn
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
[gd_scene load_steps=5 format=3 uid="uid://ddeq7mn1ealyc"]
|
2 |
|
3 |
-
[ext_resource type="Script" path="res://sensors/sensors_2d/RaycastSensor2D.gd" id="1"]
|
4 |
|
5 |
[sub_resource type="GDScript" id="2"]
|
6 |
script/source = "extends Node2D
|
|
|
1 |
[gd_scene load_steps=5 format=3 uid="uid://ddeq7mn1ealyc"]
|
2 |
|
3 |
+
[ext_resource type="Script" path="res://addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd" id="1"]
|
4 |
|
5 |
[sub_resource type="GDScript" id="2"]
|
6 |
script/source = "extends Node2D
|
addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd
CHANGED
@@ -61,11 +61,15 @@ var geo = null
|
|
61 |
|
62 |
func _update():
|
63 |
if Engine.is_editor_hint():
|
64 |
-
|
65 |
-
|
66 |
|
67 |
func _ready() -> void:
|
68 |
-
|
|
|
|
|
|
|
|
|
69 |
|
70 |
func _spawn_nodes():
|
71 |
print("spawning nodes")
|
|
|
61 |
|
62 |
func _update():
|
63 |
if Engine.is_editor_hint():
|
64 |
+
if is_node_ready():
|
65 |
+
_spawn_nodes()
|
66 |
|
67 |
func _ready() -> void:
|
68 |
+
if Engine.is_editor_hint():
|
69 |
+
if get_child_count() == 0:
|
70 |
+
_spawn_nodes()
|
71 |
+
else:
|
72 |
+
_spawn_nodes()
|
73 |
|
74 |
func _spawn_nodes():
|
75 |
print("spawning nodes")
|
addons/godot_rl_agents/sync.gd
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
extends Node
|
2 |
# --fixed-fps 2000 --disable-render-loop
|
3 |
-
@
|
4 |
-
@
|
5 |
@export var onnx_model_path := ""
|
6 |
|
7 |
@onready var start_time = Time.get_ticks_msec()
|
@@ -10,7 +10,6 @@ const MAJOR_VERSION := "0"
|
|
10 |
const MINOR_VERSION := "3"
|
11 |
const DEFAULT_PORT := "11008"
|
12 |
const DEFAULT_SEED := "1"
|
13 |
-
const DEFAULT_ACTION_REPEAT := "8"
|
14 |
var stream : StreamPeerTCP = null
|
15 |
var connected = false
|
16 |
var message_center
|
@@ -44,17 +43,20 @@ func _initialize():
|
|
44 |
Engine.time_scale = _get_speedup() * 1.0
|
45 |
prints("physics ticks", Engine.physics_ticks_per_second, Engine.time_scale, _get_speedup(), speed_up)
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
if
|
50 |
-
|
51 |
-
_handshake()
|
52 |
-
_send_env_info()
|
53 |
-
elif onnx_model_path != "":
|
54 |
onnx_model = ONNXModel.new(onnx_model_path, 1)
|
55 |
_set_heuristic("model")
|
56 |
-
else:
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
_set_seed()
|
60 |
_set_action_repeat()
|
@@ -232,7 +234,7 @@ func _set_seed():
|
|
232 |
seed(_seed)
|
233 |
|
234 |
func _set_action_repeat():
|
235 |
-
action_repeat = args.get("action_repeat",
|
236 |
|
237 |
func disconnect_from_server():
|
238 |
stream.disconnect_from_host()
|
|
|
1 |
extends Node
|
2 |
# --fixed-fps 2000 --disable-render-loop
|
3 |
+
@export_range(1, 10, 1, "or_greater") var action_repeat := 8
|
4 |
+
@export_range(1, 10, 1, "or_greater") var speed_up = 1
|
5 |
@export var onnx_model_path := ""
|
6 |
|
7 |
@onready var start_time = Time.get_ticks_msec()
|
|
|
10 |
const MINOR_VERSION := "3"
|
11 |
const DEFAULT_PORT := "11008"
|
12 |
const DEFAULT_SEED := "1"
|
|
|
13 |
var stream : StreamPeerTCP = null
|
14 |
var connected = false
|
15 |
var message_center
|
|
|
43 |
Engine.time_scale = _get_speedup() * 1.0
|
44 |
prints("physics ticks", Engine.physics_ticks_per_second, Engine.time_scale, _get_speedup(), speed_up)
|
45 |
|
46 |
+
# Run inference if onnx model path is set, otherwise wait for server connection
|
47 |
+
var run_onnx_model_inference : bool = onnx_model_path != ""
|
48 |
+
if run_onnx_model_inference:
|
49 |
+
assert(FileAccess.file_exists(onnx_model_path), "Onnx Model Path set on Sync node does not exist: " + onnx_model_path)
|
|
|
|
|
|
|
50 |
onnx_model = ONNXModel.new(onnx_model_path, 1)
|
51 |
_set_heuristic("model")
|
52 |
+
else:
|
53 |
+
connected = connect_to_server()
|
54 |
+
if connected:
|
55 |
+
_set_heuristic("model")
|
56 |
+
_handshake()
|
57 |
+
_send_env_info()
|
58 |
+
else:
|
59 |
+
_set_heuristic("human")
|
60 |
|
61 |
_set_seed()
|
62 |
_set_action_repeat()
|
|
|
234 |
seed(_seed)
|
235 |
|
236 |
func _set_action_repeat():
|
237 |
+
action_repeat = args.get("action_repeat", str(action_repeat)).to_int()
|
238 |
|
239 |
func disconnect_from_server():
|
240 |
stream.disconnect_from_host()
|
alps_field_2k.hdr.import
CHANGED
@@ -3,25 +3,26 @@
|
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://btons2a8wn2fu"
|
6 |
-
path="res://.godot/imported/alps_field_2k.hdr-3700cd621ede9e1814580eb21c62fe71.ctex"
|
7 |
metadata={
|
8 |
-
"
|
|
|
9 |
}
|
10 |
|
11 |
[deps]
|
12 |
|
13 |
source_file="res://alps_field_2k.hdr"
|
14 |
-
dest_files=["res://.godot/imported/alps_field_2k.hdr-3700cd621ede9e1814580eb21c62fe71.ctex"]
|
15 |
|
16 |
[params]
|
17 |
|
18 |
-
compress/mode=
|
19 |
compress/high_quality=false
|
20 |
compress/lossy_quality=0.7
|
21 |
compress/hdr_compression=1
|
22 |
compress/normal_map=0
|
23 |
compress/channel_pack=0
|
24 |
-
mipmaps/generate=
|
25 |
mipmaps/limit=-1
|
26 |
roughness/mode=0
|
27 |
roughness/src_normal=""
|
@@ -31,4 +32,4 @@ process/normal_map_invert_y=false
|
|
31 |
process/hdr_as_srgb=false
|
32 |
process/hdr_clamp_exposure=false
|
33 |
process/size_limit=0
|
34 |
-
detect_3d/compress_to=
|
|
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://btons2a8wn2fu"
|
6 |
+
path.bptc="res://.godot/imported/alps_field_2k.hdr-3700cd621ede9e1814580eb21c62fe71.bptc.ctex"
|
7 |
metadata={
|
8 |
+
"imported_formats": ["s3tc_bptc"],
|
9 |
+
"vram_texture": true
|
10 |
}
|
11 |
|
12 |
[deps]
|
13 |
|
14 |
source_file="res://alps_field_2k.hdr"
|
15 |
+
dest_files=["res://.godot/imported/alps_field_2k.hdr-3700cd621ede9e1814580eb21c62fe71.bptc.ctex"]
|
16 |
|
17 |
[params]
|
18 |
|
19 |
+
compress/mode=2
|
20 |
compress/high_quality=false
|
21 |
compress/lossy_quality=0.7
|
22 |
compress/hdr_compression=1
|
23 |
compress/normal_map=0
|
24 |
compress/channel_pack=0
|
25 |
+
mipmaps/generate=true
|
26 |
mipmaps/limit=-1
|
27 |
roughness/mode=0
|
28 |
roughness/src_normal=""
|
|
|
32 |
process/hdr_as_srgb=false
|
33 |
process/hdr_clamp_exposure=false
|
34 |
process/size_limit=0
|
35 |
+
detect_3d/compress_to=0
|
bin/FlyBy.console.exe
CHANGED
Binary files a/bin/FlyBy.console.exe and b/bin/FlyBy.console.exe differ
|
|
bin/FlyBy.exe
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:910d1661cf406eb788be65369b4784b8bde02dd16e327fac690b501d08e9e886
|
3 |
+
size 69051392
|
bin/FlyBy.pck
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b9e3b0a80e0c9eac9dc780af6f3b948c787162bc756508639932709e3be9e772
|
3 |
+
size 7141264
|
bin/FlyBy.x86_64
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fb6fa01639dd98489aac3e0dd5f9ecf0691b25b37a717f7380b1350d91ed23a4
|
3 |
+
size 61637496
|
concrete_wall_004_ao_1k.jpg.import
CHANGED
@@ -3,32 +3,33 @@
|
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://jguvr0spp5gu"
|
6 |
-
path="res://.godot/imported/concrete_wall_004_ao_1k.jpg-0d870bfa68d10989c64e8f80fd173f1c.ctex"
|
7 |
metadata={
|
8 |
-
"
|
|
|
9 |
}
|
10 |
|
11 |
[deps]
|
12 |
|
13 |
source_file="res://concrete_wall_004_ao_1k.jpg"
|
14 |
-
dest_files=["res://.godot/imported/concrete_wall_004_ao_1k.jpg-0d870bfa68d10989c64e8f80fd173f1c.ctex"]
|
15 |
|
16 |
[params]
|
17 |
|
18 |
-
compress/mode=
|
19 |
compress/high_quality=false
|
20 |
compress/lossy_quality=0.7
|
21 |
compress/hdr_compression=1
|
22 |
compress/normal_map=0
|
23 |
compress/channel_pack=0
|
24 |
-
mipmaps/generate=
|
25 |
mipmaps/limit=-1
|
26 |
-
roughness/mode=
|
27 |
-
roughness/src_normal=""
|
28 |
process/fix_alpha_border=true
|
29 |
process/premult_alpha=false
|
30 |
process/normal_map_invert_y=false
|
31 |
process/hdr_as_srgb=false
|
32 |
process/hdr_clamp_exposure=false
|
33 |
process/size_limit=0
|
34 |
-
detect_3d/compress_to=
|
|
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://jguvr0spp5gu"
|
6 |
+
path.s3tc="res://.godot/imported/concrete_wall_004_ao_1k.jpg-0d870bfa68d10989c64e8f80fd173f1c.s3tc.ctex"
|
7 |
metadata={
|
8 |
+
"imported_formats": ["s3tc_bptc"],
|
9 |
+
"vram_texture": true
|
10 |
}
|
11 |
|
12 |
[deps]
|
13 |
|
14 |
source_file="res://concrete_wall_004_ao_1k.jpg"
|
15 |
+
dest_files=["res://.godot/imported/concrete_wall_004_ao_1k.jpg-0d870bfa68d10989c64e8f80fd173f1c.s3tc.ctex"]
|
16 |
|
17 |
[params]
|
18 |
|
19 |
+
compress/mode=2
|
20 |
compress/high_quality=false
|
21 |
compress/lossy_quality=0.7
|
22 |
compress/hdr_compression=1
|
23 |
compress/normal_map=0
|
24 |
compress/channel_pack=0
|
25 |
+
mipmaps/generate=true
|
26 |
mipmaps/limit=-1
|
27 |
+
roughness/mode=8
|
28 |
+
roughness/src_normal="res://concrete_wall_004_nor_gl_1k.jpg"
|
29 |
process/fix_alpha_border=true
|
30 |
process/premult_alpha=false
|
31 |
process/normal_map_invert_y=false
|
32 |
process/hdr_as_srgb=false
|
33 |
process/hdr_clamp_exposure=false
|
34 |
process/size_limit=0
|
35 |
+
detect_3d/compress_to=0
|
concrete_wall_004_arm_1k.jpg.import
CHANGED
@@ -3,25 +3,26 @@
|
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://s3lmg34s3mwq"
|
6 |
-
path="res://.godot/imported/concrete_wall_004_arm_1k.jpg-751ec2fe192db08c6d0a22459d60b1bf.ctex"
|
7 |
metadata={
|
8 |
-
"
|
|
|
9 |
}
|
10 |
|
11 |
[deps]
|
12 |
|
13 |
source_file="res://concrete_wall_004_arm_1k.jpg"
|
14 |
-
dest_files=["res://.godot/imported/concrete_wall_004_arm_1k.jpg-751ec2fe192db08c6d0a22459d60b1bf.ctex"]
|
15 |
|
16 |
[params]
|
17 |
|
18 |
-
compress/mode=
|
19 |
compress/high_quality=false
|
20 |
compress/lossy_quality=0.7
|
21 |
compress/hdr_compression=1
|
22 |
compress/normal_map=0
|
23 |
compress/channel_pack=0
|
24 |
-
mipmaps/generate=
|
25 |
mipmaps/limit=-1
|
26 |
roughness/mode=0
|
27 |
roughness/src_normal=""
|
@@ -31,4 +32,4 @@ process/normal_map_invert_y=false
|
|
31 |
process/hdr_as_srgb=false
|
32 |
process/hdr_clamp_exposure=false
|
33 |
process/size_limit=0
|
34 |
-
detect_3d/compress_to=
|
|
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://s3lmg34s3mwq"
|
6 |
+
path.s3tc="res://.godot/imported/concrete_wall_004_arm_1k.jpg-751ec2fe192db08c6d0a22459d60b1bf.s3tc.ctex"
|
7 |
metadata={
|
8 |
+
"imported_formats": ["s3tc_bptc"],
|
9 |
+
"vram_texture": true
|
10 |
}
|
11 |
|
12 |
[deps]
|
13 |
|
14 |
source_file="res://concrete_wall_004_arm_1k.jpg"
|
15 |
+
dest_files=["res://.godot/imported/concrete_wall_004_arm_1k.jpg-751ec2fe192db08c6d0a22459d60b1bf.s3tc.ctex"]
|
16 |
|
17 |
[params]
|
18 |
|
19 |
+
compress/mode=2
|
20 |
compress/high_quality=false
|
21 |
compress/lossy_quality=0.7
|
22 |
compress/hdr_compression=1
|
23 |
compress/normal_map=0
|
24 |
compress/channel_pack=0
|
25 |
+
mipmaps/generate=true
|
26 |
mipmaps/limit=-1
|
27 |
roughness/mode=0
|
28 |
roughness/src_normal=""
|
|
|
32 |
process/hdr_as_srgb=false
|
33 |
process/hdr_clamp_exposure=false
|
34 |
process/size_limit=0
|
35 |
+
detect_3d/compress_to=0
|
concrete_wall_004_diff_1k.jpg.import
CHANGED
@@ -3,25 +3,26 @@
|
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://dshko3ip30c4i"
|
6 |
-
path="res://.godot/imported/concrete_wall_004_diff_1k.jpg-866ca6527ab775aadb16bf165a04e3bd.ctex"
|
7 |
metadata={
|
8 |
-
"
|
|
|
9 |
}
|
10 |
|
11 |
[deps]
|
12 |
|
13 |
source_file="res://concrete_wall_004_diff_1k.jpg"
|
14 |
-
dest_files=["res://.godot/imported/concrete_wall_004_diff_1k.jpg-866ca6527ab775aadb16bf165a04e3bd.ctex"]
|
15 |
|
16 |
[params]
|
17 |
|
18 |
-
compress/mode=
|
19 |
compress/high_quality=false
|
20 |
compress/lossy_quality=0.7
|
21 |
compress/hdr_compression=1
|
22 |
compress/normal_map=0
|
23 |
compress/channel_pack=0
|
24 |
-
mipmaps/generate=
|
25 |
mipmaps/limit=-1
|
26 |
roughness/mode=0
|
27 |
roughness/src_normal=""
|
@@ -31,4 +32,4 @@ process/normal_map_invert_y=false
|
|
31 |
process/hdr_as_srgb=false
|
32 |
process/hdr_clamp_exposure=false
|
33 |
process/size_limit=0
|
34 |
-
detect_3d/compress_to=
|
|
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://dshko3ip30c4i"
|
6 |
+
path.s3tc="res://.godot/imported/concrete_wall_004_diff_1k.jpg-866ca6527ab775aadb16bf165a04e3bd.s3tc.ctex"
|
7 |
metadata={
|
8 |
+
"imported_formats": ["s3tc_bptc"],
|
9 |
+
"vram_texture": true
|
10 |
}
|
11 |
|
12 |
[deps]
|
13 |
|
14 |
source_file="res://concrete_wall_004_diff_1k.jpg"
|
15 |
+
dest_files=["res://.godot/imported/concrete_wall_004_diff_1k.jpg-866ca6527ab775aadb16bf165a04e3bd.s3tc.ctex"]
|
16 |
|
17 |
[params]
|
18 |
|
19 |
+
compress/mode=2
|
20 |
compress/high_quality=false
|
21 |
compress/lossy_quality=0.7
|
22 |
compress/hdr_compression=1
|
23 |
compress/normal_map=0
|
24 |
compress/channel_pack=0
|
25 |
+
mipmaps/generate=true
|
26 |
mipmaps/limit=-1
|
27 |
roughness/mode=0
|
28 |
roughness/src_normal=""
|
|
|
32 |
process/hdr_as_srgb=false
|
33 |
process/hdr_clamp_exposure=false
|
34 |
process/size_limit=0
|
35 |
+
detect_3d/compress_to=0
|
concrete_wall_004_nor_gl_1k.jpg.import
CHANGED
@@ -3,32 +3,33 @@
|
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://dtdl5r8j46ocg"
|
6 |
-
path="res://.godot/imported/concrete_wall_004_nor_gl_1k.jpg-b2340a16d191e361bd651d2096627034.ctex"
|
7 |
metadata={
|
8 |
-
"
|
|
|
9 |
}
|
10 |
|
11 |
[deps]
|
12 |
|
13 |
source_file="res://concrete_wall_004_nor_gl_1k.jpg"
|
14 |
-
dest_files=["res://.godot/imported/concrete_wall_004_nor_gl_1k.jpg-b2340a16d191e361bd651d2096627034.ctex"]
|
15 |
|
16 |
[params]
|
17 |
|
18 |
-
compress/mode=
|
19 |
compress/high_quality=false
|
20 |
compress/lossy_quality=0.7
|
21 |
compress/hdr_compression=1
|
22 |
-
compress/normal_map=
|
23 |
compress/channel_pack=0
|
24 |
-
mipmaps/generate=
|
25 |
mipmaps/limit=-1
|
26 |
-
roughness/mode=
|
27 |
-
roughness/src_normal=""
|
28 |
process/fix_alpha_border=true
|
29 |
process/premult_alpha=false
|
30 |
process/normal_map_invert_y=false
|
31 |
process/hdr_as_srgb=false
|
32 |
process/hdr_clamp_exposure=false
|
33 |
process/size_limit=0
|
34 |
-
detect_3d/compress_to=
|
|
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://dtdl5r8j46ocg"
|
6 |
+
path.s3tc="res://.godot/imported/concrete_wall_004_nor_gl_1k.jpg-b2340a16d191e361bd651d2096627034.s3tc.ctex"
|
7 |
metadata={
|
8 |
+
"imported_formats": ["s3tc_bptc"],
|
9 |
+
"vram_texture": true
|
10 |
}
|
11 |
|
12 |
[deps]
|
13 |
|
14 |
source_file="res://concrete_wall_004_nor_gl_1k.jpg"
|
15 |
+
dest_files=["res://.godot/imported/concrete_wall_004_nor_gl_1k.jpg-b2340a16d191e361bd651d2096627034.s3tc.ctex"]
|
16 |
|
17 |
[params]
|
18 |
|
19 |
+
compress/mode=2
|
20 |
compress/high_quality=false
|
21 |
compress/lossy_quality=0.7
|
22 |
compress/hdr_compression=1
|
23 |
+
compress/normal_map=1
|
24 |
compress/channel_pack=0
|
25 |
+
mipmaps/generate=true
|
26 |
mipmaps/limit=-1
|
27 |
+
roughness/mode=1
|
28 |
+
roughness/src_normal="res://concrete_wall_004_nor_gl_1k.jpg"
|
29 |
process/fix_alpha_border=true
|
30 |
process/premult_alpha=false
|
31 |
process/normal_map_invert_y=false
|
32 |
process/hdr_as_srgb=false
|
33 |
process/hdr_clamp_exposure=false
|
34 |
process/size_limit=0
|
35 |
+
detect_3d/compress_to=0
|
project.godot
CHANGED
@@ -12,7 +12,7 @@ config_version=5
|
|
12 |
|
13 |
config/name="FlyBy"
|
14 |
run/main_scene="res://FlyBy.tscn"
|
15 |
-
config/features=PackedStringArray("4.
|
16 |
config/icon="res://icon.png"
|
17 |
|
18 |
[dotnet]
|
@@ -21,7 +21,7 @@ project/assembly_name="FlyBy"
|
|
21 |
|
22 |
[editor_plugins]
|
23 |
|
24 |
-
enabled=PackedStringArray()
|
25 |
|
26 |
[input]
|
27 |
|
|
|
12 |
|
13 |
config/name="FlyBy"
|
14 |
run/main_scene="res://FlyBy.tscn"
|
15 |
+
config/features=PackedStringArray("4.1", "C#")
|
16 |
config/icon="res://icon.png"
|
17 |
|
18 |
[dotnet]
|
|
|
21 |
|
22 |
[editor_plugins]
|
23 |
|
24 |
+
enabled=PackedStringArray("res://addons/godot_rl_agents/plugin.cfg")
|
25 |
|
26 |
[input]
|
27 |
|