diff --git a/.gitignore b/.gitignore index b6e4761..b115b53 100644 --- a/.gitignore +++ b/.gitignore @@ -1,129 +1,18 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class +# Godot-specific ignores +.import/ +export.cfg +export_presets.cfg -# C extensions -*.so +# Imported translations (automatically generated from CSV files) +*.translation -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST +# Mono-specific ignores +.mono/ +data_*/ -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec +# Art and temp media +*.*~ +*-autosave* -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ +# Build and script +_build diff --git a/README.md b/README.md index d5df69e..b6e7c55 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,12 @@ # deck-commander + Deck Commander is a robot (sumo and small combat robot) controller + + +# Some notes while testing! + +I used rsync to get the binary on the deck for testing, like this + +``` +rsync -av Deck\ Commander.* deck@10.85.1.235:/home/deck/CustomGames/DeckCommander/ +``` diff --git a/godot/assets/Days.ttf b/godot/assets/Days.ttf new file mode 100644 index 0000000..5933d31 Binary files /dev/null and b/godot/assets/Days.ttf differ diff --git a/godot/assets/GraphBackground.kra b/godot/assets/GraphBackground.kra new file mode 100644 index 0000000..32e2b8e Binary files /dev/null and b/godot/assets/GraphBackground.kra differ diff --git a/godot/assets/GraphBackground.png b/godot/assets/GraphBackground.png new file mode 100644 index 0000000..9ca8866 Binary files /dev/null and b/godot/assets/GraphBackground.png differ diff --git a/godot/assets/GraphBackground.png.import b/godot/assets/GraphBackground.png.import new file mode 100644 index 0000000..cb114b6 --- /dev/null +++ b/godot/assets/GraphBackground.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/GraphBackground.png-d2a839ae2b81b306b4ed89285c77272b.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/GraphBackground.png" +dest_files=[ "res://.import/GraphBackground.png-d2a839ae2b81b306b4ed89285c77272b.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/godot/assets/GraphForeground.png b/godot/assets/GraphForeground.png new file mode 100644 index 0000000..9b5b9de Binary files /dev/null and b/godot/assets/GraphForeground.png differ diff --git a/godot/assets/GraphForeground.png.import b/godot/assets/GraphForeground.png.import new file mode 100644 index 0000000..6b2b4a1 --- /dev/null +++ b/godot/assets/GraphForeground.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/GraphForeground.png-cb896cbc6101cb40c31056d29c90813a.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/GraphForeground.png" +dest_files=[ "res://.import/GraphForeground.png-cb896cbc6101cb40c31056d29c90813a.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/godot/assets/RadioBackground.kra b/godot/assets/RadioBackground.kra new file mode 100644 index 0000000..8c01a5e Binary files /dev/null and b/godot/assets/RadioBackground.kra differ diff --git a/godot/assets/RadioBackground.png b/godot/assets/RadioBackground.png new file mode 100644 index 0000000..4a0ecec Binary files /dev/null and b/godot/assets/RadioBackground.png differ diff --git a/godot/assets/RadioBackground.png.import b/godot/assets/RadioBackground.png.import new file mode 100644 index 0000000..ceae730 --- /dev/null +++ b/godot/assets/RadioBackground.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/RadioBackground.png-ad0a7029c99875a5bc04e823a5f17f33.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/RadioBackground.png" +dest_files=[ "res://.import/RadioBackground.png-ad0a7029c99875a5bc04e823a5f17f33.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/godot/assets/RadioForeground.png b/godot/assets/RadioForeground.png new file mode 100644 index 0000000..0dd35f9 Binary files /dev/null and b/godot/assets/RadioForeground.png differ diff --git a/godot/assets/RadioForeground.png.import b/godot/assets/RadioForeground.png.import new file mode 100644 index 0000000..e7f4548 --- /dev/null +++ b/godot/assets/RadioForeground.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/RadioForeground.png-927d298497caa6ea32624eb6f80bdd94.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/RadioForeground.png" +dest_files=[ "res://.import/RadioForeground.png-927d298497caa6ea32624eb6f80bdd94.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/godot/assets/RadioRX.png b/godot/assets/RadioRX.png new file mode 100644 index 0000000..dd41bb1 Binary files /dev/null and b/godot/assets/RadioRX.png differ diff --git a/godot/assets/RadioRX.png.import b/godot/assets/RadioRX.png.import new file mode 100644 index 0000000..49b049c --- /dev/null +++ b/godot/assets/RadioRX.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/RadioRX.png-d7324f1bd22aa07b1b8d3cabaacafae5.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/RadioRX.png" +dest_files=[ "res://.import/RadioRX.png-d7324f1bd22aa07b1b8d3cabaacafae5.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/godot/assets/RadioTX.png b/godot/assets/RadioTX.png new file mode 100644 index 0000000..9c93e90 Binary files /dev/null and b/godot/assets/RadioTX.png differ diff --git a/godot/assets/RadioTX.png.import b/godot/assets/RadioTX.png.import new file mode 100644 index 0000000..09d194b --- /dev/null +++ b/godot/assets/RadioTX.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/RadioTX.png-111608f66670767159ec9cd521e19878.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/RadioTX.png" +dest_files=[ "res://.import/RadioTX.png-111608f66670767159ec9cd521e19878.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/godot/assets/RobotVisionBackground.kra b/godot/assets/RobotVisionBackground.kra new file mode 100644 index 0000000..f68ab4d Binary files /dev/null and b/godot/assets/RobotVisionBackground.kra differ diff --git a/godot/assets/RobotVisionBackground.png b/godot/assets/RobotVisionBackground.png new file mode 100644 index 0000000..2a04ac2 Binary files /dev/null and b/godot/assets/RobotVisionBackground.png differ diff --git a/godot/assets/RobotVisionBackground.png.import b/godot/assets/RobotVisionBackground.png.import new file mode 100644 index 0000000..34c05c8 --- /dev/null +++ b/godot/assets/RobotVisionBackground.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/RobotVisionBackground.png-af5661b904f21fe675b197ca0fca782a.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/RobotVisionBackground.png" +dest_files=[ "res://.import/RobotVisionBackground.png-af5661b904f21fe675b197ca0fca782a.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/godot/assets/banner.png b/godot/assets/banner.png new file mode 100644 index 0000000..1747d76 Binary files /dev/null and b/godot/assets/banner.png differ diff --git a/godot/assets/banner.png.import b/godot/assets/banner.png.import new file mode 100644 index 0000000..df3ac03 --- /dev/null +++ b/godot/assets/banner.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/banner.png-e7286fd0372c3fd293fa9b7b04a52c04.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/banner.png" +dest_files=[ "res://.import/banner.png-e7286fd0372c3fd293fa9b7b04a52c04.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/godot/default_env.tres b/godot/default_env.tres new file mode 100644 index 0000000..20207a4 --- /dev/null +++ b/godot/default_env.tres @@ -0,0 +1,7 @@ +[gd_resource type="Environment" load_steps=2 format=2] + +[sub_resource type="ProceduralSky" id=1] + +[resource] +background_mode = 2 +background_sky = SubResource( 1 ) diff --git a/godot/deploy.sh b/godot/deploy.sh new file mode 100755 index 0000000..96d19d8 --- /dev/null +++ b/godot/deploy.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Deploy script to load the game onto a steam deck + +echo "Uplading to target deck at $1" + +mkdir -p _build + +# Build +godot --no-window --export "Steam Deck" "_build/Deck Commander.x86_64" + +# Push +rsync -av "_build/" "deck@$1:/home/deck/CustomGames/DeckCommander/" diff --git a/godot/icon.png b/godot/icon.png new file mode 100644 index 0000000..3146cde Binary files /dev/null and b/godot/icon.png differ diff --git a/godot/icon.png.import b/godot/icon.png.import new file mode 100644 index 0000000..a4c02e6 --- /dev/null +++ b/godot/icon.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.png" +dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/godot/project.godot b/godot/project.godot new file mode 100644 index 0000000..ce0464c --- /dev/null +++ b/godot/project.godot @@ -0,0 +1,64 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=4 + +[application] + +config/name="Deck Commander" +run/main_scene="res://src/Game.tscn" +boot_splash/image="res://assets/banner.png" +config/icon="res://icon.png" + +[display] + +window/size/width=1280 +window/size/height=800 + +[global] + +frame=false + +[gui] + +common/drop_mouse_on_gui_input_disabled=true + +[input] + +ch_throttle_up={ +"deadzone": 0.1, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":87,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null) + ] +} +ch_throttle_dn={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":83,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null) + ] +} +ch_steer_left={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":65,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":2,"axis_value":-1.0,"script":null) + ] +} +ch_steer_righ={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":68,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":2,"axis_value":1.0,"script":null) + ] +} + +[physics] + +common/enable_pause_aware_picking=true + +[rendering] + +environment/default_environment="res://default_env.tres" diff --git a/godot/src/Game.tscn b/godot/src/Game.tscn new file mode 100644 index 0000000..00dc1db --- /dev/null +++ b/godot/src/Game.tscn @@ -0,0 +1,74 @@ +[gd_scene load_steps=13 format=2] + +[ext_resource path="res://assets/Days.ttf" type="DynamicFontData" id=1] +[ext_resource path="res://src/OSTScript.gd" type="Script" id=2] +[ext_resource path="res://assets/GraphBackground.png" type="Texture" id=3] +[ext_resource path="res://assets/GraphForeground.png" type="Texture" id=4] +[ext_resource path="res://src/Graph.gd" type="Script" id=5] +[ext_resource path="res://assets/RobotVisionBackground.png" type="Texture" id=6] +[ext_resource path="res://assets/RadioForeground.png" type="Texture" id=7] +[ext_resource path="res://assets/RadioBackground.png" type="Texture" id=8] +[ext_resource path="res://assets/RadioTX.png" type="Texture" id=9] +[ext_resource path="res://assets/RadioRX.png" type="Texture" id=10] + +[sub_resource type="DynamicFont" id=1] +size = 100 +font_data = ExtResource( 1 ) + +[sub_resource type="DynamicFont" id=2] +font_data = ExtResource( 1 ) + +[node name="Game" type="Node"] + +[node name="OnScreenText" type="RichTextLabel" parent="."] +visible = false +margin_right = 1279.0 +margin_bottom = 797.0 +custom_fonts/normal_font = SubResource( 1 ) +script = ExtResource( 2 ) + +[node name="Graph" type="Node2D" parent="."] +position = Vector2( 151, 724 ) +z_index = 1 +script = ExtResource( 5 ) + +[node name="GraphForegroundSprite" type="Sprite" parent="Graph"] +z_index = 1 +texture = ExtResource( 4 ) + +[node name="GraphLines" type="Node2D" parent="Graph"] + +[node name="GraphBackgroundSprite" type="Sprite" parent="Graph"] +z_index = -1 +texture = ExtResource( 3 ) + +[node name="RobotVisionBackground" type="Sprite" parent="."] +position = Vector2( 648, 386 ) +texture = ExtResource( 6 ) + +[node name="RobotRadio" type="Node2D" parent="."] +position = Vector2( 1128, 300 ) + +[node name="RadioForegroundSprite" type="Sprite" parent="RobotRadio"] +texture = ExtResource( 7 ) + +[node name="RadioBackgroundSprite" type="Sprite" parent="RobotRadio"] +texture = ExtResource( 8 ) + +[node name="RadioRXSprite" type="Sprite" parent="RobotRadio"] +visible = false +texture = ExtResource( 10 ) + +[node name="RichTextLabel" type="RichTextLabel" parent="RobotRadio"] +margin_left = -93.0 +margin_top = -155.0 +margin_right = 99.0 +margin_bottom = -76.0 +custom_fonts/normal_font = SubResource( 2 ) +bbcode_enabled = true +bbcode_text = "WAIT FOR ROBOT..." +text = "No robot connection..." + +[node name="RadioTXSprite" type="Sprite" parent="RobotRadio"] +visible = false +texture = ExtResource( 9 ) diff --git a/godot/src/Graph.gd b/godot/src/Graph.gd new file mode 100644 index 0000000..c5b9730 --- /dev/null +++ b/godot/src/Graph.gd @@ -0,0 +1,39 @@ +extends Node2D + +# This array holds all the data for our graph +var graphPoints = PoolVector2Array([Vector2(0,0), Vector2(15,1), Vector2(30,4), Vector2(45, 17), Vector2(60, -1)]) + +# Throttle +var throttle = 0 + +# Some constants +var updatespeed = 1 # How many pixels we shift on every frame +var graphWidth = 300 +var graphColor = Color(0,0,0) + +func _ready(): + pass + +# Called whenever we want to redraw the graph (dont call manually) +func _draw(): + draw_polyline(graphPoints, graphColor, 4) + +# Called regularly +func _process(_delta): + # Move every element + for i in range(len(graphPoints)): + graphPoints[i] = graphPoints[i] + Vector2(-updatespeed,0) + + # Remove anything too old + for p in graphPoints: + if p.x < -graphWidth/2 + 25: + graphPoints.remove(graphPoints.find(p)) # Seek and destroy! + + # Messy but it updates the throttle + throttle = (Input.get_action_strength("ch_throttle_up") - Input.get_action_strength("ch_throttle_dn")) * -50 + + # Refine but, this adds data + graphPoints.append(Vector2((graphWidth / 2) - 80, throttle)) + + # Redraw every time (optimize later?) + update() diff --git a/godot/src/OSTScript.gd b/godot/src/OSTScript.gd new file mode 100644 index 0000000..3ec48fc --- /dev/null +++ b/godot/src/OSTScript.gd @@ -0,0 +1,8 @@ +extends RichTextLabel + + +func _input(event): + set_text("Your mouse position is\n" + str(event.get_action_strength("ch_throttle"))) + +#func _process(delta): +# set_text("Your mouse position is " + str(get_local_mouse_position()))