SFS2X Docs / ExamplesGodot / introduction
» Godot / C# examples
In this section we provide several brief tutorials on the C# examples built for the Godot 4 engine and distributed as a dedicated package in our SmartFoxServer 2X download page. The examples have been developed with Godot Mono 4.0.3, but the concepts and the code to interact with the SFS2X API are valid for any version of Godot 4.x (unless otherwise noted).
Each tutorial examines a single example, describing its objectives, offering an insight into the SmartFoxServer features it wants to highlight and providing the direct link to download the source code. This includes all the assets required to compile and test the example (both client and — if existing — server side). If necessary, code excerpts are provided in the tutorial itself, in order to better explain the approach that was followed to implement a specific feature. At the bottom of the tutorial, additional resources are linked if available.
The tutorials have an increasing complexity, from basic server connection to a complete game with authoritative server code.
Specifically, the examples will showcase:
- basic connection with optional protocol encryption
- room management
- buddy list management
- game rooms and match-making
- authoritative server in a turn-based game
» Supported Export platforms
The Godot examples provided in this section are tested for exporting as native executables for Windows and macOS. At the time of writing this article (June 2023) Godot Mono does not yet support exporting for mobile platform or the browser.
Check this link for more information on the API setup.
All the examples make use of the latest version of the SmartFoxServer 2X C# API available at the time of their development (last update: June 2023). As the API evolves over time (bug fixes, new features), we strongly recommend that, after downloading an example, you overwrite the included API DLL files with those provided in the latest SmartFoxServer C# API package available on our website.