Jump to content

Suggestion for developers about Shard configuration and Player migration


Recommended Posts

I looked through game scripts and found in component worldmigrator single line that would allow to create mod for automatic dynamic shard connection configuration.

If in function WorldMigrator:Activate(doer) at line:
TheWorld:PushEvent("ms_playerdespawnandmigrate", { player = doer, portalid = self.id, worldid = self.linkedWorld })

Each portal is on init set by function WorldMigrator:SetId() which sets id and receivedPortal to same value. But every portal is staticly linked to portal of same id in other shards because of "portalid = self.id". If it would be "portalid = self.receivedPortal", it would be possible to dynamicly set recieving portal and portals with different ids in other worlds could be connected.

Changing this shouldn't change default behaviour because in WorldMigrator:SetId() is "id" and "receivedPortal" set to same value, so without the mod the same value will be used.

By changing this it would also by possible to make a mod that calls WorldMigrator:SetReceivedPortal for each portal, making connection between shards. I'm already making this mod and this is (most likely) the only thing blocking me from finishing it.

Changing this would also call for renaming of "receivedPortal" to "linkedportal" because it wouldn't just mean from what portal is this portal recieving but also where this portal is sending players. But that is not needed and maybe not even possible because of backwards compatibility and/or mod compatibility.

This change should be done in code of DST dedicated servers (normal game to my knowledge doesn't support more than one shard).

The mod will parse config file and use standart 10 portals for connection to other shards. 1 frame after simulation is resumed it would set recievingportal and linkedworld for first N portals and turn off/delete other portals.

I would be very happy if developers at least commented if it isn't possible and thrilled if it was implemented.

Link to comment
Share on other sites

Nevermind, it seems that portalid send by event ms_playerdespawnandmigrate means source portal, not destination portal and destination portal is then gotten from self.receivedPortal somewhere in game core. Problem was in my mod, now it works.

Link to comment
Share on other sites

This sounds very interesting! I've downloaded the mod, had a look at the configuration.

If I want to configure 3 shards only using the modoverride.lua file, would the `Connections`
option look the same for every shard, or do I need to change the IDs in some way?

Link to comment
Share on other sites

Okay, spinning this a bit further. If it's possible for the mod, to use the shard_id of the settings.ini file foreach shard, would it be possible to configure the `connections` only once in the master? This means, you wouldn't need to configure the connections for every shard.

Link to comment
Share on other sites

This sounds very interesting! I've downloaded the mod, had a look at the configuration.

If I want to configure 3 shards only using the modoverride.lua file, would the `Connections`

option look the same for every shard, or do I need to change the IDs in some way?

Yes. Each shard needs exactly the same Connections to properly connect shards. (not exactly true, they only need some of the connection matrix, but to avoid confusion I would suggest exactly the same Connections)

 

 

And, one suggestion. Would it be possible for the mod to use the configured shard_id instead of setting separate IDs in the mod configuration?

I tried that at first, but game API didn't allow me access to TheShard:GetShardId(). So unless you have some idea how to get shard_id we will have to stick to individual copy of shard_id in eveny config.

 

 

Okay, spinning this a bit further. If it's possible for the mod, to use the shard_id of the settings.ini file foreach shard, would it be possible to configure the `connections` only once in the master? This means, you wouldn't need to configure the connections for every shard.

That would need sending some messages between servers. I'm not that skilled with lua and i don't know if mods are allowed to send messages to other servers. Maybe creating some external config file and set path to that config file in configuration of this mod. But that would still be needed in modinfo.lua of this mod or in every modoverride.lua of every shard.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...