Giter Site home page Giter Site logo

conticop / spadecs Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 141 KB

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

License: MIT License

C# 51.87% Python 48.13%
buld-then-snip build-and-shoot ace-of-spades csharp dotnet scripting pyspades pysnip piqueserver cross-platform

spadecs's Introduction

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.

spadecs's People

Contributors

conticop avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

spadecs's Issues

Implement scripting framework/API (.NET)

This is required in order to interact with the server from .NET side. API would have to be introduced.

For example to kick a specific player from the server, one way would be to have a managed class representing player/client.

// Find the target player
var ply = Player.GetByID(8);
// Kick the player
ply?.Kick(/*reason*/);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.