diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..110fedb --- /dev/null +++ b/LICENSE @@ -0,0 +1,57 @@ +Echoform Source License +======================= + +Copyright (c) 2025 Floffah +All rights reserved. + +This repository is made publicly accessible for the purposes of transparency, personal portfolio, +technical discussion, and internal or collaborative documentation. + +This is **not an open source license**. No license is granted to use, copy, +modify, publish, distribute, sublicense, or sell any part of the source code, +assets, documentation, or other files in this repository. + +You may: + +- View the contents of this repository for personal reference +- Discuss the contents publicly, so long as no code is reused, copied, or redistributed in any form + +You may **not**: + +- Reuse, incorporate, or adapt this code or any part of it in your own project +- Copy, redistribute, or mirror any portion of the codebase or its assets +- Fork or clone this repository +- Publish this code under another name or license +- Use the code or assets in any commercial, open source, or public-facing project +- Use the code or assets in educational settings, except as explicitly defined below + +All content in this repository is the intellectual property of the author(s) and +is protected under applicable copyright and intellectual property laws. + +The author(s) retain full rights to: + +- Remove or privatize this repository at any time +- Release parts or all of the project under a different license in the future +- Commercialize the project, including selling it on platforms such as Steam + +Violation of these terms may result in legal action under applicable intellectual property law. + +For licensing inquiries, collaboration requests, or permission to use any part of +this project, please contact: [enquiries@floffah.dev](mailto:enquiries@floffah.dev) / https://www.floffah.dev + +--- + +## Amendments + +### Educational Use Exception + +You are permitted to use this code in **non-commercial educational settings** for the purposes of learning, classroom instruction, or academic exploration, provided that: + +- You do not publish, upload, or otherwise distribute modified or unmodified versions of the code, in whole or in part +- You do not use the code or any derived version in **any commercial or monetized context**, including but not limited to: + - YouTube tutorials + - Educational blog posts or articles + - Paid courses (online or in-person) + - Online or public repositories containing this code +- Proper attribution is given to the original author when used in academic presentations or internal materials +- No part of the code or project is used in software that is publicly accessible, even if non-commercial, without explicit written permission from the author(s) diff --git a/README.md b/README.md index 2cef827..e51fe24 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,12 @@ -tMy attempt at making an MMO game using Godot and Bun. +# 📜 License Notice +This repository is provided for transparency, personal portfolio, and documentation purposes.
+It is not open source. All rights reserved by the author. + +See [`LICENSE`](./LICENSE) for full terms. + +# Echoform + +My attempt at making an MMO game using Godot and Bun. Packages: diff --git a/game/project.godot b/game/project.godot index a679698..0e17de7 100644 --- a/game/project.godot +++ b/game/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="EchoformMMOGame" -run/main_scene="res://scenes/connecting_menu.tscn" +run/main_scene="res://scenes/connecting_menu/connecting_menu.tscn" config/features=PackedStringArray("4.5", "C#", "Forward Plus") config/icon="res://icon.svg" diff --git a/game/scenes/connecting_menu.tscn b/game/scenes/connecting_menu/connecting_menu.tscn similarity index 53% rename from game/scenes/connecting_menu.tscn rename to game/scenes/connecting_menu/connecting_menu.tscn index 02878a5..68d1276 100644 --- a/game/scenes/connecting_menu.tscn +++ b/game/scenes/connecting_menu/connecting_menu.tscn @@ -1,11 +1,20 @@ [gd_scene load_steps=2 format=3 uid="uid://b5fc11a4rltt1"] -[ext_resource type="Script" uid="uid://ogabnaxf3i7u" path="res://scripts/menus/mainmenu.gd" id="1_84nss"] +[ext_resource type="Script" uid="uid://ogabnaxf3i7u" path="res://scripts/menus/mainmenu.gd" id="1_jxs3d"] -[node name="ConnectingMenu" type="Node2D"] -script = ExtResource("1_84nss") +[node name="ConnectingMenu" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +script = ExtResource("1_jxs3d") [node name="Button" type="Button" parent="."] +layout_mode = 0 offset_left = 259.0 offset_top = 126.0 offset_right = 300.0 diff --git a/game/scenes/connecting_menu/content_theme.tres b/game/scenes/connecting_menu/content_theme.tres new file mode 100644 index 0000000..5dc5bf3 --- /dev/null +++ b/game/scenes/connecting_menu/content_theme.tres @@ -0,0 +1,7 @@ +[gd_resource type="Theme" load_steps=2 format=3 uid="uid://cpub04oardilt"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4cf6d"] +bg_color = Color(0.29219002, 0.29219005, 0.29218993, 1) + +[resource] +PanelContainer/styles/panel = SubResource("StyleBoxFlat_4cf6d") diff --git a/game/scenes/modal/basic_text_modal.gd b/game/scenes/modal/basic_text_modal.gd new file mode 100644 index 0000000..5546ef0 --- /dev/null +++ b/game/scenes/modal/basic_text_modal.gd @@ -0,0 +1,4 @@ +extends CenterContainer + +func _on_dismiss_button_pressed() -> void: + queue_free() diff --git a/game/scenes/modal/basic_text_modal.gd.uid b/game/scenes/modal/basic_text_modal.gd.uid new file mode 100644 index 0000000..6318ead --- /dev/null +++ b/game/scenes/modal/basic_text_modal.gd.uid @@ -0,0 +1 @@ +uid://bnyr4aeean5tf diff --git a/game/scenes/modal/basic_text_modal.tscn b/game/scenes/modal/basic_text_modal.tscn new file mode 100644 index 0000000..af562fc --- /dev/null +++ b/game/scenes/modal/basic_text_modal.tscn @@ -0,0 +1,91 @@ +[gd_scene load_steps=7 format=3 uid="uid://bpo5ihu8h4jji"] + +[ext_resource type="Script" uid="uid://bnyr4aeean5tf" path="res://scenes/modal/basic_text_modal.gd" id="1_37te1"] +[ext_resource type="Theme" uid="uid://cfw15mand7swi" path="res://scenes/modal/header_theme.tres" id="1_bfvhs"] +[ext_resource type="Theme" uid="uid://cpub04oardilt" path="res://scenes/connecting_menu/content_theme.tres" id="2_37te1"] + +[sub_resource type="LabelSettings" id="LabelSettings_84nss"] +font_size = 21 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_os3fi"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0.1, 0.1, 0.1, 0.6) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +corner_detail = 5 +expand_margin_left = 7.0 +expand_margin_right = 7.0 + +[sub_resource type="Theme" id="Theme_yr8gy"] +Button/font_sizes/font_size = 12 +Button/styles/normal = SubResource("StyleBoxFlat_os3fi") + +[node name="CenterContainer" type="CenterContainer"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_37te1") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 2 +theme_override_constants/separation = 0 + +[node name="Header" type="PanelContainer" parent="VBoxContainer"] +layout_mode = 2 +theme = ExtResource("1_bfvhs") + +[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/Header"] +layout_mode = 2 +theme_override_constants/margin_left = 10 +theme_override_constants/margin_top = 5 +theme_override_constants/margin_right = 10 +theme_override_constants/margin_bottom = 5 + +[node name="Title" type="Label" parent="VBoxContainer/Header/MarginContainer"] +layout_mode = 2 +text = "Title" +label_settings = SubResource("LabelSettings_84nss") + +[node name="Content" type="PanelContainer" parent="VBoxContainer"] +layout_mode = 2 +theme = ExtResource("2_37te1") + +[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/Content"] +layout_mode = 2 +theme_override_constants/margin_left = 10 +theme_override_constants/margin_top = 5 +theme_override_constants/margin_right = 10 +theme_override_constants/margin_bottom = 5 + +[node name="Label" type="Label" parent="VBoxContainer/Content/MarginContainer"] +layout_mode = 2 +text = "Some content" + +[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer"] +layout_mode = 2 +theme = ExtResource("2_37te1") + +[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/PanelContainer"] +layout_mode = 2 +theme_override_constants/margin_left = 10 +theme_override_constants/margin_top = 5 +theme_override_constants/margin_right = 12 +theme_override_constants/margin_bottom = 5 + +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/PanelContainer/MarginContainer"] +layout_direction = 3 +layout_mode = 2 + +[node name="DismissButton" type="Button" parent="VBoxContainer/PanelContainer/MarginContainer/HBoxContainer"] +layout_mode = 2 +theme = SubResource("Theme_yr8gy") +text = "OK" + +[connection signal="pressed" from="VBoxContainer/PanelContainer/MarginContainer/HBoxContainer/DismissButton" to="." method="_on_dismiss_button_pressed"] diff --git a/game/scenes/modal/header_theme.tres b/game/scenes/modal/header_theme.tres new file mode 100644 index 0000000..fc13481 --- /dev/null +++ b/game/scenes/modal/header_theme.tres @@ -0,0 +1,7 @@ +[gd_resource type="Theme" load_steps=2 format=3 uid="uid://cfw15mand7swi"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_84nss"] +bg_color = Color(0.08485205, 0.14823782, 0.08485826, 1) + +[resource] +PanelContainer/styles/panel = SubResource("StyleBoxFlat_84nss") diff --git a/game/scenes/modal/specialised/couldnt_connect_modal.tscn b/game/scenes/modal/specialised/couldnt_connect_modal.tscn new file mode 100644 index 0000000..ae4c756 --- /dev/null +++ b/game/scenes/modal/specialised/couldnt_connect_modal.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=2 format=3 uid="uid://bdry5nvuem1jo"] + +[ext_resource type="PackedScene" uid="uid://bpo5ihu8h4jji" path="res://scenes/modal/basic_text_modal.tscn" id="1_ralu3"] + +[node name="CenterContainer" instance=ExtResource("1_ralu3")] + +[node name="Title" parent="VBoxContainer/Header/MarginContainer" index="0"] +text = "Could not connect" + +[node name="Label" parent="VBoxContainer/Content/MarginContainer" index="0"] +text = "An error occurred while trying to connect +to the server. Please contact the +developers for more information." diff --git a/game/scripts/authoritative/AuthoritativeServerConnection.cs b/game/scripts/authoritative/AuthoritativeServerConnection.cs index a31dc27..727646d 100644 --- a/game/scripts/authoritative/AuthoritativeServerConnection.cs +++ b/game/scripts/authoritative/AuthoritativeServerConnection.cs @@ -13,6 +13,9 @@ public partial class AuthoritativeServerConnection : Node { private string _accessToken; private string _refreshToken; + private readonly PackedScene couldntConnectModalScene = + ResourceLoader.Load("res://scenes/modal/specialised/couldnt_connect_modal.tscn"); + public override void _Ready() { if (Instance != null) { GD.PrintErr("AuthoritativeServerConnection instance already exists. Destroying duplicate."); @@ -49,6 +52,12 @@ private void OnRequestCompleted(long result, long responseCode, string[] headers } else { GD.PrintErr("Authentication failed. Response code: ", responseCode, ", Body: ", Encoding.UTF8.GetString(body)); + + var couldntConnectModal = couldntConnectModalScene.Instantiate(); + couldntConnectModal.SetAnchorsPreset(Control.LayoutPreset.FullRect); + GetTree().Root.AddChild(couldntConnectModal); + + Reset(); } } diff --git a/game/scripts/menus/mainmenu.gd b/game/scripts/menus/mainmenu.gd index 41f4f84..32e94a7 100644 --- a/game/scripts/menus/mainmenu.gd +++ b/game/scripts/menus/mainmenu.gd @@ -1,4 +1,4 @@ -extends Node2D +extends Control func _on_play_pressed(): AuthoritativeServerConnection.SendReady()