overviewer / Minecraft-Overviewer

Render high-resolution maps of a Minecraft world with a Leaflet powered interface
https://overviewer.org/
GNU General Public License v3.0
3.35k stars 480 forks source link

Real-time player position support. #1589

Open QuantumToasted opened 5 years ago

QuantumToasted commented 5 years ago

I'm opening this issue simply because the "official" real-time player position addon simply does not work anymore - the guide and plugins it specifies are eight years old now and simply fail when attempting to configure it to run on a modern Spigot server. If I should be opening this issue on that repo, I will do so, but it's just so old it feels like necro'ing a years-old forum thread.

It would be a great selling point since this is pretty much my make or break feature that is making me think of switching back to dynmap. I would love to have a much more streamlined and maybe even official support for displaying player locations on Overviewer maps.

IonicEcko commented 5 years ago

Would like to put my worthless weight behind this request. I'm not sure which came first, dynmap or this but this one appears to get way more love! Nice job

huntedhawk commented 5 years ago

IMHO thats not what this project is built for but if you wanted this kind of functionality you could have a scheduled task (cron) running just the genpoi part at a high interval (i use the --skip-scan option and its takes about 45 seconds to run) and you would get almost real-time updated markersdb.js file.

QuantumToasted commented 5 years ago

I mean, obviously I'm not the first to request this; as I was doing research to try to find a working plugin, i found multitude of attempts or successes in accomplishing my goal. As I mentioned in my original post, Overviewer had its own repository of plugins, most of which are quite outdated and some of which simply don't work at all anymore.

At the very least, I simply just wanted to see if someone wanted to take up the torch to fork and fix the original plugin, or just make their own. I'd like to see better plugin support in the future but that's not the point here. Player positions can be a selling point between map generation tools, and it's likely a reason some people might choose, say, DynMap over this. I'd hope for Overviewer to catch up in that regard, since it's the only complaint I've ever had. :smile:

CounterPillow commented 5 years ago

My suggestion is this: Have the plugin create a web socket server which streams player data. Then, using custom web assets that only override index.html, change it so that it loads the clientside script that does connect to the web socket server by registering a callback to overviewer.util.ready.

Inside the clientside script you mostly need to yoink data out of the web socket server and then add/change leaflet markers as needed.

alvarlagerlof commented 5 years ago

I'd love for an official feature that allows this or a plugin too. Genpoi really isn't that fast, should be possible to get 1s update time with a plugin. I'd love more info on how to connect it to the website since I cannot quite understand how to do it based on what @CounterPillow said. Making it an official feature would boost overviewer quite a lot i think.

enaut commented 5 years ago

But this feature would probably need changes in the server. So it can only be done as a combination of server plugin + very small change of overviewer. Write the plugin for the server and then add two lines of code to the overviewer. If your plugin gets stable enough some hint can be added to the documentation of overviewer. But this is really something beyond the scope of overviewer (which renders offline maps).

posicat commented 4 years ago

I'd love to help, but I don't know enough about Minecraft modding. It seems like from the Overviewer perspective there would just need to be a JSON data block with the player data in it, and a tiny bit of Javascript to overlay that on the map (which I think is how signs are already generated) From the Minecraft perspective it's just looping through the active player data and extracting that JSON structure and writing it to disk every x seconds.

CounterPillow commented 4 years ago

From the Minecraft perspective it's just looping through the active player data and extracting that JSON structure and writing it to disk every x seconds.

Please don't actually write to disk, you can just expose the data on an as-needed basis via a tiny HTTP server or a web socket server

ArchmageInc commented 4 years ago

Just because I came across this and wanted a solution which didn't require a modded server:

https://github.com/ArchmageInc/minecraft-player-locations

ghost commented 4 years ago

We've released a Leaflet-compatible add-on based on the official add-on. It's still under development, but I'm sure it will live up to your expectations.

ss

You can check it out at https://www.spigotmc.org/resources/overviewer-location-sync.83685/

Rustypredator commented 3 years ago

My suggestion is this: Have the plugin create a web socket server which streams player data. Then, using custom web assets that only override index.html, change it so that it loads the clientside script that does connect to the web socket server by registering a callback to overviewer.util.ready.

Inside the clientside script you mostly need to yoink data out of the web socket server and then add/change leaflet markers as needed.

So, since the plugin @kou0179 posted is not available any more i created my own plugin using @CounterPillow 's suggestions.
The Plugin creates a websocket on the server it runs on and exposes the players location, name, uuid, world and health in a json format. I modified @ArchmageInc 's client.js script to allow for multiple backend servers which are selected based upon which map you are viewing. Of course, the plugin is in very early development but it runs stable as far as i can tell.
If someone has a bigger server, please contact me so the plugin can be tested better.

https://gitlab.com/hunters-tavern/playerposwebsockets

domialex commented 3 years ago

I made an API that connects through RCON and simply queries the coordinates, dimensions and inventory of all the players on the server. So this works on vanilla Minecraft. Then I modified the overviewer js to simply query that API, added some features such as inventory viewer and such. So a player will only appear if he has at least logged in once. The API knows who is online and it refreshes every minute by default : (player name blurred)

image

image

It's not 100% finished as I couldn't quite make leaflet handle different dimensions. I haven't touched the code in a while, but if people really want the feature I could update my code and make my repos public.

wolcano commented 3 years ago

It's not 100% finished as I couldn't quite make leaflet handle different dimensions. I haven't touched the code in a while, but if people really want the feature I could update my code and make my repos public.

please do make it public

domialex commented 3 years ago

@wolcano Here's the first version:

https://github.com/domialex/Minecraft-Monitor

v1nc commented 3 years ago

@wolcano Here's the first version:

https://github.com/domialex/Minecraft-Monitor

Is there a reason to not modify the overviewer js to directly fetch player positions via RCON? I want to avoid running another API.

CounterPillow commented 3 years ago

@v1nc

do you really want any person accessing your overviewer map to directly send your server rcon commands?

domialex commented 3 years ago

@wolcano Here's the first version: https://github.com/domialex/Minecraft-Monitor

Is there a reason to not modify the overviewer js to directly fetch player positions via RCON? I want to avoid running another API.

If the js has access to the RCON credentials, anyone could see it. This information needs to be fetched server-side and then accessible somewhere. Theoretically someone should be able to code this into overviewer.

In my case I just wanted to wrap overviewer in a program that could do it all, ex : download and run overviewer automatically. (not done yet)

jobe1986 commented 3 years ago

The best way to do it would be to have a PHP or similar script generate JSON server side, and have the JS request that. However its also worth noting that without modifications/plugins there are no rcon commands to query a players location. Therefore there is no single one size fits all solution. However a custom PHP script could read the player .dat files to retrieve the player positions but that wouldn't be 100% live as they only get updated every time the server saves them.

joe-mojo commented 3 years ago

Because Minecraft-Overviewer is written in Python (generator) and html/css/js (maps), I suggest that any needed backend should run using Python or Javascript (node.js). That way, it would be more comfortable for maintainers.

Le mer. 14 juil. 2021 à 16:42, Matthew Beeching @.***> a écrit :

The best way to do it would be to have a PHP or similar script generate JSON server side, and have the JS request that. However its also worth noting that without modifications/plugins there are no rcon commands to query a players location. Therefore there is no single one size fits all solution. However a custom PHP script could read the player .dat files to retrieve the player positions but that wouldn't be 100% live as they only get updated every time the server saves them.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/overviewer/Minecraft-Overviewer/issues/1589#issuecomment-879952774, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA25GQDCBDC3CIGTSGIR3HLTXWO4JANCNFSM4H2XLHVQ .

domialex commented 3 years ago

The best way to do it would be to have a PHP or similar script generate JSON server side, and have the JS request that. However its also worth noting that without modifications/plugins there are no rcon commands to query a players location. Therefore there is no single one size fits all solution. However a custom PHP script could read the player .dat files to retrieve the player positions but that wouldn't be 100% live as they only get updated every time the server saves them.

You can query player positions and inventories through RCON, that's what my program does actually 😁.

v1nc commented 3 years ago

@v1nc

do you really want any person accessing your overviewer map to directly send your server rcon commands?

Dont hardcode rcon credentials(obviously?). I also have access controls for the overviewer website.

User could also be asked for RCON credentials and they get stored as cookies or similar. Sure my use case is a semi private server with little users, but I dont see a reason to publicly host another service just for player coordinates.

CounterPillow commented 3 years ago

@v1nc then you still have the issue that your web browser will not let you connect to arbitrary ports of non-websocket services because that's a security risk.

You need a service to mediate.

v1nc commented 3 years ago

@v1nc then you still have the issue that your web browser will not let you connect to arbitrary ports of non-websocket services because that's a security risk.

You need a service to mediate.

Ah yeah, that is what my first question was about, didnt check out RCON protocol yet, thanks for your answer :)

ArchmageInc commented 3 years ago

My experiments with RCON were most successful using Python as the Node library for Minecraft's RCON implementation had some severe limitations. It is also terribly inefficient for the server. At the same time, because RCON is still going to use Minecraft commands, maintaining it from version to version was worse than maintaining a Bukkit / Spigot plugin. I've all but abandoned trying to use RCON even though that seems to be the only current way to do this with Vanilla Minecraft.

Because of the various iterations of using Node, Python, Java, whatever is next, I have split out the Overviewer plugin portion and the back-end.

The front-end project is now Overviewer-Info-Plugin This injects itself a bit more gracefully into Overviewer and Leaflet, while allowing easier extendability.

and the Plugin back-end project is PlayerLocations