Datasets:
Formats:
imagefolder
Size:
< 1K
Commit
•
83754d8
1
Parent(s):
1df770a
Upload . with huggingface_hub
Browse files- FlyBy.csproj +12 -0
- FlyBy.onnx +3 -0
- FlyBy.sln +19 -0
- PlaneModel.tscn +15 -5
- addons/godot_rl_agents/controller/ai_controller.gd +77 -0
- addons/godot_rl_agents/controller/ai_controller_2d.gd +8 -0
- addons/godot_rl_agents/controller/ai_controller_3d.gd +8 -0
- addons/godot_rl_agents/icon.png.import +1 -1
- addons/godot_rl_agents/onnx/csharp/ONNXInference.cs +93 -0
- addons/godot_rl_agents/onnx/csharp/SessionConfigurator.cs +106 -0
- addons/godot_rl_agents/onnx/csharp/docs/ONNXInference.xml +31 -0
- addons/godot_rl_agents/onnx/csharp/docs/SessionConfigurator.xml +29 -0
- addons/godot_rl_agents/onnx/wrapper/ONNX_wrapper.gd +19 -0
- addons/godot_rl_agents/sensors/sensors_2d/ExampleRaycastSensor2D.tscn +11 -11
- addons/godot_rl_agents/sensors/sensors_2d/ISensor2D.gd +1 -1
- addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd +30 -6
- addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.tscn +4 -3
- addons/godot_rl_agents/sensors/sensors_3d/ISensor3D.gd +1 -1
- addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd +7 -7
- addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.tscn +26 -42
- addons/godot_rl_agents/sync.gd +119 -78
- alps_field_2k.hdr.import +4 -5
- bin/FlyBy.console.exe +0 -0
- bin/FlyBy.exe +2 -2
- bin/FlyBy.pck +2 -2
- bin/FlyBy.sh +4 -0
- bin/FlyBy.x86_64 +2 -2
- concrete_wall_004_ao_1k.jpg.import +3 -4
- concrete_wall_004_arm_1k.jpg.import +3 -4
- concrete_wall_004_diff_1k.jpg.import +3 -4
- concrete_wall_004_nor_gl_1k.jpg.import +3 -4
- export_presets.cfg +5 -109
- project.godot +10 -40
FlyBy.csproj
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<Project Sdk="Godot.NET.Sdk/4.0.2">
|
2 |
+
<PropertyGroup>
|
3 |
+
<TargetFramework>net6.0</TargetFramework>
|
4 |
+
<EnableDynamicLoading>true</EnableDynamicLoading>
|
5 |
+
</PropertyGroup>
|
6 |
+
<ItemGroup>
|
7 |
+
<PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.14.1" />
|
8 |
+
<PackageReference Include="Microsoft.ML.OnnxRuntime.DirectML" Version="1.14.1" />
|
9 |
+
<PackageReference Include="Microsoft.ML.OnnxRuntime.Gpu" Version="1.14.1" />
|
10 |
+
<PackageReference Include="System.Numerics.Tensors" Version="0.1.0" />
|
11 |
+
</ItemGroup>
|
12 |
+
</Project>
|
FlyBy.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:933de1f9ca8317c0efde301a441582ebe0ac338f7d9020c3d816631530628ddd
|
3 |
+
size 21197
|
FlyBy.sln
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Microsoft Visual Studio Solution File, Format Version 12.00
|
2 |
+
# Visual Studio 2012
|
3 |
+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlyBy", "FlyBy.csproj", "{7B8CB6A1-66D5-4D2F-A0B2-8B032CD05D91}"
|
4 |
+
EndProject
|
5 |
+
Global
|
6 |
+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
7 |
+
Debug|Any CPU = Debug|Any CPU
|
8 |
+
ExportDebug|Any CPU = ExportDebug|Any CPU
|
9 |
+
ExportRelease|Any CPU = ExportRelease|Any CPU
|
10 |
+
EndGlobalSection
|
11 |
+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
12 |
+
{7B8CB6A1-66D5-4D2F-A0B2-8B032CD05D91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
13 |
+
{7B8CB6A1-66D5-4D2F-A0B2-8B032CD05D91}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
14 |
+
{7B8CB6A1-66D5-4D2F-A0B2-8B032CD05D91}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
|
15 |
+
{7B8CB6A1-66D5-4D2F-A0B2-8B032CD05D91}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
|
16 |
+
{7B8CB6A1-66D5-4D2F-A0B2-8B032CD05D91}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
|
17 |
+
{7B8CB6A1-66D5-4D2F-A0B2-8B032CD05D91}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
|
18 |
+
EndGlobalSection
|
19 |
+
EndGlobal
|
PlaneModel.tscn
CHANGED
@@ -1,9 +1,19 @@
|
|
1 |
-
[gd_scene load_steps=2 format=
|
2 |
|
3 |
-
[ext_resource
|
4 |
|
5 |
-
[node name="PlaneModel" instance=ExtResource(
|
6 |
-
transform = Transform3D(0.01, 0, 0, 0, 0.01, 0, 0, 0, 0.01, 0, 0, 0)
|
7 |
|
8 |
[node name="RootNode (gltf orientation matrix)" parent="." index="0"]
|
9 |
-
transform = Transform3D(-1, 8.74228e-08, 3.82137e-15, 0, -4.37114e-08, 1, 8.74228e-08, 1, 4.37114e-08, 0, 0, 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[gd_scene load_steps=2 format=2]
|
2 |
|
3 |
+
[ext_resource path="res://cartoon_plane/scene.gltf" type="PackedScene" id=1]
|
4 |
|
5 |
+
[node name="PlaneModel" instance=ExtResource( 1 )]
|
6 |
+
transform = Transform3D( 0.01, 0, 0, 0, 0.01, 0, 0, 0, 0.01, 0, 0, 0 )
|
7 |
|
8 |
[node name="RootNode (gltf orientation matrix)" parent="." index="0"]
|
9 |
+
transform = Transform3D( -1, 8.74228e-08, 3.82137e-15, 0, -4.37114e-08, 1, 8.74228e-08, 1, 4.37114e-08, 0, 0, 0 )
|
10 |
+
|
11 |
+
[node name="Propeller_1" parent="RootNode (gltf orientation matrix)/RootNode (model correction matrix)/12cc6a9ff2ae45b08826ba235d9cb8b7fbx/Node/RootNode" index="0"]
|
12 |
+
transform = Transform3D( -0.791092, -0.611698, 0, 0.611698, -0.791092, 0, 0, 0, 1, 0.873349, -46.0248, 401.434 )
|
13 |
+
|
14 |
+
[node name="Physical_Sky" parent="RootNode (gltf orientation matrix)/RootNode (model correction matrix)/12cc6a9ff2ae45b08826ba235d9cb8b7fbx/Node/RootNode" index="1"]
|
15 |
+
transform = Transform3D( 0.879922, 0.00248785, -0.475112, 0.0222404, 0.998674, 0.0464192, 0.474598, -0.051412, 0.8787, 0, 0, 0 )
|
16 |
+
visible = false
|
17 |
+
|
18 |
+
[node name="Shadow_Plane" parent="RootNode (gltf orientation matrix)/RootNode (model correction matrix)/12cc6a9ff2ae45b08826ba235d9cb8b7fbx/Node/RootNode/Physical_Sky" index="1"]
|
19 |
+
visible = false
|
addons/godot_rl_agents/controller/ai_controller.gd
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends Node
|
2 |
+
class_name AIController
|
3 |
+
|
4 |
+
# ------------------ Godot RL Agents Logic ------------------------------------#
|
5 |
+
@export var reset_after := 1000
|
6 |
+
|
7 |
+
var heuristic := "human"
|
8 |
+
var done := false
|
9 |
+
var reward := 0.0
|
10 |
+
var n_steps := 0
|
11 |
+
|
12 |
+
var needs_reset := false
|
13 |
+
|
14 |
+
func _ready():
|
15 |
+
add_to_group("AGENT")
|
16 |
+
|
17 |
+
#-- Methods that need implementing using the "extend script" option in Godot --#
|
18 |
+
func get_obs() -> Dictionary:
|
19 |
+
assert(false, "the get_obs method is not implemented when extending from ai_controller")
|
20 |
+
return {"obs":[]}
|
21 |
+
|
22 |
+
func get_reward() -> float:
|
23 |
+
assert(false, "the get_reward method is not implemented when extending from ai_controller")
|
24 |
+
return 0.0
|
25 |
+
|
26 |
+
func get_action_space() -> Dictionary:
|
27 |
+
assert(false, "the get get_action_space method is not implemented when extending from ai_controller")
|
28 |
+
return {
|
29 |
+
"example_actions_continous" : {
|
30 |
+
"size": 2,
|
31 |
+
"action_type": "continuous"
|
32 |
+
},
|
33 |
+
"example_actions_discrete" : {
|
34 |
+
"size": 2,
|
35 |
+
"action_type": "discrete"
|
36 |
+
},
|
37 |
+
}
|
38 |
+
|
39 |
+
func set_action(action) -> void:
|
40 |
+
assert(false, "the get set_action method is not implemented when extending from ai_controller")
|
41 |
+
# -----------------------------------------------------------------------------#
|
42 |
+
|
43 |
+
func _physics_process(delta):
|
44 |
+
n_steps += 1
|
45 |
+
if n_steps > reset_after:
|
46 |
+
needs_reset = true
|
47 |
+
|
48 |
+
func get_obs_space():
|
49 |
+
# may need overriding if the obs space is complex
|
50 |
+
var obs = get_obs()
|
51 |
+
return {
|
52 |
+
"obs": {
|
53 |
+
"size": [len(obs["obs"])],
|
54 |
+
"space": "box"
|
55 |
+
},
|
56 |
+
}
|
57 |
+
|
58 |
+
func reset():
|
59 |
+
n_steps = 0
|
60 |
+
needs_reset = false
|
61 |
+
|
62 |
+
func reset_if_done():
|
63 |
+
if done:
|
64 |
+
reset()
|
65 |
+
|
66 |
+
func set_heuristic(h):
|
67 |
+
# sets the heuristic from "human" or "model" nothing to change here
|
68 |
+
heuristic = h
|
69 |
+
|
70 |
+
func get_done():
|
71 |
+
return done
|
72 |
+
|
73 |
+
func set_done_false():
|
74 |
+
done = false
|
75 |
+
|
76 |
+
func zero_reward():
|
77 |
+
reward = 0.0
|
addons/godot_rl_agents/controller/ai_controller_2d.gd
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends AIController
|
2 |
+
class_name AIController2D
|
3 |
+
|
4 |
+
# ------------------ Godot RL Agents Logic ------------------------------------#
|
5 |
+
var _player: Node2D
|
6 |
+
|
7 |
+
func init(player: Node2D):
|
8 |
+
_player = player
|
addons/godot_rl_agents/controller/ai_controller_3d.gd
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends AIController
|
2 |
+
class_name AIController3D
|
3 |
+
|
4 |
+
# ------------------ Godot RL Agents Logic ------------------------------------#
|
5 |
+
var _player: Node3D
|
6 |
+
|
7 |
+
func init(player: Node3D):
|
8 |
+
_player = player
|
addons/godot_rl_agents/icon.png.import
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
-
uid="uid://
|
6 |
path="res://.godot/imported/icon.png-45a871b53434e556222f5901d598ab34.ctex"
|
7 |
metadata={
|
8 |
"vram_texture": false
|
|
|
2 |
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
+
uid="uid://dn7mfntm1bfv4"
|
6 |
path="res://.godot/imported/icon.png-45a871b53434e556222f5901d598ab34.ctex"
|
7 |
metadata={
|
8 |
"vram_texture": false
|
addons/godot_rl_agents/onnx/csharp/ONNXInference.cs
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
private InferenceSession session;
|
13 |
+
/// <summary>
|
14 |
+
/// Path to the ONNX model. Use Initialize to change it.
|
15 |
+
/// </summary>
|
16 |
+
private string modelPath;
|
17 |
+
private int batchSize;
|
18 |
+
|
19 |
+
private SessionOptions SessionOpt;
|
20 |
+
|
21 |
+
//init function
|
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"]/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 |
+
|
55 |
+
try{
|
56 |
+
results = session.Run(inputs, outputNames);
|
57 |
+
}
|
58 |
+
catch (OnnxRuntimeException e) {
|
59 |
+
//This error usually means that the model is not compatible with the input, beacause of the input shape (size)
|
60 |
+
GD.Print("Error at inference: ", e);
|
61 |
+
return null;
|
62 |
+
}
|
63 |
+
//Can't convert IEnumerable<float> to Variant, so we have to convert it to an array or something
|
64 |
+
Godot.Collections.Dictionary<string, Godot.Collections.Array<float>> output = new Godot.Collections.Dictionary<string, Godot.Collections.Array<float>>();
|
65 |
+
DisposableNamedOnnxValue output1 = results.First();
|
66 |
+
DisposableNamedOnnxValue output2 = results.Last();
|
67 |
+
Godot.Collections.Array<float> output1Array = new Godot.Collections.Array<float>();
|
68 |
+
Godot.Collections.Array<float> output2Array = new Godot.Collections.Array<float>();
|
69 |
+
|
70 |
+
foreach (float f in output1.AsEnumerable<float>()) {
|
71 |
+
output1Array.Add(f);
|
72 |
+
}
|
73 |
+
|
74 |
+
foreach (float f in output2.AsEnumerable<float>()) {
|
75 |
+
output2Array.Add(f);
|
76 |
+
}
|
77 |
+
|
78 |
+
output.Add(output1.Name, output1Array);
|
79 |
+
output.Add(output2.Name, output2Array);
|
80 |
+
|
81 |
+
//Output is a dictionary of arrays, ex: { "output" : [0.1, 0.2, 0.3, 0.4, ...], "state_outs" : [0.5, ...]}
|
82 |
+
return output;
|
83 |
+
}
|
84 |
+
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/Load/*'/>
|
85 |
+
public InferenceSession LoadModel(string Path)
|
86 |
+
{
|
87 |
+
Godot.FileAccess file = FileAccess.Open(Path, Godot.FileAccess.ModeFlags.Read);
|
88 |
+
byte[] model = file.GetBuffer((int)file.GetLength());
|
89 |
+
file.Close();
|
90 |
+
return new InferenceSession(model, SessionOpt); //Load the model
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
addons/godot_rl_agents/onnx/csharp/SessionConfigurator.cs
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
using Godot;
|
2 |
+
using Microsoft.ML.OnnxRuntime;
|
3 |
+
|
4 |
+
namespace GodotONNX{
|
5 |
+
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/SessionConfigurator/*'/>
|
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 public void SystemCheck()
|
22 |
+
{
|
23 |
+
//Most code for this function is verbose only, the only reason it exists is to track
|
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 |
+
case "Windows": //Can use CUDA, DirectML
|
45 |
+
if (ComputeAPIID == 0)
|
46 |
+
{
|
47 |
+
//CUDA
|
48 |
+
//options.AppendExecutionProvider_CUDA(0);
|
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 |
+
public static int ComputeCheck()
|
87 |
+
{
|
88 |
+
string adapterName = Godot.RenderingServer.GetVideoAdapterName();
|
89 |
+
//string adapterVendor = Godot.RenderingServer.GetVideoAdapterVendor();
|
90 |
+
adapterName = adapterName.ToUpper(new System.Globalization.CultureInfo(""));
|
91 |
+
//TODO: GPU vendors for MacOS, what do they even use these days?
|
92 |
+
if (adapterName.Contains("INTEL")) {
|
93 |
+
//Return 2, should use DirectML only
|
94 |
+
return 2;}
|
95 |
+
if (adapterName.Contains("AMD")) {
|
96 |
+
//Return 1, should use DirectML, check later for ROCm
|
97 |
+
return 1;}
|
98 |
+
if (adapterName.Contains("NVIDIA")){
|
99 |
+
//Return 0, should use CUDA
|
100 |
+
return 0;}
|
101 |
+
|
102 |
+
GD.Print("Graphics Card not recognized."); //Return -1, should use CPU
|
103 |
+
return -1;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
addons/godot_rl_agents/onnx/csharp/docs/ONNXInference.xml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<docs>
|
2 |
+
<members name="ONNXInference">
|
3 |
+
<ONNXInference>
|
4 |
+
<summary>
|
5 |
+
The main <c>ONNXInference</c> Class that handles the inference process.
|
6 |
+
</summary>
|
7 |
+
</ONNXInference>
|
8 |
+
<Initialize>
|
9 |
+
<summary>
|
10 |
+
Starts the inference process.
|
11 |
+
</summary>
|
12 |
+
<param name="Path">Path to the ONNX model, expects a path inside resources.</param>
|
13 |
+
<param name="BatchSize">How many observations will the model recieve.</param>
|
14 |
+
</Initialize>
|
15 |
+
<Run>
|
16 |
+
<summary>
|
17 |
+
Runs the given input through the model and returns the output.
|
18 |
+
</summary>
|
19 |
+
<param name="obs">Dictionary containing all observations.</param>
|
20 |
+
<param name="state_ins">How many different agents are creating these observations.</param>
|
21 |
+
<returns>A Dictionary of arrays, containing instructions based on the observations.</returns>
|
22 |
+
</Run>
|
23 |
+
<Load>
|
24 |
+
<summary>
|
25 |
+
Loads the given model into the inference process, using the best Execution provider available.
|
26 |
+
</summary>
|
27 |
+
<param name="Path">Path to the ONNX model, expects a path inside resources.</param>
|
28 |
+
<returns>InferenceSession ready to run.</returns>
|
29 |
+
</Load>
|
30 |
+
</members>
|
31 |
+
</docs>
|
addons/godot_rl_agents/onnx/csharp/docs/SessionConfigurator.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<docs>
|
2 |
+
<members name="SessionConfigurator">
|
3 |
+
<SessionConfigurator>
|
4 |
+
<summary>
|
5 |
+
The main <c>SessionConfigurator</c> Class that handles the execution options and providers for the inference process.
|
6 |
+
</summary>
|
7 |
+
</SessionConfigurator>
|
8 |
+
<GetSessionOptions>
|
9 |
+
<summary>
|
10 |
+
Creates a SessionOptions with all available execution providers.
|
11 |
+
</summary>
|
12 |
+
<returns>SessionOptions with all available execution providers.</returns>
|
13 |
+
</GetSessionOptions>
|
14 |
+
<SystemCheck>
|
15 |
+
<summary>
|
16 |
+
Appends any execution provider available in the current system.
|
17 |
+
</summary>
|
18 |
+
<remarks>
|
19 |
+
This function is mainly verbose for tracking implementation progress of different compute APIs.
|
20 |
+
</remarks>
|
21 |
+
</SystemCheck>
|
22 |
+
<ComputeCheck>
|
23 |
+
<summary>
|
24 |
+
Checks for available GPUs.
|
25 |
+
</summary>
|
26 |
+
<returns>An integer identifier for each compute platform.</returns>
|
27 |
+
</ComputeCheck>
|
28 |
+
</members>
|
29 |
+
</docs>
|
addons/godot_rl_agents/onnx/wrapper/ONNX_wrapper.gd
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends Node
|
2 |
+
class_name ONNXModel
|
3 |
+
var inferencer_script = load("res://addons/godot_rl_agents/onnx/csharp/ONNXInference.cs")
|
4 |
+
|
5 |
+
var inferencer = null
|
6 |
+
|
7 |
+
# Must provide the path to the model and the batch size
|
8 |
+
func _init(model_path, batch_size):
|
9 |
+
inferencer = inferencer_script.new()
|
10 |
+
inferencer.Initialize(model_path, batch_size)
|
11 |
+
|
12 |
+
# This function is the one that will be called from the game,
|
13 |
+
# requires the observation as an array and the state_ins as an int
|
14 |
+
# returns an Array containing the action the model takes.
|
15 |
+
func run_inference(obs : Array, state_ins : int) -> Dictionary:
|
16 |
+
if inferencer == null:
|
17 |
+
printerr("Inferencer not initialized")
|
18 |
+
return {}
|
19 |
+
return inferencer.RunInference(obs, state_ins)
|
addons/godot_rl_agents/sensors/sensors_2d/ExampleRaycastSensor2D.tscn
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
[gd_scene load_steps=5 format=
|
2 |
|
3 |
-
[ext_resource path="res://sensors/sensors_2d/RaycastSensor2D.gd"
|
4 |
|
5 |
-
[sub_resource type="GDScript" id=2]
|
6 |
script/source = "extends Node2D
|
7 |
|
8 |
|
@@ -12,7 +12,7 @@ func _physics_process(delta: float) -> void:
|
|
12 |
|
13 |
"
|
14 |
|
15 |
-
[sub_resource type="GDScript" id=1]
|
16 |
script/source = "extends RayCast2D
|
17 |
|
18 |
var steps = 1
|
@@ -26,23 +26,23 @@ func _physics_process(delta: float) -> void:
|
|
26 |
print(is_colliding())
|
27 |
"
|
28 |
|
29 |
-
[sub_resource type="CircleShape2D" id=3]
|
30 |
|
31 |
[node name="ExampleRaycastSensor2D" type="Node2D"]
|
32 |
-
script = SubResource(
|
33 |
|
34 |
[node name="ExampleAgent" type="Node2D" parent="."]
|
35 |
-
position = Vector2(
|
36 |
rotation = 0.286234
|
37 |
|
38 |
[node name="RaycastSensor2D" type="Node2D" parent="ExampleAgent"]
|
39 |
-
script = ExtResource(
|
40 |
|
41 |
[node name="TestRayCast2D" type="RayCast2D" parent="."]
|
42 |
-
script = SubResource(
|
43 |
|
44 |
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
45 |
-
position = Vector2(
|
46 |
|
47 |
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
48 |
-
shape = SubResource(
|
|
|
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
|
7 |
|
8 |
|
|
|
12 |
|
13 |
"
|
14 |
|
15 |
+
[sub_resource type="GDScript" id="1"]
|
16 |
script/source = "extends RayCast2D
|
17 |
|
18 |
var steps = 1
|
|
|
26 |
print(is_colliding())
|
27 |
"
|
28 |
|
29 |
+
[sub_resource type="CircleShape2D" id="3"]
|
30 |
|
31 |
[node name="ExampleRaycastSensor2D" type="Node2D"]
|
32 |
+
script = SubResource("2")
|
33 |
|
34 |
[node name="ExampleAgent" type="Node2D" parent="."]
|
35 |
+
position = Vector2(573, 314)
|
36 |
rotation = 0.286234
|
37 |
|
38 |
[node name="RaycastSensor2D" type="Node2D" parent="ExampleAgent"]
|
39 |
+
script = ExtResource("1")
|
40 |
|
41 |
[node name="TestRayCast2D" type="RayCast2D" parent="."]
|
42 |
+
script = SubResource("1")
|
43 |
|
44 |
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
45 |
+
position = Vector2(1, 52)
|
46 |
|
47 |
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
48 |
+
shape = SubResource("3")
|
addons/godot_rl_agents/sensors/sensors_2d/ISensor2D.gd
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
extends Node2D
|
2 |
class_name ISensor2D
|
3 |
|
4 |
-
var _obs : Array
|
5 |
var _active := false
|
6 |
|
7 |
func get_observation():
|
|
|
1 |
extends Node2D
|
2 |
class_name ISensor2D
|
3 |
|
4 |
+
var _obs : Array = []
|
5 |
var _active := false
|
6 |
|
7 |
func get_observation():
|
addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd
CHANGED
@@ -2,24 +2,42 @@
|
|
2 |
extends ISensor2D
|
3 |
class_name RaycastSensor2D
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
@export var n_rays := 16.0:
|
6 |
get: return n_rays
|
7 |
set(value):
|
8 |
n_rays = value
|
9 |
_update()
|
10 |
|
11 |
-
@
|
12 |
get: return ray_length
|
13 |
set(value):
|
14 |
ray_length = value
|
15 |
_update()
|
16 |
-
@
|
17 |
get: return cone_width
|
18 |
set(value):
|
19 |
cone_width = value
|
20 |
_update()
|
21 |
|
22 |
-
@export var debug_draw :=
|
23 |
get: return debug_draw
|
24 |
set(value):
|
25 |
debug_draw = value
|
@@ -31,12 +49,16 @@ var rays := []
|
|
31 |
|
32 |
func _update():
|
33 |
if Engine.is_editor_hint():
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
func _ready() -> void:
|
37 |
_spawn_nodes()
|
38 |
|
39 |
-
|
40 |
func _spawn_nodes():
|
41 |
for ray in rays:
|
42 |
ray.queue_free()
|
@@ -55,7 +77,9 @@ func _spawn_nodes():
|
|
55 |
))
|
56 |
ray.set_name("node_"+str(i))
|
57 |
ray.enabled = true
|
58 |
-
ray.collide_with_areas =
|
|
|
|
|
59 |
add_child(ray)
|
60 |
rays.append(ray)
|
61 |
|
|
|
2 |
extends ISensor2D
|
3 |
class_name RaycastSensor2D
|
4 |
|
5 |
+
@export_flags_2d_physics var collision_mask := 1:
|
6 |
+
get: return collision_mask
|
7 |
+
set(value):
|
8 |
+
collision_mask = value
|
9 |
+
_update()
|
10 |
+
|
11 |
+
@export var collide_with_areas := false:
|
12 |
+
get: return collide_with_areas
|
13 |
+
set(value):
|
14 |
+
collide_with_areas = value
|
15 |
+
_update()
|
16 |
+
|
17 |
+
@export var collide_with_bodies := true:
|
18 |
+
get: return collide_with_bodies
|
19 |
+
set(value):
|
20 |
+
collide_with_bodies = value
|
21 |
+
_update()
|
22 |
+
|
23 |
@export var n_rays := 16.0:
|
24 |
get: return n_rays
|
25 |
set(value):
|
26 |
n_rays = value
|
27 |
_update()
|
28 |
|
29 |
+
@export_range(5,200,5.0) var ray_length := 200:
|
30 |
get: return ray_length
|
31 |
set(value):
|
32 |
ray_length = value
|
33 |
_update()
|
34 |
+
@export_range(5,360,5.0) var cone_width := 360.0:
|
35 |
get: return cone_width
|
36 |
set(value):
|
37 |
cone_width = value
|
38 |
_update()
|
39 |
|
40 |
+
@export var debug_draw := true :
|
41 |
get: return debug_draw
|
42 |
set(value):
|
43 |
debug_draw = value
|
|
|
49 |
|
50 |
func _update():
|
51 |
if Engine.is_editor_hint():
|
52 |
+
if debug_draw:
|
53 |
+
_spawn_nodes()
|
54 |
+
else:
|
55 |
+
for ray in get_children():
|
56 |
+
if ray is RayCast2D:
|
57 |
+
remove_child(ray)
|
58 |
|
59 |
func _ready() -> void:
|
60 |
_spawn_nodes()
|
61 |
|
|
|
62 |
func _spawn_nodes():
|
63 |
for ray in rays:
|
64 |
ray.queue_free()
|
|
|
77 |
))
|
78 |
ray.set_name("node_"+str(i))
|
79 |
ray.enabled = true
|
80 |
+
ray.collide_with_areas = collide_with_areas
|
81 |
+
ray.collide_with_bodies = collide_with_bodies
|
82 |
+
ray.collision_mask = collision_mask
|
83 |
add_child(ray)
|
84 |
rays.append(ray)
|
85 |
|
addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.tscn
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
-
[gd_scene load_steps=2 format=
|
2 |
|
3 |
-
[ext_resource path="res://addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd"
|
4 |
|
5 |
[node name="RaycastSensor2D" type="Node2D"]
|
6 |
-
script = ExtResource(
|
|
|
|
1 |
+
[gd_scene load_steps=2 format=3 uid="uid://drvfihk5esgmv"]
|
2 |
|
3 |
+
[ext_resource type="Script" path="res://addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd" id="1"]
|
4 |
|
5 |
[node name="RaycastSensor2D" type="Node2D"]
|
6 |
+
script = ExtResource("1")
|
7 |
+
n_rays = 17.0
|
addons/godot_rl_agents/sensors/sensors_3d/ISensor3D.gd
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
extends Node3D
|
2 |
class_name ISensor3D
|
3 |
|
4 |
-
var _obs : Array
|
5 |
var _active := false
|
6 |
|
7 |
func get_observation():
|
|
|
1 |
extends Node3D
|
2 |
class_name ISensor3D
|
3 |
|
4 |
+
var _obs : Array = []
|
5 |
var _active := false
|
6 |
|
7 |
func get_observation():
|
addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd
CHANGED
@@ -10,7 +10,7 @@ class_name RayCastSensor3D
|
|
10 |
get: return boolean_class_mask
|
11 |
set(value):
|
12 |
boolean_class_mask = value
|
13 |
-
_update()
|
14 |
|
15 |
@export var n_rays_width := 6.0:
|
16 |
get: return n_rays_width
|
@@ -42,18 +42,18 @@ class_name RayCastSensor3D
|
|
42 |
cone_height = value
|
43 |
_update()
|
44 |
|
45 |
-
@export var collide_with_bodies := true:
|
46 |
-
get: return collide_with_bodies
|
47 |
-
set(value):
|
48 |
-
collide_with_bodies = value
|
49 |
-
_update()
|
50 |
-
|
51 |
@export var collide_with_areas := false:
|
52 |
get: return collide_with_areas
|
53 |
set(value):
|
54 |
collide_with_areas = value
|
55 |
_update()
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
@export var class_sensor := false
|
58 |
|
59 |
var rays := []
|
|
|
10 |
get: return boolean_class_mask
|
11 |
set(value):
|
12 |
boolean_class_mask = value
|
13 |
+
_update()
|
14 |
|
15 |
@export var n_rays_width := 6.0:
|
16 |
get: return n_rays_width
|
|
|
42 |
cone_height = value
|
43 |
_update()
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
@export var collide_with_areas := false:
|
46 |
get: return collide_with_areas
|
47 |
set(value):
|
48 |
collide_with_areas = value
|
49 |
_update()
|
50 |
|
51 |
+
@export var collide_with_bodies := true:
|
52 |
+
get: return collide_with_bodies
|
53 |
+
set(value):
|
54 |
+
collide_with_bodies = value
|
55 |
+
_update()
|
56 |
+
|
57 |
@export var class_sensor := false
|
58 |
|
59 |
var rays := []
|
addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.tscn
CHANGED
@@ -1,49 +1,33 @@
|
|
1 |
-
[gd_scene load_steps=2 format=
|
2 |
|
3 |
-
[ext_resource path="res://addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd"
|
4 |
|
5 |
[node name="RaycastSensor3D" type="Node3D"]
|
6 |
-
script = ExtResource(
|
7 |
n_rays_width = 4.0
|
8 |
n_rays_height = 2.0
|
9 |
ray_length = 11.0
|
10 |
|
11 |
-
[node name="node_0
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
[node name="
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
collide_with_areas = true
|
35 |
-
|
36 |
-
[node name="node_2 1" type="RayCast3D" parent="."]
|
37 |
-
enabled = true
|
38 |
-
cast_to = Vector3( 1.38686, 2.84701, 10.5343 )
|
39 |
-
collide_with_areas = true
|
40 |
-
|
41 |
-
[node name="node_3 0" type="RayCast3D" parent="."]
|
42 |
-
enabled = true
|
43 |
-
cast_to = Vector3( 4.06608, -2.84701, 9.81639 )
|
44 |
-
collide_with_areas = true
|
45 |
-
|
46 |
-
[node name="node_3 1" type="RayCast3D" parent="."]
|
47 |
-
enabled = true
|
48 |
-
cast_to = Vector3( 4.06608, 2.84701, 9.81639 )
|
49 |
-
collide_with_areas = true
|
|
|
1 |
+
[gd_scene load_steps=2 format=3 uid="uid://b803cbh1fmy66"]
|
2 |
|
3 |
+
[ext_resource type="Script" path="res://addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd" id="1"]
|
4 |
|
5 |
[node name="RaycastSensor3D" type="Node3D"]
|
6 |
+
script = ExtResource("1")
|
7 |
n_rays_width = 4.0
|
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/godot_rl_agents/sync.gd
CHANGED
@@ -2,7 +2,9 @@ extends Node
|
|
2 |
# --fixed-fps 2000 --disable-render-loop
|
3 |
@export var action_repeat := 8
|
4 |
@export var speed_up = 1
|
5 |
-
var
|
|
|
|
|
6 |
|
7 |
const MAJOR_VERSION := "0"
|
8 |
const MINOR_VERSION := "3"
|
@@ -16,21 +18,122 @@ var should_connect = true
|
|
16 |
var agents
|
17 |
var need_to_send_obs = false
|
18 |
var args = null
|
19 |
-
@onready var start_time = Time.get_ticks_msec()
|
20 |
var initialized = false
|
21 |
var just_reset = false
|
|
|
|
|
22 |
|
|
|
|
|
23 |
|
24 |
# Called when the node enters the scene tree for the first time.
|
25 |
|
26 |
func _ready():
|
27 |
-
|
28 |
await get_tree().root.ready
|
29 |
get_tree().set_pause(true)
|
30 |
_initialize()
|
31 |
await get_tree().create_timer(1.0).timeout
|
32 |
get_tree().set_pause(false)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
func _get_agents():
|
35 |
agents = get_tree().get_nodes_in_group("AGENT")
|
36 |
|
@@ -75,17 +178,16 @@ func _send_dict_as_json_message(dict):
|
|
75 |
func _send_env_info():
|
76 |
var json_dict = _get_dict_json_message()
|
77 |
assert(json_dict["type"] == "env_info")
|
78 |
-
|
|
|
79 |
var message = {
|
80 |
"type" : "env_info",
|
81 |
-
|
82 |
-
"
|
83 |
-
"action_space":agents[0].get_action_space(),
|
84 |
"n_agents": len(agents)
|
85 |
}
|
86 |
_send_dict_as_json_message(message)
|
87 |
|
88 |
-
|
89 |
func connect_to_server():
|
90 |
print("Waiting for one second to allow server to start")
|
91 |
OS.delay_msec(1000)
|
@@ -98,17 +200,13 @@ func connect_to_server():
|
|
98 |
var connect = stream.connect_to_host(ip, port)
|
99 |
stream.set_no_delay(true) # TODO check if this improves performance or not
|
100 |
stream.poll()
|
|
|
|
|
|
|
101 |
return stream.get_status() == 2
|
102 |
|
103 |
func _get_args():
|
104 |
print("getting command line arguments")
|
105 |
-
# var arguments = {}
|
106 |
-
# for argument in OS.get_cmdline_args():
|
107 |
-
# # Parse valid command-line arguments into a dictionary
|
108 |
-
# if argument.find("=") > -1:
|
109 |
-
# var key_value = argument.split("=")
|
110 |
-
# arguments[key_value[0].lstrip("--")] = key_value[1]
|
111 |
-
|
112 |
var arguments = {}
|
113 |
for argument in OS.get_cmdline_args():
|
114 |
print(argument)
|
@@ -139,70 +237,7 @@ func _set_action_repeat():
|
|
139 |
func disconnect_from_server():
|
140 |
stream.disconnect_from_host()
|
141 |
|
142 |
-
func _initialize():
|
143 |
-
_get_agents()
|
144 |
-
|
145 |
-
args = _get_args()
|
146 |
-
Engine.physics_ticks_per_second = _get_speedup() * 60 # Replace with function body.
|
147 |
-
Engine.time_scale = _get_speedup() * 1.0
|
148 |
-
prints("physics ticks", Engine.physics_ticks_per_second, Engine.time_scale, _get_speedup(), speed_up)
|
149 |
-
|
150 |
-
connected = connect_to_server()
|
151 |
-
if connected:
|
152 |
-
_set_heuristic("model")
|
153 |
-
_handshake()
|
154 |
-
_send_env_info()
|
155 |
-
else:
|
156 |
-
_set_heuristic("human")
|
157 |
-
|
158 |
-
_set_seed()
|
159 |
-
_set_action_repeat()
|
160 |
-
initialized = true
|
161 |
-
|
162 |
-
func _physics_process(delta):
|
163 |
-
# two modes, human control, agent control
|
164 |
-
# pause tree, send obs, get actions, set actions, unpause tree
|
165 |
-
if n_action_steps % action_repeat != 0:
|
166 |
-
n_action_steps += 1
|
167 |
-
return
|
168 |
|
169 |
-
n_action_steps += 1
|
170 |
-
|
171 |
-
if connected:
|
172 |
-
get_tree().set_pause(true)
|
173 |
-
|
174 |
-
if just_reset:
|
175 |
-
just_reset = false
|
176 |
-
var obs = _get_obs_from_agents()
|
177 |
-
|
178 |
-
var reply = {
|
179 |
-
"type": "reset",
|
180 |
-
"obs": obs
|
181 |
-
}
|
182 |
-
_send_dict_as_json_message(reply)
|
183 |
-
# this should go straight to getting the action and setting it checked the agent, no need to perform one phyics tick
|
184 |
-
get_tree().set_pause(false)
|
185 |
-
return
|
186 |
-
|
187 |
-
if need_to_send_obs:
|
188 |
-
need_to_send_obs = false
|
189 |
-
var reward = _get_reward_from_agents()
|
190 |
-
var done = _get_done_from_agents()
|
191 |
-
#_reset_agents_if_done() # this ensures the new observation is from the next env instance : NEEDS REFACTOR
|
192 |
-
|
193 |
-
var obs = _get_obs_from_agents()
|
194 |
-
|
195 |
-
var reply = {
|
196 |
-
"type": "step",
|
197 |
-
"obs": obs,
|
198 |
-
"reward": reward,
|
199 |
-
"done": done
|
200 |
-
}
|
201 |
-
_send_dict_as_json_message(reply)
|
202 |
-
|
203 |
-
var handled = handle_message()
|
204 |
-
else:
|
205 |
-
_reset_agents_if_done()
|
206 |
|
207 |
func handle_message() -> bool:
|
208 |
# get json message: reset, step, close
|
@@ -272,6 +307,7 @@ func _get_obs_from_agents():
|
|
272 |
var obs = []
|
273 |
for agent in agents:
|
274 |
obs.append(agent.get_obs())
|
|
|
275 |
return obs
|
276 |
|
277 |
func _get_reward_from_agents():
|
@@ -293,3 +329,8 @@ func _set_agent_actions(actions):
|
|
293 |
for i in range(len(actions)):
|
294 |
agents[i].set_action(actions[i])
|
295 |
|
|
|
|
|
|
|
|
|
|
|
|
2 |
# --fixed-fps 2000 --disable-render-loop
|
3 |
@export var action_repeat := 8
|
4 |
@export var speed_up = 1
|
5 |
+
@export var onnx_model_path := ""
|
6 |
+
|
7 |
+
@onready var start_time = Time.get_ticks_msec()
|
8 |
|
9 |
const MAJOR_VERSION := "0"
|
10 |
const MINOR_VERSION := "3"
|
|
|
18 |
var agents
|
19 |
var need_to_send_obs = false
|
20 |
var args = null
|
|
|
21 |
var initialized = false
|
22 |
var just_reset = false
|
23 |
+
var onnx_model = null
|
24 |
+
var n_action_steps = 0
|
25 |
|
26 |
+
var _action_space : Dictionary
|
27 |
+
var _obs_space : Dictionary
|
28 |
|
29 |
# Called when the node enters the scene tree for the first time.
|
30 |
|
31 |
func _ready():
|
|
|
32 |
await get_tree().root.ready
|
33 |
get_tree().set_pause(true)
|
34 |
_initialize()
|
35 |
await get_tree().create_timer(1.0).timeout
|
36 |
get_tree().set_pause(false)
|
37 |
+
|
38 |
+
func _initialize():
|
39 |
+
_get_agents()
|
40 |
+
_obs_space = agents[0].get_obs_space()
|
41 |
+
_action_space = agents[0].get_action_space()
|
42 |
+
args = _get_args()
|
43 |
+
Engine.physics_ticks_per_second = _get_speedup() * 60 # Replace with function body.
|
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 |
+
connected = connect_to_server()
|
49 |
+
if connected:
|
50 |
+
_set_heuristic("model")
|
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 |
+
_set_heuristic("human")
|
58 |
+
|
59 |
+
_set_seed()
|
60 |
+
_set_action_repeat()
|
61 |
+
initialized = true
|
62 |
+
|
63 |
+
func _physics_process(delta):
|
64 |
+
# two modes, human control, agent control
|
65 |
+
# pause tree, send obs, get actions, set actions, unpause tree
|
66 |
+
if n_action_steps % action_repeat != 0:
|
67 |
+
n_action_steps += 1
|
68 |
+
return
|
69 |
+
|
70 |
+
n_action_steps += 1
|
71 |
+
|
72 |
+
if connected:
|
73 |
+
get_tree().set_pause(true)
|
74 |
+
|
75 |
+
if just_reset:
|
76 |
+
just_reset = false
|
77 |
+
var obs = _get_obs_from_agents()
|
78 |
+
|
79 |
+
var reply = {
|
80 |
+
"type": "reset",
|
81 |
+
"obs": obs
|
82 |
+
}
|
83 |
+
_send_dict_as_json_message(reply)
|
84 |
+
# this should go straight to getting the action and setting it checked the agent, no need to perform one phyics tick
|
85 |
+
get_tree().set_pause(false)
|
86 |
+
return
|
87 |
+
|
88 |
+
if need_to_send_obs:
|
89 |
+
need_to_send_obs = false
|
90 |
+
var reward = _get_reward_from_agents()
|
91 |
+
var done = _get_done_from_agents()
|
92 |
+
#_reset_agents_if_done() # this ensures the new observation is from the next env instance : NEEDS REFACTOR
|
93 |
+
|
94 |
+
var obs = _get_obs_from_agents()
|
95 |
+
|
96 |
+
var reply = {
|
97 |
+
"type": "step",
|
98 |
+
"obs": obs,
|
99 |
+
"reward": reward,
|
100 |
+
"done": done
|
101 |
+
}
|
102 |
+
_send_dict_as_json_message(reply)
|
103 |
+
|
104 |
+
var handled = handle_message()
|
105 |
+
|
106 |
+
elif onnx_model != null:
|
107 |
+
var obs : Array = _get_obs_from_agents()
|
108 |
+
|
109 |
+
var actions = []
|
110 |
+
for o in obs:
|
111 |
+
var action = onnx_model.run_inference(o["obs"], 1.0)
|
112 |
+
action["output"] = clamp_array(action["output"], -1.0, 1.0)
|
113 |
+
var action_dict = _extract_action_dict(action["output"])
|
114 |
+
actions.append(action_dict)
|
115 |
+
|
116 |
+
_set_agent_actions(actions)
|
117 |
+
need_to_send_obs = true
|
118 |
+
get_tree().set_pause(false)
|
119 |
+
_reset_agents_if_done()
|
120 |
|
121 |
+
else:
|
122 |
+
_reset_agents_if_done()
|
123 |
+
|
124 |
+
func _extract_action_dict(action_array: Array):
|
125 |
+
var index = 0
|
126 |
+
var result = {}
|
127 |
+
for key in _action_space.keys():
|
128 |
+
var size = _action_space[key]["size"]
|
129 |
+
if _action_space[key]["action_type"] == "discrete":
|
130 |
+
result[key] = round(action_array[index])
|
131 |
+
else:
|
132 |
+
result[key] = action_array.slice(index,index+size)
|
133 |
+
index += size
|
134 |
+
|
135 |
+
return result
|
136 |
+
|
137 |
func _get_agents():
|
138 |
agents = get_tree().get_nodes_in_group("AGENT")
|
139 |
|
|
|
178 |
func _send_env_info():
|
179 |
var json_dict = _get_dict_json_message()
|
180 |
assert(json_dict["type"] == "env_info")
|
181 |
+
|
182 |
+
|
183 |
var message = {
|
184 |
"type" : "env_info",
|
185 |
+
"observation_space": _obs_space,
|
186 |
+
"action_space":_action_space,
|
|
|
187 |
"n_agents": len(agents)
|
188 |
}
|
189 |
_send_dict_as_json_message(message)
|
190 |
|
|
|
191 |
func connect_to_server():
|
192 |
print("Waiting for one second to allow server to start")
|
193 |
OS.delay_msec(1000)
|
|
|
200 |
var connect = stream.connect_to_host(ip, port)
|
201 |
stream.set_no_delay(true) # TODO check if this improves performance or not
|
202 |
stream.poll()
|
203 |
+
# Fetch the status until it is either connected (2) or failed to connect (3)
|
204 |
+
while stream.get_status() < 2:
|
205 |
+
stream.poll()
|
206 |
return stream.get_status() == 2
|
207 |
|
208 |
func _get_args():
|
209 |
print("getting command line arguments")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
var arguments = {}
|
211 |
for argument in OS.get_cmdline_args():
|
212 |
print(argument)
|
|
|
237 |
func disconnect_from_server():
|
238 |
stream.disconnect_from_host()
|
239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
|
242 |
func handle_message() -> bool:
|
243 |
# get json message: reset, step, close
|
|
|
307 |
var obs = []
|
308 |
for agent in agents:
|
309 |
obs.append(agent.get_obs())
|
310 |
+
|
311 |
return obs
|
312 |
|
313 |
func _get_reward_from_agents():
|
|
|
329 |
for i in range(len(actions)):
|
330 |
agents[i].set_action(actions[i])
|
331 |
|
332 |
+
func clamp_array(arr : Array, min:float, max:float):
|
333 |
+
var output : Array = []
|
334 |
+
for a in arr:
|
335 |
+
output.append(clamp(a, min, max))
|
336 |
+
return output
|
alps_field_2k.hdr.import
CHANGED
@@ -3,24 +3,23 @@
|
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://t6dny8qa4t0s"
|
6 |
-
path.
|
7 |
-
path.etc2="res://.godot/imported/alps_field_2k.hdr-3700cd621ede9e1814580eb21c62fe71.etc2.ctex"
|
8 |
metadata={
|
9 |
-
"imported_formats": ["
|
10 |
"vram_texture": true
|
11 |
}
|
12 |
|
13 |
[deps]
|
14 |
|
15 |
source_file="res://alps_field_2k.hdr"
|
16 |
-
dest_files=["res://.godot/imported/alps_field_2k.hdr-3700cd621ede9e1814580eb21c62fe71.
|
17 |
|
18 |
[params]
|
19 |
|
20 |
compress/mode=2
|
|
|
21 |
compress/lossy_quality=0.7
|
22 |
compress/hdr_compression=1
|
23 |
-
compress/bptc_ldr=0
|
24 |
compress/normal_map=0
|
25 |
compress/channel_pack=0
|
26 |
mipmaps/generate=true
|
|
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://t6dny8qa4t0s"
|
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
|
bin/FlyBy.console.exe
ADDED
Binary file (186 kB). View file
|
|
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:784e2e3b2022a9421df07c764fc394ff0576147b16d186b9ed17fb725e96d4d4
|
3 |
+
size 68805120
|
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:93578d55d1b4b0d44ea3d37c75baff4196e6ea2e7340eaf0f6600061874ec62b
|
3 |
+
size 8659808
|
bin/FlyBy.sh
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
echo -ne '\033c\033]0;FlyBy\a'
|
3 |
+
base_path="$(dirname "$(realpath "$0")")"
|
4 |
+
"$base_path/FlyBy.x86_64" "$@"
|
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:dda38dcc9dacc4e8d58d79f88a109bd36a30d97af1400a46b9d9d4e24278dbfe
|
3 |
+
size 70085064
|
concrete_wall_004_ao_1k.jpg.import
CHANGED
@@ -4,23 +4,22 @@ importer="texture"
|
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://dldtb41hye81g"
|
6 |
path.s3tc="res://.godot/imported/concrete_wall_004_ao_1k.jpg-0d870bfa68d10989c64e8f80fd173f1c.s3tc.ctex"
|
7 |
-
path.etc2="res://.godot/imported/concrete_wall_004_ao_1k.jpg-0d870bfa68d10989c64e8f80fd173f1c.etc2.ctex"
|
8 |
metadata={
|
9 |
-
"imported_formats": ["
|
10 |
"vram_texture": true
|
11 |
}
|
12 |
|
13 |
[deps]
|
14 |
|
15 |
source_file="res://concrete_wall_004_ao_1k.jpg"
|
16 |
-
dest_files=["res://.godot/imported/concrete_wall_004_ao_1k.jpg-0d870bfa68d10989c64e8f80fd173f1c.s3tc.ctex"
|
17 |
|
18 |
[params]
|
19 |
|
20 |
compress/mode=2
|
|
|
21 |
compress/lossy_quality=0.7
|
22 |
compress/hdr_compression=1
|
23 |
-
compress/bptc_ldr=0
|
24 |
compress/normal_map=0
|
25 |
compress/channel_pack=0
|
26 |
mipmaps/generate=true
|
|
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://dldtb41hye81g"
|
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
|
concrete_wall_004_arm_1k.jpg.import
CHANGED
@@ -4,23 +4,22 @@ importer="texture"
|
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://5a5t67qitvfe"
|
6 |
path.s3tc="res://.godot/imported/concrete_wall_004_arm_1k.jpg-751ec2fe192db08c6d0a22459d60b1bf.s3tc.ctex"
|
7 |
-
path.etc2="res://.godot/imported/concrete_wall_004_arm_1k.jpg-751ec2fe192db08c6d0a22459d60b1bf.etc2.ctex"
|
8 |
metadata={
|
9 |
-
"imported_formats": ["
|
10 |
"vram_texture": true
|
11 |
}
|
12 |
|
13 |
[deps]
|
14 |
|
15 |
source_file="res://concrete_wall_004_arm_1k.jpg"
|
16 |
-
dest_files=["res://.godot/imported/concrete_wall_004_arm_1k.jpg-751ec2fe192db08c6d0a22459d60b1bf.s3tc.ctex"
|
17 |
|
18 |
[params]
|
19 |
|
20 |
compress/mode=2
|
|
|
21 |
compress/lossy_quality=0.7
|
22 |
compress/hdr_compression=1
|
23 |
-
compress/bptc_ldr=0
|
24 |
compress/normal_map=0
|
25 |
compress/channel_pack=0
|
26 |
mipmaps/generate=true
|
|
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://5a5t67qitvfe"
|
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
|
concrete_wall_004_diff_1k.jpg.import
CHANGED
@@ -4,23 +4,22 @@ importer="texture"
|
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://bllectxwni4aa"
|
6 |
path.s3tc="res://.godot/imported/concrete_wall_004_diff_1k.jpg-866ca6527ab775aadb16bf165a04e3bd.s3tc.ctex"
|
7 |
-
path.etc2="res://.godot/imported/concrete_wall_004_diff_1k.jpg-866ca6527ab775aadb16bf165a04e3bd.etc2.ctex"
|
8 |
metadata={
|
9 |
-
"imported_formats": ["
|
10 |
"vram_texture": true
|
11 |
}
|
12 |
|
13 |
[deps]
|
14 |
|
15 |
source_file="res://concrete_wall_004_diff_1k.jpg"
|
16 |
-
dest_files=["res://.godot/imported/concrete_wall_004_diff_1k.jpg-866ca6527ab775aadb16bf165a04e3bd.s3tc.ctex"
|
17 |
|
18 |
[params]
|
19 |
|
20 |
compress/mode=2
|
|
|
21 |
compress/lossy_quality=0.7
|
22 |
compress/hdr_compression=1
|
23 |
-
compress/bptc_ldr=0
|
24 |
compress/normal_map=0
|
25 |
compress/channel_pack=0
|
26 |
mipmaps/generate=true
|
|
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://bllectxwni4aa"
|
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
|
concrete_wall_004_nor_gl_1k.jpg.import
CHANGED
@@ -4,23 +4,22 @@ importer="texture"
|
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://c5i52p54pfjkb"
|
6 |
path.s3tc="res://.godot/imported/concrete_wall_004_nor_gl_1k.jpg-b2340a16d191e361bd651d2096627034.s3tc.ctex"
|
7 |
-
path.etc2="res://.godot/imported/concrete_wall_004_nor_gl_1k.jpg-b2340a16d191e361bd651d2096627034.etc2.ctex"
|
8 |
metadata={
|
9 |
-
"imported_formats": ["
|
10 |
"vram_texture": true
|
11 |
}
|
12 |
|
13 |
[deps]
|
14 |
|
15 |
source_file="res://concrete_wall_004_nor_gl_1k.jpg"
|
16 |
-
dest_files=["res://.godot/imported/concrete_wall_004_nor_gl_1k.jpg-b2340a16d191e361bd651d2096627034.s3tc.ctex"
|
17 |
|
18 |
[params]
|
19 |
|
20 |
compress/mode=2
|
|
|
21 |
compress/lossy_quality=0.7
|
22 |
compress/hdr_compression=1
|
23 |
-
compress/bptc_ldr=0
|
24 |
compress/normal_map=1
|
25 |
compress/channel_pack=0
|
26 |
mipmaps/generate=true
|
|
|
4 |
type="CompressedTexture2D"
|
5 |
uid="uid://c5i52p54pfjkb"
|
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
|
export_presets.cfg
CHANGED
@@ -1,107 +1,5 @@
|
|
1 |
[preset.0]
|
2 |
|
3 |
-
name="macOS"
|
4 |
-
platform="macOS"
|
5 |
-
runnable=true
|
6 |
-
dedicated_server=false
|
7 |
-
custom_features=""
|
8 |
-
export_filter="all_resources"
|
9 |
-
include_filter=""
|
10 |
-
exclude_filter=""
|
11 |
-
export_path="bin/FlyBy.app"
|
12 |
-
encryption_include_filters=""
|
13 |
-
encryption_exclude_filters=""
|
14 |
-
encrypt_pck=false
|
15 |
-
encrypt_directory=false
|
16 |
-
script_encryption_key=""
|
17 |
-
|
18 |
-
[preset.0.options]
|
19 |
-
|
20 |
-
binary_format/architecture="universal"
|
21 |
-
custom_template/debug="../../export_templates/4.0.rc2/macos.zip"
|
22 |
-
custom_template/release="../../export_templates/4.0.rc2/macos.zip"
|
23 |
-
debug/export_console_script=1
|
24 |
-
application/icon=""
|
25 |
-
application/icon_interpolation=4
|
26 |
-
application/bundle_identifier="org.godot-rl-agents.fly-by"
|
27 |
-
application/signature=""
|
28 |
-
application/app_category="Games"
|
29 |
-
application/short_version="1.0"
|
30 |
-
application/version="1.0"
|
31 |
-
application/copyright=""
|
32 |
-
application/copyright_localized={}
|
33 |
-
display/high_res=false
|
34 |
-
codesign/codesign=3
|
35 |
-
codesign/identity=""
|
36 |
-
codesign/certificate_file=""
|
37 |
-
codesign/certificate_password=""
|
38 |
-
codesign/entitlements/custom_file=""
|
39 |
-
codesign/entitlements/allow_jit_code_execution=false
|
40 |
-
codesign/entitlements/allow_unsigned_executable_memory=false
|
41 |
-
codesign/entitlements/allow_dyld_environment_variables=false
|
42 |
-
codesign/entitlements/disable_library_validation=false
|
43 |
-
codesign/entitlements/audio_input=false
|
44 |
-
codesign/entitlements/camera=false
|
45 |
-
codesign/entitlements/location=false
|
46 |
-
codesign/entitlements/address_book=false
|
47 |
-
codesign/entitlements/calendars=false
|
48 |
-
codesign/entitlements/photos_library=false
|
49 |
-
codesign/entitlements/apple_events=false
|
50 |
-
codesign/entitlements/debugging=false
|
51 |
-
codesign/entitlements/app_sandbox/enabled=false
|
52 |
-
codesign/entitlements/app_sandbox/network_server=false
|
53 |
-
codesign/entitlements/app_sandbox/network_client=false
|
54 |
-
codesign/entitlements/app_sandbox/device_usb=false
|
55 |
-
codesign/entitlements/app_sandbox/device_bluetooth=false
|
56 |
-
codesign/entitlements/app_sandbox/files_downloads=0
|
57 |
-
codesign/entitlements/app_sandbox/files_pictures=0
|
58 |
-
codesign/entitlements/app_sandbox/files_music=0
|
59 |
-
codesign/entitlements/app_sandbox/files_movies=0
|
60 |
-
codesign/entitlements/app_sandbox/helper_executables=[]
|
61 |
-
codesign/custom_options=PackedStringArray()
|
62 |
-
notarization/notarization=0
|
63 |
-
notarization/apple_id_name=""
|
64 |
-
notarization/apple_id_password=""
|
65 |
-
notarization/apple_team_id=""
|
66 |
-
notarization/api_uuid=""
|
67 |
-
notarization/api_key=""
|
68 |
-
notarization/api_key_id=""
|
69 |
-
privacy/microphone_usage_description=""
|
70 |
-
privacy/microphone_usage_description_localized={}
|
71 |
-
privacy/camera_usage_description=""
|
72 |
-
privacy/camera_usage_description_localized={}
|
73 |
-
privacy/location_usage_description=""
|
74 |
-
privacy/location_usage_description_localized={}
|
75 |
-
privacy/address_book_usage_description=""
|
76 |
-
privacy/address_book_usage_description_localized={}
|
77 |
-
privacy/calendar_usage_description=""
|
78 |
-
privacy/calendar_usage_description_localized={}
|
79 |
-
privacy/photos_library_usage_description=""
|
80 |
-
privacy/photos_library_usage_description_localized={}
|
81 |
-
privacy/desktop_folder_usage_description=""
|
82 |
-
privacy/desktop_folder_usage_description_localized={}
|
83 |
-
privacy/documents_folder_usage_description=""
|
84 |
-
privacy/documents_folder_usage_description_localized={}
|
85 |
-
privacy/downloads_folder_usage_description=""
|
86 |
-
privacy/downloads_folder_usage_description_localized={}
|
87 |
-
privacy/network_volumes_usage_description=""
|
88 |
-
privacy/network_volumes_usage_description_localized={}
|
89 |
-
privacy/removable_volumes_usage_description=""
|
90 |
-
privacy/removable_volumes_usage_description_localized={}
|
91 |
-
ssh_remote_deploy/enabled=false
|
92 |
-
ssh_remote_deploy/host="user@host_ip"
|
93 |
-
ssh_remote_deploy/port="22"
|
94 |
-
ssh_remote_deploy/extra_args_ssh=""
|
95 |
-
ssh_remote_deploy/extra_args_scp=""
|
96 |
-
ssh_remote_deploy/run_script="#!/usr/bin/env bash
|
97 |
-
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
98 |
-
open \"{temp_dir}/{exe_name}.app\" --args {cmd_args}"
|
99 |
-
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
100 |
-
kill $(pgrep -x -f \"{temp_dir}/{exe_name}.app/Contents/MacOS/{exe_name} {cmd_args}\")
|
101 |
-
rm -rf \"{temp_dir}\""
|
102 |
-
|
103 |
-
[preset.1]
|
104 |
-
|
105 |
name="Linux/X11"
|
106 |
platform="Linux/X11"
|
107 |
runnable=true
|
@@ -117,17 +15,16 @@ encrypt_pck=false
|
|
117 |
encrypt_directory=false
|
118 |
script_encryption_key=""
|
119 |
|
120 |
-
[preset.
|
121 |
|
122 |
custom_template/debug=""
|
123 |
custom_template/release=""
|
124 |
debug/export_console_script=1
|
125 |
binary_format/embed_pck=false
|
126 |
-
texture_format/bptc=
|
127 |
texture_format/s3tc=true
|
128 |
texture_format/etc=false
|
129 |
texture_format/etc2=false
|
130 |
-
texture_format/no_bptc_fallbacks=true
|
131 |
binary_format/architecture="x86_64"
|
132 |
ssh_remote_deploy/enabled=false
|
133 |
ssh_remote_deploy/host="user@host_ip"
|
@@ -142,7 +39,7 @@ ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
|
142 |
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
143 |
rm -rf \"{temp_dir}\""
|
144 |
|
145 |
-
[preset.
|
146 |
|
147 |
name="Windows Desktop"
|
148 |
platform="Windows Desktop"
|
@@ -159,17 +56,16 @@ encrypt_pck=false
|
|
159 |
encrypt_directory=false
|
160 |
script_encryption_key=""
|
161 |
|
162 |
-
[preset.
|
163 |
|
164 |
custom_template/debug=""
|
165 |
custom_template/release=""
|
166 |
debug/export_console_script=1
|
167 |
binary_format/embed_pck=false
|
168 |
-
texture_format/bptc=
|
169 |
texture_format/s3tc=true
|
170 |
texture_format/etc=false
|
171 |
texture_format/etc2=false
|
172 |
-
texture_format/no_bptc_fallbacks=true
|
173 |
binary_format/architecture="x86_64"
|
174 |
codesign/enable=false
|
175 |
codesign/identity_type=0
|
|
|
1 |
[preset.0]
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
name="Linux/X11"
|
4 |
platform="Linux/X11"
|
5 |
runnable=true
|
|
|
15 |
encrypt_directory=false
|
16 |
script_encryption_key=""
|
17 |
|
18 |
+
[preset.0.options]
|
19 |
|
20 |
custom_template/debug=""
|
21 |
custom_template/release=""
|
22 |
debug/export_console_script=1
|
23 |
binary_format/embed_pck=false
|
24 |
+
texture_format/bptc=true
|
25 |
texture_format/s3tc=true
|
26 |
texture_format/etc=false
|
27 |
texture_format/etc2=false
|
|
|
28 |
binary_format/architecture="x86_64"
|
29 |
ssh_remote_deploy/enabled=false
|
30 |
ssh_remote_deploy/host="user@host_ip"
|
|
|
39 |
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
40 |
rm -rf \"{temp_dir}\""
|
41 |
|
42 |
+
[preset.1]
|
43 |
|
44 |
name="Windows Desktop"
|
45 |
platform="Windows Desktop"
|
|
|
56 |
encrypt_directory=false
|
57 |
script_encryption_key=""
|
58 |
|
59 |
+
[preset.1.options]
|
60 |
|
61 |
custom_template/debug=""
|
62 |
custom_template/release=""
|
63 |
debug/export_console_script=1
|
64 |
binary_format/embed_pck=false
|
65 |
+
texture_format/bptc=true
|
66 |
texture_format/s3tc=true
|
67 |
texture_format/etc=false
|
68 |
texture_format/etc2=false
|
|
|
69 |
binary_format/architecture="x86_64"
|
70 |
codesign/enable=false
|
71 |
codesign/identity_type=0
|
project.godot
CHANGED
@@ -8,47 +8,17 @@
|
|
8 |
|
9 |
config_version=5
|
10 |
|
11 |
-
_global_script_classes=[{
|
12 |
-
"base": "Node2D",
|
13 |
-
"class": &"ISensor2D",
|
14 |
-
"language": &"GDScript",
|
15 |
-
"path": "res://addons/godot_rl_agents/sensors/sensors_2d/ISensor2D.gd"
|
16 |
-
}, {
|
17 |
-
"base": "Node3D",
|
18 |
-
"class": &"ISensor3D",
|
19 |
-
"language": &"GDScript",
|
20 |
-
"path": "res://addons/godot_rl_agents/sensors/sensors_3d/ISensor3D.gd"
|
21 |
-
}, {
|
22 |
-
"base": "Node3D",
|
23 |
-
"class": &"RGBCameraSensor3D",
|
24 |
-
"language": &"GDScript",
|
25 |
-
"path": "res://addons/godot_rl_agents/sensors/sensors_3d/RGBCameraSensor3D.gd"
|
26 |
-
}, {
|
27 |
-
"base": "ISensor3D",
|
28 |
-
"class": &"RayCastSensor3D",
|
29 |
-
"language": &"GDScript",
|
30 |
-
"path": "res://addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd"
|
31 |
-
}, {
|
32 |
-
"base": "ISensor2D",
|
33 |
-
"class": &"RaycastSensor2D",
|
34 |
-
"language": &"GDScript",
|
35 |
-
"path": "res://addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd"
|
36 |
-
}]
|
37 |
-
_global_script_class_icons={
|
38 |
-
"ISensor2D": "",
|
39 |
-
"ISensor3D": "",
|
40 |
-
"RGBCameraSensor3D": "",
|
41 |
-
"RayCastSensor3D": "",
|
42 |
-
"RaycastSensor2D": ""
|
43 |
-
}
|
44 |
-
|
45 |
[application]
|
46 |
|
47 |
config/name="FlyBy"
|
48 |
run/main_scene="res://FlyBy.tscn"
|
49 |
-
config/features=PackedStringArray("4.0")
|
50 |
config/icon="res://icon.png"
|
51 |
|
|
|
|
|
|
|
|
|
52 |
[editor_plugins]
|
53 |
|
54 |
enabled=PackedStringArray()
|
@@ -65,27 +35,27 @@ throttle_down={
|
|
65 |
}
|
66 |
pitch_up={
|
67 |
"deadzone": 0.5,
|
68 |
-
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"unicode":0,"echo":false,"script":null)
|
69 |
]
|
70 |
}
|
71 |
pitch_down={
|
72 |
"deadzone": 0.5,
|
73 |
-
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"unicode":0,"echo":false,"script":null)
|
74 |
]
|
75 |
}
|
76 |
roll_left={
|
77 |
"deadzone": 0.5,
|
78 |
-
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"unicode":0,"echo":false,"script":null)
|
79 |
]
|
80 |
}
|
81 |
roll_right={
|
82 |
"deadzone": 0.5,
|
83 |
-
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"unicode":0,"echo":false,"script":null)
|
84 |
]
|
85 |
}
|
86 |
r_key={
|
87 |
"deadzone": 0.5,
|
88 |
-
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"unicode":0,"echo":false,"script":null)
|
89 |
]
|
90 |
}
|
91 |
|
|
|
8 |
|
9 |
config_version=5
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
[application]
|
12 |
|
13 |
config/name="FlyBy"
|
14 |
run/main_scene="res://FlyBy.tscn"
|
15 |
+
config/features=PackedStringArray("4.0", "C#")
|
16 |
config/icon="res://icon.png"
|
17 |
|
18 |
+
[dotnet]
|
19 |
+
|
20 |
+
project/assembly_name="FlyBy"
|
21 |
+
|
22 |
[editor_plugins]
|
23 |
|
24 |
enabled=PackedStringArray()
|
|
|
35 |
}
|
36 |
pitch_up={
|
37 |
"deadzone": 0.5,
|
38 |
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":0,"echo":false,"script":null)
|
39 |
]
|
40 |
}
|
41 |
pitch_down={
|
42 |
"deadzone": 0.5,
|
43 |
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":0,"echo":false,"script":null)
|
44 |
]
|
45 |
}
|
46 |
roll_left={
|
47 |
"deadzone": 0.5,
|
48 |
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":0,"echo":false,"script":null)
|
49 |
]
|
50 |
}
|
51 |
roll_right={
|
52 |
"deadzone": 0.5,
|
53 |
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":0,"echo":false,"script":null)
|
54 |
]
|
55 |
}
|
56 |
r_key={
|
57 |
"deadzone": 0.5,
|
58 |
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":0,"echo":false,"script":null)
|
59 |
]
|
60 |
}
|
61 |
|