This repository has been archived by the owner on Dec 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e4e511c
commit 951bbb9
Showing
57 changed files
with
1,191 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Docker | ||
Dockerfile | ||
.dockerignore | ||
|
||
# Godot 4+ specific ignores | ||
.godot/ | ||
|
||
# Godot-specific ignores | ||
.import/ | ||
|
||
# Mono-specific ignores | ||
.mono/ | ||
data_*/ | ||
mono_crash.*.json | ||
|
||
# System/tool-specific ignores | ||
.directory | ||
.DS_Store | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Normalize EOL for all files that Git considers text files. | ||
* text=auto eol=lf | ||
|
||
*.hdr binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Godot 4+ specific ignores | ||
.godot/ | ||
|
||
# Godot-specific ignores | ||
.import/ | ||
|
||
# Mono-specific ignores | ||
.mono/ | ||
data_*/ | ||
mono_crash.*.json | ||
|
||
# System/tool-specific ignores | ||
.directory | ||
.DS_Store | ||
*~ | ||
|
||
### Rivet ### | ||
.rivet/ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM ubuntu:22.04 AS builder | ||
|
||
# Install Godot & templates | ||
ENV GODOT_VERSION="4.0.2" | ||
RUN apt update -y \ | ||
&& apt install -y wget unzip \ | ||
&& wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}/Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip \ | ||
&& wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}/Godot_v${GODOT_VERSION}-stable_export_templates.tpz | ||
|
||
RUN mkdir -p ~/.cache ~/.config/godot ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable \ | ||
&& unzip Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip \ | ||
&& mv Godot_v${GODOT_VERSION}-stable_linux.x86_64 /usr/local/bin/godot \ | ||
&& unzip Godot_v${GODOT_VERSION}-stable_export_templates.tpz \ | ||
&& mv templates/* ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable \ | ||
&& rm Godot_v${GODOT_VERSION}-stable_export_templates.tpz Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip | ||
|
||
# Build application | ||
WORKDIR /app | ||
COPY . . | ||
RUN mkdir -p build/linux \ | ||
&& godot -v --export-release "Linux/X11" --headless ./build/linux/game.x86_64 | ||
|
||
# === | ||
|
||
FROM ubuntu:22.04 | ||
RUN apt update -y \ | ||
&& apt install -y expect-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
COPY --from=builder /app/build/linux/ /app | ||
|
||
# Unbuffer output so the logs get flushed | ||
CMD ["sh", "-c", "unbuffer /app/game.x86_64 --verbose --headless -- --server | cat"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Rivet | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Bomber | ||
|
||
|
||
|
||
[Visit Tutorial](https://rivet.gg/learn/godot/tutorials/crash-course) | ||
|
||
|
||
| Engine Version | Language | Networking | | ||
| --- | --- | --- | | ||
| 4.0.0 | [GDScript](https://docs.godotengine.org/en/stable/getting_started/scripting/gdscript/gdscript_basics.html) | [High-Level Multiplayer](https://docs.godotengine.org/en/stable/tutorials/networking/high_level_multiplayer.html) | | ||
|
||
**Rivet Features** | ||
|
||
- [♟️ Matchmaker](https://rivet.gg/docs/matchmaker) | ||
- [🌐 Dynamic Servers](https://rivet.gg/docs/dynamic-servers) | ||
|
||
|
||
## Running locally | ||
|
||
1. [Clone the GitHub repo](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) | ||
2. Open this folder | ||
3. Run: `rivet init` | ||
4. Run `yarn start` | ||
|
||
## Deploying to Rivet | ||
|
||
[Documentation](https://rivet.gg/learn/godot/tutorials/crash-course#step-4-deploy-to-rivet) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
@tool | ||
extends VBoxContainer | ||
|
||
var poll_timer: Timer | ||
var rng := RandomNumberGenerator.new() | ||
|
||
var server_pid = null | ||
|
||
func _ready(): | ||
poll_timer = Timer.new() | ||
poll_timer.autostart = true | ||
poll_timer.timeout.connect(_poll_server_status) | ||
add_child(poll_timer) | ||
|
||
|
||
func exec_sh(script: String) -> int: | ||
return OS.create_process("sh", ["-c", script]) | ||
# OS.create_process("CMD.exe", ["/C", script], output) | ||
|
||
|
||
func run_rivet_command(args: PackedStringArray): | ||
var execute_id = rng.randi() | ||
return OS.create_process("rivet", args) | ||
|
||
|
||
## Checks if the server process is still running. | ||
func _poll_server_status(): | ||
# Check if server still running | ||
if server_pid != null and !OS.is_process_running(server_pid): | ||
print("Server stopped") | ||
server_pid = null | ||
|
||
# Update stop button | ||
$StopServer.disabled = server_pid == null | ||
if server_pid != null: | ||
$StartServer.text = "Restart Server" | ||
$ServerPID.text = "Process ID: %s" % server_pid | ||
$ServerPID.visible = true | ||
else: | ||
$StartServer.text = "Start Server" | ||
$StopServer.text = "Stop Server" | ||
$ServerPID.visible = false | ||
|
||
func start_server(): | ||
if server_pid != null: | ||
stop_server() | ||
|
||
server_pid = OS.create_process(OS.get_executable_path(), ["--headless", "--", "--server"]) | ||
|
||
_poll_server_status() | ||
|
||
|
||
## Kills the server if running. | ||
func stop_server(): | ||
if server_pid != null: | ||
print("Stopped serer") | ||
OS.kill(server_pid) | ||
server_pid = null | ||
_poll_server_status() | ||
else: | ||
print("Server not running") | ||
|
||
|
||
# MARK: UI | ||
func _on_dashboard_pressed(): | ||
run_rivet_command(["game", "dashboard"]) | ||
|
||
|
||
func _on_start_server_pressed(): | ||
start_server() | ||
|
||
|
||
func _on_stop_server_pressed(): | ||
stop_server() | ||
|
||
|
||
#func _on_edit_config_pressed(): | ||
# print(ProjectSettings.globalize_path("res://rivet.toml")) | ||
# OS.shell_open("file://%s" % ProjectSettings.globalize_path("res://rivet.toml")) | ||
|
||
|
||
#func _on_deploy_pressed(): | ||
# deploy_pid = run_rivet_command(["deploy", "--namespace", "prod"]) | ||
# _poll_server_status() |
Git LFS file not shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
extends Node | ||
class_name DotEnv | ||
|
||
func config(): | ||
var path = "res://.env" | ||
|
||
# Check if .env exists | ||
if !FileAccess.file_exists(path): | ||
RivetHelper.rivet_print(".env does not exist") | ||
return | ||
|
||
# Read .env file | ||
var file = FileAccess.open(path, FileAccess.READ) | ||
while !file.eof_reached(): | ||
var line = file.get_line() | ||
|
||
# Ignore comments | ||
if line.begins_with("#"): | ||
continue | ||
|
||
# Split line | ||
var split = line.split("=", true, 2) | ||
if split.size() != 2: | ||
continue | ||
var key = split[0] | ||
var value = split[1] | ||
|
||
# Trim quotes from value | ||
if value.begins_with("\"") and value.ends_with("\""): | ||
value = value.substr(1, value.length() - 2) | ||
|
||
# Set env | ||
OS.set_environment(split[0], split[1]) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Git LFS file not shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[plugin] | ||
|
||
name="Rivet API" | ||
description="" | ||
author="Rivet Gaming, Inc." | ||
version="0.0.1" | ||
script="rivet_api.gd" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# === Rivet Version Configuration === | ||
# | ||
# - More info: https://docs.rivet.gg/general/concepts/rivet-version-config | ||
# - Reference: https://docs.rivet.gg/cloud/api/post-games-versions#body | ||
# - Publish a new version with `rivet publish` | ||
# | ||
|
||
# How the game lobbies run and how players connect to the game. | ||
# | ||
# https://docs.rivet.gg/matchmaker/introduction | ||
[matchmaker] | ||
# How many players can join a specific lobby. | ||
# | ||
# Read more about matchmaking: https://docs.rivet.gg/matchmaker/concepts/finding-lobby | ||
max_players = 32 | ||
|
||
# The hardware to provide for lobbies. | ||
# | ||
# Available tiers: https://docs.rivet.gg/serverless-lobbies/concepts/available-tiers | ||
tier = "basic-1d1" | ||
|
||
# Which regions the game should be available in. | ||
# | ||
# Available regions: https://docs.rivet.gg/serverless-lobbies/concepts/available-regions | ||
[matchmaker.regions] | ||
lnd-sfo = {} | ||
lnd-fra = {} | ||
|
||
# Runtime configuration for the lobby's Docker container. | ||
[matchmaker.docker] | ||
# If you're unfamiliar with Docker, here's how to write your own | ||
# Dockerfile: | ||
# https://docker-curriculum.com/#dockerfile | ||
dockerfile = "Dockerfile" | ||
|
||
# Which ports to allow players to connect to. Multiple ports can be defined | ||
# with different protocols. | ||
# | ||
# How ports work: https://docs.rivet.gg/serverless-lobbies/concepts/ports | ||
ports.default = { port = 10567, protocol = "udp" } | ||
|
||
# What game modes are avaiable. | ||
# | ||
# Properties like `max_players`, `tier`, `dockerfile`, `regions`, and more can | ||
# be overriden for specific game modes. | ||
[matchmaker.game_modes] | ||
default = {} | ||
|
||
[kv] | ||
|
||
[identity] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@tool | ||
extends EditorPlugin | ||
|
||
# MARK: Plugin | ||
const AUTO_LOAD_RIVET_CLIENT = "RivetClient" | ||
const AUTO_LOAD_RIVET_HELPER = "RivetHelper" | ||
|
||
var dock: Control | ||
|
||
func _enter_tree(): | ||
# Add singleton | ||
add_autoload_singleton(AUTO_LOAD_RIVET_CLIENT, "res://addons/rivet_api/rivet_client.gd") | ||
add_autoload_singleton(AUTO_LOAD_RIVET_HELPER, "res://addons/rivet_api/rivet_helper.gd") | ||
|
||
# Add dock | ||
dock = preload("res://addons/rivet_api/dock/dock.tscn").instantiate() | ||
add_control_to_dock(DOCK_SLOT_LEFT_BR, dock) | ||
|
||
func _exit_tree(): | ||
# Remove singleton | ||
remove_autoload_singleton(AUTO_LOAD_RIVET_CLIENT) | ||
remove_autoload_singleton(AUTO_LOAD_RIVET_HELPER) | ||
|
||
# Remove dock | ||
remove_control_from_docks(dock) | ||
dock.free() | ||
|
Oops, something went wrong.