Skip to content

An attempt to bring .NET scripting into classic "Ace of Spades" (0.x) servers ❤️

License

Notifications You must be signed in to change notification settings

Conticop/Spadecs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spadecs

Build Status
An attempt to bring .NET scripting into classic "Ace of Spades" (0.x) servers ❤️
The goal is to be able to use C# (or any .NET language) for scripting server-side.

Why?

Because we can... (and because I'm noobmen at Python 😆)
But, mainly because I want to learn some Python. Oh, and by the way I also want to make hot-reloading possible.
I will try my best to support all (modern) server implementations, while keeping everything as smooth as possible, cross-platform and architecture independent.

Currently supported targets

  • piqueserver (Python 3) on Windows/Linux/Mac/RaspberryPi | x86, x64, ARM, ARM64

⚠️ WARNING: Only Python 3-based targets will be supported from now on.
NOTE: I am slowly dropping the support for Python 2 targets (PySpades and PySnip), very soon (in fact some of the code has already become red for Python 2 here), because they are really no longer maintained and also Python 2 gone End-of-Life.
Theoretically speaking, Spadecs should run fine on any Python 3-based server implementation, and also as long as you have .NET Runtime installed.

More about hot-reloading (csx)

Hot-reloading means as you make changes to the server-code while it is up and running, you would see those changes applied immediately on the server (no more server restarting). Wouldn't that be cool? 😎
C# hot-reloading is work-in-progress, you can read the source code by going into CSharpScripten folder.
However, we are not living in a perfect world, so everything comes with advantages and disadvantages.
The primary and biggest advantage of our code hot-reloading is: real-time interaction with server-code.
The downside to this is, you won't be able to debug the csx code, because it is being recompiled on-the-fly (in memory).
In other words, if you want the ability to be able to fully debug your server-code while it is running, you must compile .NET code into a binary (library) DLL.

Installing

If you want to manually build Spadecs from source:

I can do it myself!

Building

  1. Install .NET SDK (5.0 or higher), using latest available is highly recommended.
  2. Download or Clone the repository (using git clone https://github.com/Conticop/Spadecs, or use your favorite GUI).
    • If you choose to download via zip: After downloading, extract the zip archive to preferable location, and open a command prompt (Terminal) inside an extracted folder.
    • If you choose to clone: After cloning, open the repo folder (cd Spadecs).
  3. Run dotnet build Spadecs.

Note: In order to build Spadecs successfully, you must have at least .NET 5.0 SDK.
If there are no errors, the output binaries shall be located in a new dotnet folder under scripts.
If you have encountered a build error and can't figure it out, please don't hesitate to report an issue.
If you made it this far, you are ready to proceed to Running section.

If you want to get started as soon as possible:

Let's go fast!

Steps

  1. Download the latest precompiled release for your system.

Jump to Running section.

Running

  1. If you have build Spadecs from source, skip this step. Otherwise, download and install .NET Runtime.
  2. Copy all contents of the scripts folder (*.py files + dotnet folder) into your server scripts folder.
  3. Modify your server configuration file to include and run dotnet script, it is recommended to place it first before any other scripts.
  4. Launch your server.
  5. ???
  6. Profit.

Troubleshooting & Notes

  • You only need .NET Runtime unless you intent to build Spadecs from source.

  • Are you getting %1 is not valid Win32 program error upon server launch?

    • This is a known problem when you are running 32-bit server instance on 64-bit Windows.
    • Make sure you install 32-bit (x86) .NET SDK/Runtime. And also assign DOTNETHOME_X86 (system) environment variable to point at installation folder (by default, C:\Program Files (x86)\dotnet):
      image

License

Spadecs is licensed under the terms of the MIT license.
See LICENSE file for more information.