diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1617678 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +root = true + +[*] +charset = utf-8 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..83264fb --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/Idle Starship.csproj b/Idle Starship.csproj new file mode 100644 index 0000000..b6e08cd --- /dev/null +++ b/Idle Starship.csproj @@ -0,0 +1,7 @@ + + + net8.0 + true + IdleStarship + + \ No newline at end of file diff --git a/Idle Starship.sln b/Idle Starship.sln new file mode 100644 index 0000000..1d00cbf --- /dev/null +++ b/Idle Starship.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Idle Starship", "Idle Starship.csproj", "{3CFAAC77-A968-438F-8CDD-E4152B8DB981}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + ExportDebug|Any CPU = ExportDebug|Any CPU + ExportRelease|Any CPU = ExportRelease|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3CFAAC77-A968-438F-8CDD-E4152B8DB981}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3CFAAC77-A968-438F-8CDD-E4152B8DB981}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3CFAAC77-A968-438F-8CDD-E4152B8DB981}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU + {3CFAAC77-A968-438F-8CDD-E4152B8DB981}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU + {3CFAAC77-A968-438F-8CDD-E4152B8DB981}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU + {3CFAAC77-A968-438F-8CDD-E4152B8DB981}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU + EndGlobalSection +EndGlobal diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..1345199 --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..22fa8a9 --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b1rrvmekhjw68" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..da2c807 --- /dev/null +++ b/project.godot @@ -0,0 +1,25 @@ +; 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=5 + +[application] + +config/name="Idle Starship" +run/main_scene="uid://h3dgo6me76t7" +config/features=PackedStringArray("4.5", "C#", "Mobile") +config/icon="res://icon.svg" + +[dotnet] + +project/assembly_name="Idle Starship" + +[rendering] + +renderer/rendering_method="mobile" +textures/vram_compression/import_etc2_astc=true diff --git a/scenes/game.tscn b/scenes/game.tscn new file mode 100644 index 0000000..312a07a --- /dev/null +++ b/scenes/game.tscn @@ -0,0 +1,75 @@ +[gd_scene load_steps=4 format=3 uid="uid://u1kttqp08vjc"] + +[ext_resource type="Script" uid="uid://bladckxyu6xmy" path="res://scripts/Controller.cs" id="1_lnu2h"] +[ext_resource type="Script" uid="uid://c0d47hdgdfsa6" path="res://scripts/GameManager.cs" id="1_yqjtg"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_yqjtg"] + +[node name="Control" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_lnu2h") + +[node name="Game" type="Node2D" parent="."] + +[node name="GameManager" type="Node" parent="."] +script = ExtResource("1_yqjtg") + +[node name="Container" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Top" type="HBoxContainer" parent="Container"] +layout_mode = 2 + +[node name="ExitToMenuButton" type="Button" parent="Container/Top"] +layout_mode = 2 +text = "Exit to Menu" + +[node name="Separator" type="Control" parent="Container/Top"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="TabContainer" type="TabContainer" parent="Container"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_styles/panel = SubResource("StyleBoxEmpty_yqjtg") +tab_alignment = 1 +current_tab = 0 +tabs_position = 1 + +[node name="Ship" type="Control" parent="Container/TabContainer"] +layout_mode = 2 +metadata/_tab_index = 0 + +[node name="ShipInfo" type="VBoxContainer" parent="Container/TabContainer/Ship"] +layout_mode = 1 +offset_right = 41.0 +offset_bottom = 31.0 + +[node name="ShipInfoLabel" type="Label" parent="Container/TabContainer/Ship/ShipInfo"] +layout_mode = 2 +text = "Ship Info" + +[node name="Cargo" type="Control" parent="Container/TabContainer"] +visible = false +layout_mode = 2 +metadata/_tab_index = 1 + +[node name="Sensors" type="Control" parent="Container/TabContainer"] +visible = false +layout_mode = 2 +metadata/_tab_index = 2 + +[node name="Actions" type="Control" parent="Container/TabContainer"] +visible = false +layout_mode = 2 +metadata/_tab_index = 3 diff --git a/scenes/main_menu.tscn b/scenes/main_menu.tscn new file mode 100644 index 0000000..2ef037e --- /dev/null +++ b/scenes/main_menu.tscn @@ -0,0 +1,31 @@ +[gd_scene load_steps=2 format=3 uid="uid://h3dgo6me76t7"] + +[ext_resource type="Script" uid="uid://722ol864mjx4" path="res://scripts/MainMenu/MainMenuController.cs" id="1_l6cm7"] + +[node name="Control" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_l6cm7") + +[node name="CenterContainer" type="CenterContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"] +layout_mode = 2 + +[node name="StartGameButton" type="Button" parent="CenterContainer/VBoxContainer"] +layout_mode = 2 +text = "Start Game" + +[node name="ExitGameButton" type="Button" parent="CenterContainer/VBoxContainer"] +layout_mode = 2 +text = "Exit Game" diff --git a/scripts/AI.cs b/scripts/AI.cs new file mode 100644 index 0000000..70ee858 --- /dev/null +++ b/scripts/AI.cs @@ -0,0 +1,62 @@ +using System; + +public partial class AI +{ + public Structure Parent { get; private set; } + + private Random RandomGenerator; + + public AI(Structure parent) + { + this.Parent = parent; + + this.RandomGenerator = new Random(); + } + + public Order Think() + { + // Change of MOVE order, if mobile and in space + if (this.Parent.IsMobile && !this.Parent.IsLanded && Helpers.GetChance(30)) + { + // Chance of local movement + if (Helpers.GetChance(95)) + { + // Chance of aimless movement + if (Helpers.GetChance(100)) + { + CoordinateVector deltaCoordinates = Helpers.GetRandomCoordinatesFromAU( + -0.5M, 0.5M, + -0.5M, 0.5M + ); + CoordinateVector newCoordinates = Helpers.CalculateNewCoordinates(this.Parent, deltaCoordinates); + + return new DestinationOrder(Order.OrderType.MOVE_THRUSTERS, newCoordinates); + } + else + { + + } + } + else + { + // Chance of aimless movement + if (Helpers.GetChance(100)) + { + CoordinateVector deltaCoordinates = Helpers.GetRandomCoordinatesFromLY( + -500M, 500M, + -500M, 500M + ); + CoordinateVector newCoordinates = Helpers.CalculateNewCoordinates(this.Parent, deltaCoordinates); + + return new DestinationOrder(Order.OrderType.MOVE_WARP, newCoordinates); + } + else + { + + } + } + } + + return new TickOrder(Order.OrderType.IDLE, 10); + } +} diff --git a/scripts/AI.cs.uid b/scripts/AI.cs.uid new file mode 100644 index 0000000..34ed773 --- /dev/null +++ b/scripts/AI.cs.uid @@ -0,0 +1 @@ +uid://bug3poo3pmoya diff --git a/scripts/Constants.cs b/scripts/Constants.cs new file mode 100644 index 0000000..6d59771 --- /dev/null +++ b/scripts/Constants.cs @@ -0,0 +1,6 @@ +public static class Constants +{ + public static decimal KM_M = 1000M; + public static decimal AU_M = 149597870700M; + public static decimal LY_M = 9460737937559000M; +} diff --git a/scripts/Constants.cs.uid b/scripts/Constants.cs.uid new file mode 100644 index 0000000..dfbc30c --- /dev/null +++ b/scripts/Constants.cs.uid @@ -0,0 +1 @@ +uid://docln1h1c6m41 diff --git a/scripts/Controller.cs b/scripts/Controller.cs new file mode 100644 index 0000000..4dd8d90 --- /dev/null +++ b/scripts/Controller.cs @@ -0,0 +1,77 @@ +using System; +using Godot; + +public partial class Controller : Node +{ + private decimal LastTick = 0; + private bool TicksThrottled = false; + + public Ship PlayerShip { get; private set; } + + public Button ExitToMenuButton { get; private set; } + + public Label ShipInfoLabel { get; private set; } + + public override void _Ready() + { + base._Ready(); + + this.ExitToMenuButton = GetNode