Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mod communication system #14

Merged
merged 1 commit into from May 17, 2016
Merged

Add mod communication system #14

merged 1 commit into from May 17, 2016

Conversation

bdew
Copy link
Contributor

@bdew bdew commented May 13, 2016

More or less what i described here: http://forum.wurmonline.com/index.php?/topic/133085-released-server-mod-loader-priest-crops-seasons-server-packs-bag-of-holding/&page=17#comment-1444175

I went with a packet based system, taking over packet id -100. Currently wurm uses all positive values, and the lowest used negative value is -52, so this seems like a safe bet from future expansion.

Channels are registered by mods on both client and server, using string identifiers. Numeric ids are assigned at runtime for more efficient communication. Messages between mods are sent as ByteBuffer's that can contain anything, a helper reader/writer class is provided for those that want an easier interface.

The handshake works like this:

  • On client login, server sends an event message beggining with "[ModCommV1]" (the rest can be human readable for unmodded users).
  • Client detects this message, hides it and sends a packet to the server with all registered channels.
  • Server compares list of channels from the client to it's own and marks all shared channels as activated. Notifies mods. Sends a final list of channels, and their numeric IDs to the client.
  • Client receives final list, marks channels as active and notifies mods.

A modded client logging into an unmodded server will see nothing, while an unmodded client logging into a modded server will see the human readable message with a link to the modloader thread, but otherwise will get no spam and can play normally.

I've changed the serverpacks mod to use the new system, and also @TysonCodes tooltip mod (the changes are here - will submit a PR to him once this is accepted).

Client side part here - ago1024/WurmClientModLauncher#6

@ago1024 ago1024 merged commit 4bab4b7 into ago1024:master May 17, 2016
@ago1024
Copy link
Owner

ago1024 commented May 17, 2016

The channels are setup later than the messages were so the serverpack mod loaded the packs after all models were already loaded.
I had to add new code to request a view area refresh from the server. But thanks to the channels this was a pretty easy task now.

@bdew
Copy link
Contributor Author

bdew commented May 18, 2016

Interesting, i've had some problems with stuff happening too late when changing the tooltip mod to use channels (but i solved that using some buffering of messages), but haven't noticed it with serverpacks. I tested only with the map and that loads only when opened i guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants