Jump to content

I'm not a modder, but I'd like a server-side map/minimap mod


Recommended Posts

If anyone reading this has the know-how to do it, I'd like a server-side map/minimap mod that will reveal locations that anyone in the server has visited to everyone.

 

i.e. if one player visits a location, it'll be revealed for every player on that server.

Link to comment
Share on other sites

@Chesska, This is basically the holy grail of modding at this point. If anyone knew how to do it, it would've been done (probably several times over with an intense battle for Workshop supremacy).

 

That being said, I'll look into adding something in that direction to Global Positions, but the best that can be done right now is that the minimap will be revealed by other players moving in the world, but that minimap revealed this way will not be saved on exit/reload.

Edited by rezecib
Link to comment
Share on other sites

@Chesska, This is basically the holy grail of modding at this point. If anyone knew how to do it, it would've been done (probably several times over with an intense battle for Workshop supremacy).

 

That being said, I'll look into adding something in that direction to Global Positions, but the best that can be done right now is that the minimap will be revealed by other players moving in the world, but that minimap revealed this way will not be saved on exit/reload.

 

Couldn't you use addclasspostconstruct and modify the map screen so that the map functions effect all of the players instead of simply the local player?

 

So that things like self.minimap:UpdateTexture() will actually update for everyone, since self.minimap uses the minimap widget based on whoever the local player is.

 

I may be failing to understand the actual roadblock to implementation here. I haven't quite grasped all of the technical changes that came with DST.

Link to comment
Share on other sites

@debugman18, it the changes are only local to the client, then it would need to be transmitted to the server and across to all clients. This would eat up significant amounts of bandwidth when you have a large number of players active at the same time.

 

I haven't looked into it, but I think this was one of the draw backs. 

Link to comment
Share on other sites

@debugman18, Yeah, as Kzisor said, the minimap occurs entirely locally, so there actually isn't any map data being networked. So each client has their own texture being managed by the C++ code. The fact that practically everything for the map happens in the C++ code is the real roadblock, although I can understand it would be a huge performance hit to manage it with Lua.

 

I did just add some rudimentary map sharing to Global Positions, by calling TheWorld.minimap.MiniMap:ShowArea on the player positions that I network with the mod, but unfortunately there seems to be no way to get that information to be saved/loaded, so it all gets lost after a reload. As far as I can tell, the minimap exploration that does get saved/loaded only occurs around the player, when the player has EnablePlayerMinimapUpdate(true). Aside from teleporting the player around (it doesn't seem to work to just do teleport calls back to back), I don't think it can be done right now.

 

So... basically all we need for fully functional map sharing are a few more MiniMapLuaProxy functions. Maybe another version of ShowArea that actually gets saved (or add a boolean argument to it), as well as some way to serialize and load from serialized map data so that when players enter/leave you can send the map progress they currently have (or just the master host copy of all map progress that has occurred).

Edited by rezecib
Link to comment
Share on other sites

This is actually what's driven my first stab into modding DS/DST. I've been playing around with a rudimentary implementation using MiniMap:ShowArea() as @rezecib has... and it functions, but with a number of sizable caveats.

I did run into a few other mods that use some interesting methods that may provide hacks/work-arounds for the time being... One in particular made to enable a larger FOV seems to provide it's own cache for (normalized) coordinates revealed by the mod's functionality, then loop through the cache and re-reveal them as needed. In this manner, the mod can save/load and reproduce custom minimap reveals... Depending on the intended function, this could still require sizable networking traffic for providing new players with the data - but normalizing them at least provides a throttle for the quantity of coordinate vectors needed to reproduce a revealed area.

Comments in the scripts indicate that they intend to move all player's minimap caches to the server in the future, which I would imagine should facilitate the feature with much less work, even in the absence of a better minimap API.

Link to comment
Share on other sites

@KuroTsuto, Yeah, I saw those comments, but I'm kind of doubting at this point that they will actually do that. It would cause a lot of problems.

 

Interesting idea about caching the revealed area... although grouping and removing near-duplicate revealed areas is not trivial, so if you're not doing that then the amount of data being saved and sent will get very large very fast. I suppose you could use a clustering algorithm if you're okay with having some error in what map actually gets revealed. For avoiding a spike of network activity when a player joins (and gets sent the entirety of shared minimap progress), you could put it into a DoPeriodicTask and send only a certain number of points per execution.

 

...but I think it'd probably be better to wait for devs to implement the few small things we need for this on the C++ end. Assuming they do plan on doing something like that... Which would be very nice to know.

Link to comment
Share on other sites

I noticed in my server playing with my friend that Global Positions updated and now I can see bits of the map that he reveals.   Did something magical happen here?
 

 

I did just add some rudimentary map sharing to Global Positions, by calling TheWorld.minimap.MiniMap:ShowArea on the player positions that I network with the mod, but unfortunately there seems to be no way to get that information to be saved/loaded, so it all gets lost after a reload. As far as I can tell, the minimap exploration that does get saved/loaded only occurs around the player, when the player has EnablePlayerMinimapUpdate(true). Aside from teleporting the player around (it doesn't seem to work to just do teleport calls back to back), I don't think it can be done right now.

 

The reason I didn't do it before is because I really dislike the downsides of the method (not getting saved). But... I reconsidered, and it's better than nothing. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...