Giter VIP home page Giter VIP logo

hkmppouch's Introduction

HkmpPouch

Pouch is an Addon meant to serve as an intermediary layer between HKMP API and Networked Addons that want to remain optional on either the client side and/or the server side without any loss of functionality.

Pouch does not re-implement the HKMP API (nor do I have any intentions to do so) you will still probably need a dependency on HKMP itself for most Add-ons, especially on the server side where HKMP server is what loads your server side addon.

Core Features :

  • Peer to Peer communication: Any Server with Pouch installed onto it can be used as a "relay" to allow clients to communicate with each other without the need for writing a server side addon, this allows for simple message passing between clients where you can target a single player, all players in a scene or all players connected to the server.

  • Optional Addons with networking: HKMP supports optional addons as long as they do not require networking, this is because HKMP's protocol depends on the client addon to decode the data sent by the server (and vice-versa). Pouch allows you to circumvent this limitation by using Pouch's networking access, and communicating in a few standard packets that can deliver arbitrary strings to denote data. By serializing and deserializing your events as strings you can do Server - Client addon communication for even the most complex mods while remaining optional on both the sides.

  • Server side temporary data storage Clients can store some data on the server across clients and disconnections, currently 2 types of data are supported.

    • Integer counters : addons can increment or decrement it, the idea is to not depend on the counter's previous value when doing this, to avoid race conditions, this is why it does not support a direct "change value", instead it can be used to track the number of times certain events happen (kills, pogos, hits -- whatever you need)

    • Timed AppendOnlyLists : This is a list of string items on to which you can append more strings, with a TTL of some seconds. This can then be used to persist something in the state of the "world" for a certain duration ( or till the server restarts ). for example this is how I persist skulls of players after they are killed.

Note : Due to the way this works, it means that Pouch in itself becomes a mandatory mod for joining the servers that have it, there's no going around this unfortunately.

Existing example mods :

hkmppouch's People

Contributors

prashantmohta avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

hkmppouch's Issues

HKMP Server Incompatibility with Mono

While trying to set up a standalone server with the HkmpPouch.dll file from the v0.3.0 release, the following error occurs when run using mono:

image

See Text
Found resource for resolving assembly: HKMP
Found resource for resolving assembly: Newtonsoft.Json
[INFO] [HkmpServer.HkmpServer] Starting server v2.1.0
[INFO] [Hkmp.Api.Server.ServerAddonLoader] Trying to load assembly at: /home/pcbowers/hkmp/test/HkmpPouch.dll
[WARN] [Hkmp.Api.Server.ServerAddonLoader]   Could not load assembly, exception: System.BadImageFormatException, message: Invalid Image
[INFO] [Hkmp.Networking.Server.NetServer] Starting NetServer on port 26950

The error does not occur on Windows:

image

See Text
Found resource for resolving assembly: HKMP
Found resource for resolving assembly: Newtonsoft.Json
[INFO] [HkmpServer.HkmpServer] Starting server v2.1.0
[INFO] [Hkmp.Api.Server.ServerAddonLoader] Trying to load assembly at: C:\Users\pcbow\Downloads\test\HkmpPouch.dll
[INFO] [Hkmp.Api.Server.ServerAddonLoader]   Found Hkmp.Api.Server.ServerAddon extending class, constructing addon
[INFO] [Hkmp.Api.Server.ServerAddonManager] Assigned addon HkmpPouch v0.2.0 ID: 0
[INFO] [Hkmp.Api.Server.ServerAddonManager] Initializing server addon: HkmpPouch 0.2.0
[INFO] Pouch Server Addon Version 0.3.0 Ready
[INFO] [Hkmp.Networking.Server.NetServer] Starting NetServer on port 26950

I have confirmed using other HKMP addons that it is not an issue with the server when using mono. As you can see below, HKMP Health Display works just fine:

image

See Text
Found resource for resolving assembly: HKMP
Found resource for resolving assembly: Newtonsoft.Json
[INFO] [HkmpServer.HkmpServer] Starting server v2.1.0
[INFO] [Hkmp.Api.Server.ServerAddonLoader] Trying to load assembly at: /home/pcbowers/hkmp/test/HKMP_HealthDisplay.dll
[INFO] [Hkmp.Api.Server.ServerAddonLoader]   Found Hkmp.Api.Server.ServerAddon extending class, constructing addon
[INFO] [Hkmp.Api.Server.ServerAddonManager] Assigned addon Health Display v0.0.2 ID: 0
[INFO] [Hkmp.Api.Server.ServerAddonManager] Initializing server addon: Health Display 0.0.2
[INFO] [Hkmp.Networking.Server.NetServer] Starting NetServer on port 26950

Similarly, it works in Windows as well:

image

See Text
Found resource for resolving assembly: HKMP
Found resource for resolving assembly: Newtonsoft.Json
[INFO] [HkmpServer.HkmpServer] Starting server v2.1.0
[INFO] [Hkmp.Api.Server.ServerAddonLoader] Trying to load assembly at: C:\Users\pcbow\Downloads\test\HKMP_HealthDisplay.dll
[INFO] [Hkmp.Api.Server.ServerAddonLoader]   Found Hkmp.Api.Server.ServerAddon extending class, constructing addon
[INFO] [Hkmp.Api.Server.ServerAddonManager] Assigned addon Health Display v0.0.2 ID: 0
[INFO] [Hkmp.Api.Server.ServerAddonManager] Initializing server addon: Health Display 0.0.2
[INFO] [Hkmp.Networking.Server.NetServer] Starting NetServer on port 26950

Is there an easy fix for this? I am trying to run this on my digital ocean server using docker, and I would prefer using mono with linux over spinning up a windows server. My knowledge of C# is limited, so I may be missing something!

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.