doctorray117 / minecraft-ondemand

Templates to deploy a serverless Minecraft Server on demand in AWS
Apache License 2.0
1.68k stars 115 forks source link

How did you figure out the bedrock connection monitoring setup? #46

Closed joebywan closed 1 year ago

joebywan commented 2 years ago

I've currently used your setup for a minecraft server which has been great, but I'm trying to wander off into the weeds by setting up a valheim server.

It uses 2456-2457/udp.

I was looking at using something like a python library to query the server direct, but then I realised your bedrock code is detecting connections on UDP.

Spent the evening trying to understand it, currently lost on the bedrockping string you build.

Basically just seeing if you'd be willing to shed some light on it before I spend some more time on it :)

Thanks again.

doctorray117 commented 2 years ago

Bedrock uses the Raknet protocol. I'm using an "unconnected ping" for this. There's also a project itzg/mc-monitor which I considered trying to integrate but it made the container way too big because of the dependency on go.

Even though it's documented, I'm pretty sure I ran the bedrock server on my computer and used wireshark to observe the behavior of the client connecting, and wrote those lines to produce something similar (though I do need to test again as someone else reported an issue with it).

You may also check out node-gamedig which already talks valheim among a bajillion other games.

joebywan commented 2 years ago

Ahh cool. So you're emulating a client trying to query the server, then parsing the response to get the current player count yeah?

Thanks for that link to gamedig, I'll check it out.

joebywan commented 2 years ago

I've been playing with trying to build a container around aws-cli and adding nvm, node & npm to get gamedig on it. Have you managed to get it working?