Commit
•
f96cb80
1
Parent(s):
495a68c
Upload folder using huggingface_hub
Browse files- Ice Hockey.csproj +1 -1
- addons/godot_rl_agents/controller/ai_controller_3d.gd +0 -2
- addons/godot_rl_agents/sensors/sensors_3d/RGBCameraSensor3D.tscn +15 -14
- addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.tscn +12 -6
- project.godot +1 -1
- scenes/GameScene/AIController3D.gd +6 -0
- scenes/GameScene/pusher.tscn +17 -17
Ice Hockey.csproj
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<Project Sdk="Godot.NET.Sdk/4.1.
|
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>
|
addons/godot_rl_agents/controller/ai_controller_3d.gd
CHANGED
@@ -47,8 +47,6 @@ func _physics_process(delta):
|
|
47 |
n_steps += 1
|
48 |
if n_steps > reset_after:
|
49 |
needs_reset = true
|
50 |
-
done = true
|
51 |
-
#reward -= 1
|
52 |
|
53 |
func get_obs_space():
|
54 |
# may need overriding if the obs space is complex
|
|
|
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
|
addons/godot_rl_agents/sensors/sensors_3d/RGBCameraSensor3D.tscn
CHANGED
@@ -1,41 +1,42 @@
|
|
1 |
-
[gd_scene load_steps=3 format=
|
2 |
|
3 |
-
[ext_resource
|
4 |
|
5 |
-
[sub_resource type="ViewportTexture" id=
|
6 |
viewport_path = NodePath("SubViewport")
|
7 |
|
8 |
[node name="RGBCameraSensor3D" type="Node3D"]
|
9 |
-
script = ExtResource(
|
10 |
|
11 |
[node name="RemoteTransform3D" type="RemoteTransform3D" parent="."]
|
12 |
remote_path = NodePath("../SubViewport/Camera3D")
|
13 |
|
14 |
[node name="SubViewport" type="SubViewport" parent="."]
|
15 |
-
size =
|
16 |
render_target_update_mode = 3
|
17 |
|
18 |
[node name="Camera3D" type="Camera3D" parent="SubViewport"]
|
19 |
near = 0.5
|
20 |
|
21 |
[node name="Control" type="Control" parent="."]
|
22 |
-
layout_mode = 3
|
23 |
-
anchors_preset = 15
|
24 |
anchor_right = 1.0
|
25 |
anchor_bottom = 1.0
|
26 |
-
|
27 |
-
|
|
|
28 |
|
29 |
[node name="TextureRect" type="ColorRect" parent="Control"]
|
30 |
-
layout_mode = 0
|
31 |
offset_left = 1096.0
|
32 |
offset_top = 534.0
|
33 |
offset_right = 1114.0
|
34 |
offset_bottom = 552.0
|
35 |
-
scale = Vector2(10, 10)
|
36 |
-
color = Color(0.00784314, 0.00784314, 0.00784314, 1)
|
|
|
|
|
|
|
37 |
|
38 |
[node name="CameraTexture" type="Sprite2D" parent="Control/TextureRect"]
|
39 |
-
texture = SubResource(
|
40 |
-
offset = Vector2(9, 9)
|
41 |
flip_v = true
|
|
|
1 |
+
[gd_scene load_steps=3 format=2]
|
2 |
|
3 |
+
[ext_resource path="res://addons/godot_rl_agents/sensors/sensors_3d/RGBCameraSensor3D.gd" type="Script" id=1]
|
4 |
|
5 |
+
[sub_resource type="ViewportTexture" id=1]
|
6 |
viewport_path = NodePath("SubViewport")
|
7 |
|
8 |
[node name="RGBCameraSensor3D" type="Node3D"]
|
9 |
+
script = ExtResource( 1 )
|
10 |
|
11 |
[node name="RemoteTransform3D" type="RemoteTransform3D" parent="."]
|
12 |
remote_path = NodePath("../SubViewport/Camera3D")
|
13 |
|
14 |
[node name="SubViewport" type="SubViewport" parent="."]
|
15 |
+
size = Vector2( 32, 32 )
|
16 |
render_target_update_mode = 3
|
17 |
|
18 |
[node name="Camera3D" type="Camera3D" parent="SubViewport"]
|
19 |
near = 0.5
|
20 |
|
21 |
[node name="Control" type="Control" parent="."]
|
|
|
|
|
22 |
anchor_right = 1.0
|
23 |
anchor_bottom = 1.0
|
24 |
+
__meta__ = {
|
25 |
+
"_edit_use_anchors_": false
|
26 |
+
}
|
27 |
|
28 |
[node name="TextureRect" type="ColorRect" parent="Control"]
|
|
|
29 |
offset_left = 1096.0
|
30 |
offset_top = 534.0
|
31 |
offset_right = 1114.0
|
32 |
offset_bottom = 552.0
|
33 |
+
scale = Vector2( 10, 10 )
|
34 |
+
color = Color( 0.00784314, 0.00784314, 0.00784314, 1 )
|
35 |
+
__meta__ = {
|
36 |
+
"_edit_use_anchors_": false
|
37 |
+
}
|
38 |
|
39 |
[node name="CameraTexture" type="Sprite2D" parent="Control/TextureRect"]
|
40 |
+
texture = SubResource( 1 )
|
41 |
+
offset = Vector2( 9, 9 )
|
42 |
flip_v = true
|
addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.tscn
CHANGED
@@ -8,20 +8,26 @@ n_rays_width = 4.0
|
|
8 |
n_rays_height = 2.0
|
9 |
ray_length = 11.0
|
10 |
|
11 |
-
[node name="
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
target_position = Vector3(-1.38686, -2.84701, 10.5343)
|
13 |
|
14 |
-
[node name="node_1 1" type="RayCast3D" parent="."]
|
15 |
target_position = Vector3(-1.38686, 2.84701, 10.5343)
|
16 |
|
17 |
-
[node name="node_2 0" type="RayCast3D" parent="."]
|
18 |
target_position = Vector3(1.38686, -2.84701, 10.5343)
|
19 |
|
20 |
-
[node name="node_2 1" type="RayCast3D" parent="."]
|
21 |
target_position = Vector3(1.38686, 2.84701, 10.5343)
|
22 |
|
23 |
-
[node name="node_3 0" type="RayCast3D" parent="."]
|
24 |
target_position = Vector3(4.06608, -2.84701, 9.81639)
|
25 |
|
26 |
-
[node name="node_3 1" type="RayCast3D" parent="."]
|
27 |
target_position = Vector3(4.06608, 2.84701, 9.81639)
|
|
|
8 |
n_rays_height = 2.0
|
9 |
ray_length = 11.0
|
10 |
|
11 |
+
[node name="@node_0 0@18991" type="RayCast3D" parent="."]
|
12 |
+
target_position = Vector3(-4.06608, -2.84701, 9.81639)
|
13 |
+
|
14 |
+
[node name="node_0 1" type="RayCast3D" parent="."]
|
15 |
+
target_position = Vector3(-4.06608, 2.84701, 9.81639)
|
16 |
+
|
17 |
+
[node name="@node_1 0@18992" type="RayCast3D" parent="."]
|
18 |
target_position = Vector3(-1.38686, -2.84701, 10.5343)
|
19 |
|
20 |
+
[node name="@node_1 1@18993" type="RayCast3D" parent="."]
|
21 |
target_position = Vector3(-1.38686, 2.84701, 10.5343)
|
22 |
|
23 |
+
[node name="@node_2 0@18994" type="RayCast3D" parent="."]
|
24 |
target_position = Vector3(1.38686, -2.84701, 10.5343)
|
25 |
|
26 |
+
[node name="@node_2 1@18995" type="RayCast3D" parent="."]
|
27 |
target_position = Vector3(1.38686, 2.84701, 10.5343)
|
28 |
|
29 |
+
[node name="@node_3 0@18996" type="RayCast3D" parent="."]
|
30 |
target_position = Vector3(4.06608, -2.84701, 9.81639)
|
31 |
|
32 |
+
[node name="@node_3 1@18997" type="RayCast3D" parent="."]
|
33 |
target_position = Vector3(4.06608, 2.84701, 9.81639)
|
project.godot
CHANGED
@@ -12,7 +12,7 @@ config_version=5
|
|
12 |
|
13 |
config/name="AirHockey"
|
14 |
run/main_scene="res://scenes/TrainingScene/training_scene.tscn"
|
15 |
-
config/features=PackedStringArray("4.1", "Forward Plus")
|
16 |
config/icon="res://icon.svg"
|
17 |
|
18 |
[dotnet]
|
|
|
12 |
|
13 |
config/name="AirHockey"
|
14 |
run/main_scene="res://scenes/TrainingScene/training_scene.tscn"
|
15 |
+
config/features=PackedStringArray("4.1", "C#", "Forward Plus")
|
16 |
config/icon="res://icon.svg"
|
17 |
|
18 |
[dotnet]
|
scenes/GameScene/AIController3D.gd
CHANGED
@@ -10,6 +10,12 @@ var other_player_raycast_sensor_previous_frame
|
|
10 |
const POSITION_NORMALIZATION_FACTOR: float = 6.50
|
11 |
const VELOCITY_NORMALIZATION_FACTOR: float = 5.8
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
func get_obs() -> Dictionary:
|
14 |
# Positions and velocities are converted to the player's frame of reference
|
15 |
# Scaled to be mostly within the -1 to 1 range
|
|
|
10 |
const POSITION_NORMALIZATION_FACTOR: float = 6.50
|
11 |
const VELOCITY_NORMALIZATION_FACTOR: float = 5.8
|
12 |
|
13 |
+
func _physics_process(delta):
|
14 |
+
n_steps += 1
|
15 |
+
if n_steps > reset_after:
|
16 |
+
needs_reset = true
|
17 |
+
done = true
|
18 |
+
|
19 |
func get_obs() -> Dictionary:
|
20 |
# Positions and velocities are converted to the player's frame of reference
|
21 |
# Scaled to be mostly within the -1 to 1 range
|
scenes/GameScene/pusher.tscn
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
[gd_scene load_steps=11 format=3 uid="uid://wq350orb0r51"]
|
2 |
|
3 |
[ext_resource type="Script" path="res://scenes/GameScene/pusher.gd" id="1_u0b84"]
|
4 |
-
[ext_resource type="Script" path="res://scenes/GameScene/AIController3D.gd" id="
|
5 |
[ext_resource type="Script" path="res://addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd" id="3_nfe7c"]
|
6 |
|
7 |
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_oypsc"]
|
@@ -110,7 +110,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0618925, 0)
|
|
110 |
shape = SubResource("CylinderShape3D_22620")
|
111 |
|
112 |
[node name="AIController3D" type="Node3D" parent="."]
|
113 |
-
script = ExtResource("
|
114 |
reset_after = 2500
|
115 |
|
116 |
[node name="RayCastSensor3D" type="Node3D" parent="."]
|
@@ -122,63 +122,63 @@ ray_length = 5.0
|
|
122 |
cone_width = 360.0
|
123 |
cone_height = 1.0
|
124 |
|
125 |
-
[node name="
|
126 |
target_position = Vector3(-1.03956, 0, -4.89074)
|
127 |
collision_mask = 513
|
128 |
|
129 |
-
[node name="@RayCast3D@
|
130 |
target_position = Vector3(-2.93893, 0, -4.04508)
|
131 |
collision_mask = 513
|
132 |
|
133 |
-
[node name="
|
134 |
target_position = Vector3(-4.33013, 0, -2.5)
|
135 |
collision_mask = 513
|
136 |
|
137 |
-
[node name="@RayCast3D@
|
138 |
target_position = Vector3(-4.97261, 0, -0.522642)
|
139 |
collision_mask = 513
|
140 |
|
141 |
-
[node name="
|
142 |
target_position = Vector3(-4.75528, 0, 1.54508)
|
143 |
collision_mask = 513
|
144 |
|
145 |
-
[node name="@RayCast3D@
|
146 |
target_position = Vector3(-3.71572, 0, 3.34565)
|
147 |
collision_mask = 513
|
148 |
|
149 |
-
[node name="
|
150 |
target_position = Vector3(-2.03368, 0, 4.56773)
|
151 |
collision_mask = 513
|
152 |
|
153 |
-
[node name="@RayCast3D@
|
154 |
target_position = Vector3(0, 0, 5)
|
155 |
collision_mask = 513
|
156 |
|
157 |
-
[node name="
|
158 |
target_position = Vector3(2.03368, 0, 4.56773)
|
159 |
collision_mask = 513
|
160 |
|
161 |
-
[node name="
|
162 |
target_position = Vector3(3.71572, 0, 3.34565)
|
163 |
collision_mask = 513
|
164 |
|
165 |
-
[node name="
|
166 |
target_position = Vector3(4.75528, 0, 1.54508)
|
167 |
collision_mask = 513
|
168 |
|
169 |
-
[node name="
|
170 |
target_position = Vector3(4.97261, 0, -0.522642)
|
171 |
collision_mask = 513
|
172 |
|
173 |
-
[node name="@RayCast3D@
|
174 |
target_position = Vector3(4.33013, 0, -2.5)
|
175 |
collision_mask = 513
|
176 |
|
177 |
-
[node name="@RayCast3D@
|
178 |
target_position = Vector3(2.93893, 0, -4.04508)
|
179 |
collision_mask = 513
|
180 |
|
181 |
-
[node name="@RayCast3D@
|
182 |
target_position = Vector3(1.03956, 0, -4.89074)
|
183 |
collision_mask = 513
|
184 |
|
|
|
1 |
[gd_scene load_steps=11 format=3 uid="uid://wq350orb0r51"]
|
2 |
|
3 |
[ext_resource type="Script" path="res://scenes/GameScene/pusher.gd" id="1_u0b84"]
|
4 |
+
[ext_resource type="Script" path="res://scenes/GameScene/AIController3D.gd" id="2_24l2o"]
|
5 |
[ext_resource type="Script" path="res://addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd" id="3_nfe7c"]
|
6 |
|
7 |
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_oypsc"]
|
|
|
110 |
shape = SubResource("CylinderShape3D_22620")
|
111 |
|
112 |
[node name="AIController3D" type="Node3D" parent="."]
|
113 |
+
script = ExtResource("2_24l2o")
|
114 |
reset_after = 2500
|
115 |
|
116 |
[node name="RayCastSensor3D" type="Node3D" parent="."]
|
|
|
122 |
cone_width = 360.0
|
123 |
cone_height = 1.0
|
124 |
|
125 |
+
[node name="@RayCast3D@27274" type="RayCast3D" parent="RayCastSensor3D"]
|
126 |
target_position = Vector3(-1.03956, 0, -4.89074)
|
127 |
collision_mask = 513
|
128 |
|
129 |
+
[node name="@RayCast3D@27275" type="RayCast3D" parent="RayCastSensor3D"]
|
130 |
target_position = Vector3(-2.93893, 0, -4.04508)
|
131 |
collision_mask = 513
|
132 |
|
133 |
+
[node name="@RayCast3D@27276" type="RayCast3D" parent="RayCastSensor3D"]
|
134 |
target_position = Vector3(-4.33013, 0, -2.5)
|
135 |
collision_mask = 513
|
136 |
|
137 |
+
[node name="@RayCast3D@27277" type="RayCast3D" parent="RayCastSensor3D"]
|
138 |
target_position = Vector3(-4.97261, 0, -0.522642)
|
139 |
collision_mask = 513
|
140 |
|
141 |
+
[node name="@RayCast3D@27278" type="RayCast3D" parent="RayCastSensor3D"]
|
142 |
target_position = Vector3(-4.75528, 0, 1.54508)
|
143 |
collision_mask = 513
|
144 |
|
145 |
+
[node name="@RayCast3D@27279" type="RayCast3D" parent="RayCastSensor3D"]
|
146 |
target_position = Vector3(-3.71572, 0, 3.34565)
|
147 |
collision_mask = 513
|
148 |
|
149 |
+
[node name="@RayCast3D@27280" type="RayCast3D" parent="RayCastSensor3D"]
|
150 |
target_position = Vector3(-2.03368, 0, 4.56773)
|
151 |
collision_mask = 513
|
152 |
|
153 |
+
[node name="@RayCast3D@27281" type="RayCast3D" parent="RayCastSensor3D"]
|
154 |
target_position = Vector3(0, 0, 5)
|
155 |
collision_mask = 513
|
156 |
|
157 |
+
[node name="@RayCast3D@27282" type="RayCast3D" parent="RayCastSensor3D"]
|
158 |
target_position = Vector3(2.03368, 0, 4.56773)
|
159 |
collision_mask = 513
|
160 |
|
161 |
+
[node name="@RayCast3D@27283" type="RayCast3D" parent="RayCastSensor3D"]
|
162 |
target_position = Vector3(3.71572, 0, 3.34565)
|
163 |
collision_mask = 513
|
164 |
|
165 |
+
[node name="@RayCast3D@27284" type="RayCast3D" parent="RayCastSensor3D"]
|
166 |
target_position = Vector3(4.75528, 0, 1.54508)
|
167 |
collision_mask = 513
|
168 |
|
169 |
+
[node name="@RayCast3D@27285" type="RayCast3D" parent="RayCastSensor3D"]
|
170 |
target_position = Vector3(4.97261, 0, -0.522642)
|
171 |
collision_mask = 513
|
172 |
|
173 |
+
[node name="@RayCast3D@27286" type="RayCast3D" parent="RayCastSensor3D"]
|
174 |
target_position = Vector3(4.33013, 0, -2.5)
|
175 |
collision_mask = 513
|
176 |
|
177 |
+
[node name="@RayCast3D@27287" type="RayCast3D" parent="RayCastSensor3D"]
|
178 |
target_position = Vector3(2.93893, 0, -4.04508)
|
179 |
collision_mask = 513
|
180 |
|
181 |
+
[node name="@RayCast3D@27288" type="RayCast3D" parent="RayCastSensor3D"]
|
182 |
target_position = Vector3(1.03956, 0, -4.89074)
|
183 |
collision_mask = 513
|
184 |
|