Community-driven Agones SDK for Godot Engine

Agones SDK for Godot

Release

Welcome to the community-driven Agones SDK for Godot Engine.

Example

extends Node
var peer = null

func _ready():
  if "--server" in OS.get_cmdline_args() or OS.has_feature("Server"):
    host_server(DEFAULT_PORT, MAX_PEERS)

func host_server(port, max_peers):
  peer = NetworkedMultiplayerENet.new()
  peer.create_server(port, max_peers)
  get_tree().set_network_peer(peer)
  # Initialize AGONES SDK
  AgonesSDK.start()
  # Agones .Ready()
  AgonesSDK.ready()

func _process(delta):
  if peer:
    # Agones .Health()
    AgonesSDK.health()

What is Agones?

Agones is an open source, batteries-included, multiplayer dedicated game server scaling and orchestration platform that can run anywhere Kubernetes can run.

This plugin allows your Godot Scripts communicate with Agones by giving you simple GDScript functions. Internally it works by calling the REST API that comes with Agones Server.

Only GDScript is supported for now

Install

To install this plugin, go to Releases and download the latest version agones-sdk.zip.

Inside your Godot Project folder, create a folder named addons and extract the zip file inside it.

After installed, your folder structure will look like this:

image

Getting Started

Activate the plugin

  • Open your project in Godot Editor
  • Go to Project > Project Settings... > Plugins
  • You should see AgonesSDK Plugin. On the right side, check the "Enable" box

image

Use the SDK functions

You now have access to a singleton called AgonesSDK, which you can use to call SDK functions.

The SDK functions does the communication with Agones's sidecar server, which is a small server that goes with your Godot dedicated server inside the Agones Container.

If you want to test in local environment, check this page Local Development - Agones

Ready()

# Simple usage. Automatically retries 10 times and waits 2 seconds before trying again.
AgonesSDK.ready()

# Tries 30 times, waiting 5 seconds between each attempt.
AgonesSDK.ready(30, 5)

Health()

AgonesSDK.health()

Reserve()

# Reserves the server for 10 seconds
AgonesSDK.reserve(10)

# Reserves the server for 60 seconds
AgonesSDK.reserve(60)

Allocate()

AgonesSDK.allocate()

Shutdown()

AgonesSDK.shutdown()

GameServer()

# Get gameserver information
result = yield(AgonesSDK.gameserver(), "agones_response")

success = result[0]  # true if the request was successfull, false otherwise
requested_endpoint = result[1]  # the url requested
info_dict = result[2]  # the JSON body returned by agones sidecar

SetLabel(key, value)

# Set metadata label on agones sidecar servr
AgonesSDK.set_label('version', '1.0.0')

SetAnnotation(key, value)

# Set metadata annotation on agones sidecar servr
AgonesSDK.set_annotation('version', '1.0.0')

Player Tracking

As of writing, the Player Tracking feature of Agones is not implemented by the SDK. Feel free to contribute and send your pull request.

Reference

Type Syntax Description
func .ready(retry, wait_time) retry how many times it will retry. wait_time time in seconds to wait between retries
func .health() Sends a health check
func .reserve(seconds) Reserve for seconds
func .allocate() Set GameServer as Allocated
func .shutdown() Tells Agones to shutdown server
signal agones_response(success, endpoint, content) Emitted when SDK receives an response from Agones. success Boolean if response is sucessfull. endpoint the requested endpoint. content the error message or request body, usually as a Dictionary
signal agones_ready_failed Emitted when .ready fails all its attempts.

See Agones - Client SDK

Contributing

Contributions are very welcome.

License

Distributed under the terms of the MIT license, "godot-agones-sdk" is free and open source software

Owner
André Micheletti
Developer by profession and by heart
André Micheletti
Similar Resources

Arkanoid game in Go using Ebiten game engine with ECS.

Arkanoid game in Go using Ebiten game engine with ECS.

Arkanoid-go Arkanoid game in Go using Ebiten game engine with ECS. You must have Git LFS installed when cloning the repository to download assets. See

Oct 9, 2022

spx - A 2D Game Engine for learning Go+

spx - A 2D Game Engine for learning Go+

spx - A 2D Game Engine for learning Go+ Tutorials How to run spx tutorials? Download Go+ and build it. See https://github.com/goplus/gop#how-to-build.

Dec 1, 2022

Blunder is an open-source UCI compatible chess engine.

A UCI compatible chess engine written in Golang

Dec 30, 2022

Go Game Engine using SDL for fun

nMage nMage is a (hopefully!) high performance 3D Game Engine written in Go being developed live, with recordings posted on YouTube. This project is b

Nov 30, 2022

HelloSpx - Hello world of Go+ spx game engine

HelloSpx - Hello world of Go+ spx game engine

HelloSpx - Hello world of Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download this game

Nov 27, 2021

HelloWorldForSpx - Hello world of Go+ spx game engine

 HelloWorldForSpx - Hello world of Go+ spx game engine

HelloWorldForSpx - Hello world of Go+ spx game engineHelloWorldForSpx - Hello world of Go+ spx game engine

Nov 22, 2021

AircraftWar - a game powered by Go+ spx game engine

AircraftWar - a game powered by Go+ spx game engine

AircraftWar - a game powered by Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download thi

Jan 5, 2022

FlappyCalf - a game powered by Go+ spx game engine

FlappyCalf - a game powered by Go+ spx game engine

FlappyCalf - a game powered by Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download this

Nov 6, 2022

FlappyCalf - a game powered by Go+ spx game engine

FlappyCalf - a game powered by Go+ spx game engine

FlappyCalf - a game powered by Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download this

Nov 6, 2022
Comments
  • Add support to concurrent requests

    Add support to concurrent requests

    What?

    • Adds support for concurrent HTTP requests to Agones sidecar
    • Adds Player tracking support

    Why?

    In the block below

    func on_player_connected(caller_id : int) -> void:
        AgonesSDK.allocate()
        AgonesSDK.player_connect(str(caller_id)
        # Remaining operations....
    

    The plugin throws an error

    HTTPRequest is processing a request. Wait for completion
    

    The suggestion (https://github.com/godotengine/godot/issues/16165) is to create an HTTP request node for each request.

Go 3D Game Engine
Go 3D Game Engine

G3N - Go 3D Game Engine G3N (pronounced "gen") is an OpenGL 3D Game Engine written in Go. It can be used to write cross-platform Go applications that

Jan 9, 2023
Scalable Distributed Game Server Engine with Hot Swapping in Golang
Scalable Distributed Game Server Engine with Hot Swapping in Golang

GoWorld Scalable Distributed Game Server Engine with Hot Reload in Golang Features Architecture Introduction Get GoWorld Manage GoWorld Servers Demos

Dec 25, 2022
A pure Go game engine
A pure Go game engine

Oak A pure Go game engine Table of Contents Installation Motivation Features Support Quick Start Implementation and Examples Finished Games Installati

Jan 8, 2023
Terminal-based game engine for Go, built on top of Termbox
Terminal-based game engine for Go, built on top of Termbox

Termloop Termloop is a pure Go game engine for the terminal, built on top of the excellent Termbox. It provides a simple render loop for building game

Dec 29, 2022
Tile is a 2D grid engine, built with data and cache friendly ways, includes pathfinding and observers.
Tile is a 2D grid engine, built with data and cache friendly ways, includes pathfinding and observers.

Tile: Data-Oriented 2D Grid Engine This repository contains a 2D tile map engine which is built with data and cache friendly ways. My main goal here i

Dec 26, 2022
A chess engine written in golang
A chess engine written in golang

Weasel Art graciously provided by Alex Table of Contents: About Installing and Compiling from Source Contributing License About Weasel is an 0x88 and

Dec 30, 2022
A 2D ARPG game engine.
A 2D ARPG game engine.

Abyss Engine is an ARPG game engine in the same vein of the 2000's games, and supports playing games similar to Diablo 2. The engine is written in golang and is cross platform. This engine does not ship with game specific files, and will require a game's assets in order to run.

Dec 24, 2022
A small fantasy game engine in WASM using GoLang
A small fantasy game engine in WASM using GoLang

The GoLang Fantasy Engine (GoLF Engine) is a retro game engine. It draws inspiration from fantasy console projects like pico-8, tic-80, and pyxle. Like those projects it is designed to be a retro-feeling game creation/playing tool. Unlike those projects GoLF is more minimal in scope and only provides an API and a small set of tools to help you create your games. Tools like an image editor and code editor are not built in. Despite this minimalism creating games in GoLF is still easy and should still maintain the retro game feel.

Jul 16, 2022
Currently in beta testing. A chess engine written in golang
Currently in beta testing. A chess engine written in golang

Weasel Art graciously provided by Alex Table of Contents: About Installing and Compiling from Source Contributing License About Weasel is an 0x88 and

Dec 30, 2022
golang powered game engine
golang powered game engine

Gobatch Go powered engine that offers features from low level opengl abstraction to UI framework. I created this to separate lot of logic from game am

Nov 13, 2022