[1.193.103] optimal spawn distance puts players close to enemy players also
for months now we have problems on our servers where players just abuse the respawn ships in space to find player locations pretty easily. I played the decompiling game and tried to figure out how the respawn mechanic works. And apparently it is only supposed to drop you off next to friendly players.
However this is not the case.
In MySpaceRespawnComponent.GetFriendlyPlayerPositions it first loops over all identities that have a character. (which hopefully is false for offline players)
And then executes
MyRelationsBetweenPlayerAndBlock relationPlayerBlock = MyIDModule.GetRelationPlayerBlock(component.Owner, identityId, MyOwnershipShareModeEnum.Faction, MyRelationsBetweenPlayerAndBlock.Neutral, MyRelationsBetweenFactions.Neutral, MyRelationsBetweenPlayerAndBlock.FactionShare);As reminder the whole Methods signature is supposed to be:
public static MyRelationsBetweenPlayerAndBlock GetRelationPlayerBlock( long owner, long user, MyOwnershipShareModeEnum share = MyOwnershipShareModeEnum.None, MyRelationsBetweenPlayerAndBlock noFactionResult = MyRelationsBetweenPlayerAndBlock.Enemies, MyRelationsBetweenFactions defaultFactionRelations = MyRelationsBetweenFactions.Enemies, MyRelationsBetweenPlayerAndBlock defaultShareWithAllRelations = MyRelationsBetweenPlayerAndBlock.FactionShare)The whole ownership code is pretty confusing but as far as I can tell. the relations of two players without faction and one player with faction and the other without faction are always considered to be neutral.
And it appears like the passed through "default" of "neutral" is passed through the whole configuration which with reputation and economy stuff can cause factions to be considered neutral even though they are enemies.
Due to its complexity I havent fully managed to understand what the code does. So I may be wrong here, but so far my it matches the observations from our players, that they are able to randomly spawn close to any player.
The method seems to havor friendly players over neutral ones. But in my opinion it should not consider neutral players at all. Just because they have a good reputation in economy or may be allied in any way is not a good enough reason to spawn close to them.
And since optimal spawn distance cannot be turned off (see https://support.keenswh.com/spaceengineers/general/topic/1-193-103-optimal-spawn-distance-cannot-be-disabled-despite-the-ui-suggesting-that) We had to resort setting it to a very high value. effektively making the whole feature useless.