10 Commits

Author SHA1 Message Date
fff9a3eb11 set version to 0.0.2
All checks were successful
Build Godot Project1 / godot (cadastery-server.x86_64, server) (push) Successful in 3m55s
Build Godot Project1 / godot (cadastery.exe, windows) (push) Successful in 24s
Build Godot Project1 / godot (cadastery.x86_64, linux) (push) Successful in 22s
Build Godot Project1 / godot (cadastery.zip, mac) (push) Successful in 38s
2025-02-13 15:49:26 +10:00
963b70f674 print game version on start 2025-02-13 15:49:05 +10:00
3a4c76cd67 prevent creating empty player on dedicated servers 2025-02-13 15:46:20 +10:00
0fcb151f87 add a check for name entry 2025-02-13 15:45:06 +10:00
340a176e55 rename ip to address and remove ip validation 2025-02-13 02:26:02 +10:00
a762c2d8ad update docker-compose 2025-02-13 02:19:32 +10:00
cac56adbdb update docker-compose 2025-02-13 02:15:00 +10:00
5e9627e453 rename docker-compose.yaml 2025-02-13 01:53:58 +10:00
819c678201 add docker-compose.yml 2025-02-13 01:52:04 +10:00
8a52846c2d add Dockerfile 2025-02-13 01:16:18 +10:00
6 changed files with 71 additions and 19 deletions

30
Dockerfile Normal file
View File

@@ -0,0 +1,30 @@
FROM fedora:latest
ARG GODOT_VERSION="4.3"
ARG SERVER_PORT=10567
ENV GODOT_FILE_NAME="Godot_v${GODOT_VERSION}-stable_linux.x86_64"
ENV GODOT_GAME_NAME="cadastery-server"
RUN dnf update -y
RUN dnf install -y wget
RUN dnf install -y unzip
RUN dnf install -y wayland-devel
RUN dnf install -y fontconfig
ADD https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable//${GODOT_FILE_NAME}.zip ./
RUN mkdir -p ~/.cache \
&& mkdir -p ~/.config/godot \
&& unzip ${GODOT_FILE_NAME}.zip \
&& mv ${GODOT_FILE_NAME} /usr/local/bin/godot \
&& rm -f ${GODOT_FILE_NAME}.zip
WORKDIR /godotapp
COPY . .
RUN godot --headless --export-pack "server" /godotapp/${GODOT_GAME_NAME}.pck
EXPOSE ${SERVER_PORT}/udp
SHELL ["/bin/bash", "-c"]
ENTRYPOINT godot --main-pack ${GODOT_GAME_NAME}.pck

14
docker-compose.yaml Normal file
View File

@@ -0,0 +1,14 @@
services:
cadastery:
build: .
ports:
- '10567:10567'
- '10567:10567/udp'
volumes:
- cadastery-server-userdata:/root/.local/share/Cadastery
tty: true
container_name: cadastery-server
volumes:
cadastery-server-userdata:
driver: local

View File

@@ -11,7 +11,7 @@ config_version=5
[application]
config/name="cadastery"
config/version="0.0.1"
config/version="0.0.2"
run/main_scene="res://scenes/title.tscn"
config/use_custom_user_dir=true
config/custom_user_dir_name="Cadastery"

View File

@@ -19,9 +19,9 @@ anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -216.0
offset_left = -321.5
offset_top = -84.0
offset_right = 216.0
offset_right = 321.5
offset_bottom = 84.0
grow_horizontal = 2
grow_vertical = 2
@@ -54,7 +54,7 @@ text = "Name:"
layout_mode = 2
size_flags_horizontal = 3
focus_neighbor_right = NodePath("../HostButton")
focus_neighbor_bottom = NodePath("../IpEdit")
focus_neighbor_bottom = NodePath("../AddressEdit")
theme_override_font_sizes/font_size = 26
text = "ass"
@@ -65,12 +65,12 @@ focus_neighbor_bottom = NodePath("../JoinButton")
theme_override_font_sizes/font_size = 26
text = "Host"
[node name="IpLabel" type="Label" parent="Menu/PlayMenu/MarginContainer/GridContainer"]
[node name="AddressLabel" type="Label" parent="Menu/PlayMenu/MarginContainer/GridContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 26
text = "IP:"
text = "Address:"
[node name="IpEdit" type="LineEdit" parent="Menu/PlayMenu/MarginContainer/GridContainer"]
[node name="AddressEdit" type="LineEdit" parent="Menu/PlayMenu/MarginContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
focus_neighbor_top = NodePath("../NameEdit")
@@ -80,7 +80,7 @@ text = "127.0.0.1"
[node name="JoinButton" type="Button" parent="Menu/PlayMenu/MarginContainer/GridContainer"]
layout_mode = 2
focus_neighbor_left = NodePath("../IpEdit")
focus_neighbor_left = NodePath("../AddressEdit")
focus_neighbor_top = NodePath("../HostButton")
theme_override_font_sizes/font_size = 26
text = "Join"

View File

@@ -57,10 +57,10 @@ func host_game(dedicated: bool = false) -> void:
_add_player(multiplayer.get_unique_id())
func join_game(ip: String) -> void:
print("Joining " + ip + "...")
func join_game(address: String) -> void:
print("Joining " + address + "...")
_peer = ENetMultiplayerPeer.new()
var error := _peer.create_client(ip, DEFAULT_PORT)
var error := _peer.create_client(address, DEFAULT_PORT)
if error:
match error:
@@ -116,9 +116,12 @@ func _remove_player(peer_id: int) -> void:
@rpc("any_peer", "reliable")
func _register_player(player_info: Dictionary) -> void:
print("Registering player ", player_info)
var player_id := multiplayer.get_remote_sender_id()
_players[player_id] = player_info
player_connected.emit(player_id, player_info)
var peer_id := multiplayer.get_remote_sender_id()
if peer_id == 1 and !player_info["name"]:
print("Registered player's id is ",peer_id, " and name is empty, so skipping")
return
_players[peer_id] = player_info
player_connected.emit(peer_id, player_info)
func _on_multiplayer_peer_connected(peer_id: int) -> void:

View File

@@ -1,13 +1,15 @@
extends Panel
@onready var _name_edit: LineEdit = $MarginContainer/GridContainer/NameEdit
@onready var _ip_edit: LineEdit = $MarginContainer/GridContainer/IpEdit
@onready var _address_edit: LineEdit = $MarginContainer/GridContainer/AddressEdit
@onready var _host_button: Button = $MarginContainer/GridContainer/HostButton
@onready var _join_button: Button = $MarginContainer/GridContainer/JoinButton
@onready var _error_label: Label = $ErrorLabel
func _ready() -> void:
print("Cadastery v", ProjectSettings.get_setting("application/config/version"))
if OS.has_feature("dedicated_server") or DisplayServer.get_name() == "headless":
Networker.call_deferred("host_game", true)
return
@@ -24,21 +26,24 @@ func _display_error(message: String) -> void:
func _on_host_button_pressed() -> void:
if !_name_edit.text:
_display_error("Name cannot be empty")
return
Networker.set_local_player_info(_name_edit.text)
Networker.host_game()
func _on_join_button_pressed() -> void:
var ip: String = _ip_edit.text
if not ip.is_valid_ip_address():
_display_error("Invalid IP address")
if !_name_edit.text:
_display_error("Name cannot be empty")
return
_join_button.disabled = true
_host_button.disabled = true
Networker.set_local_player_info(_name_edit.text)
Networker.join_game(_ip_edit.text)
Networker.join_game(_address_edit.text)
func _on_networker_network_error(message: String) -> void: