Page 1 of 1

Need help to make my mod fit for multiplayer

Posted: Wed Jul 06, 2016 4:02 pm
by Bizz Keryear
mod here: https://mods.factorio.com/mods/Bizz_Ker ... prove_Move
mod homepage here: viewtopic.php?f=97&t=28279
source code of control.lua here: http://pastebin.com/DX5GGqhM (think that is easier to manage there)
default-config.lua
Doubt it will work in multiplayer ... though I can't tell what I exactly doing wrong ... I also do not have a method to even text it in multiplayer. (no friends and no second copy either)

edit : moved data.lua to new post to clean this up a little

Re: Need help to make my mod fit for multiplayer

Posted: Wed Jul 06, 2016 4:26 pm
by Bizz Keryear
data.lua

Re: Need help to make my mod fit for multiplayer

Posted: Wed Jul 06, 2016 4:34 pm
by DedlySpyder
At a glance: redo everything. Not declaring variables with local (local player =....) means that there will be issues, either desyncs or they'll share data (both would be bad). You'll probably need either a bunch of global tables, or one with each player having an entry.


Also, I never took into account if other mods want to change the character running modifier in my mod (I couldn't find where you modify it), but something I was going to do for compatibility was to save the modifier before changing it, then change it back instead of just setting it to 0.


For testing Multiplayer, download a zip copy from the main website and locally host one of them (need to change the port in the config)

Re: Need help to make my mod fit for multiplayer

Posted: Wed Jul 06, 2016 10:22 pm
by Bizz Keryear
DedlySpyder wrote:At a glance: redo everything. Not declaring variables with local (local player =....) means that there will be issues, either desyncs or they'll share data (both would be bad). You'll probably need either a bunch of global tables, or one with each player having an entry.


Also, I never took into account if other mods want to change the character running modifier in my mod (I couldn't find where you modify it), but something I was going to do for compatibility was to save the modifier before changing it, then change it back instead of just setting it to 0.


For testing Multiplayer, download a zip copy from the main website and locally host one of them (need to change the port in the config)
It is changed in line 189 (actual calculation ... last step anyway) and 190 where is it set you.character_running_speed_modifier = final ... I know two other mods that change that value one is progressive running .. which dynamically change it ... would anyway collide with my mod in any way, the other is your turtle speed ... which also would in any way collide with my mod stored values or not.

Think of it this way: First my hotkey is pressed (at that point modifier is 1 = default), then yours ... then my deactivates and restores it to 1 . also my mod checks the ground every tick and might change the value when the ground changes.

The only thing that is compatible is any that adds items for power armor (mean anything with a grid) and my mod isn't touching any of it.

Oh, while at it made some changes to you code ... some because of a bug which seems to was in your code... some because I think it is better to have the output not as number of modifiers .. but as value, cause a other mod could adds items for power armor with different values...

Might have a look at your code again to find out how to make it better for multiplayer ... your code (aside from occasional bugs ... way less than I do) looks pretty solid. It was way to elegant to not use it.

The only way to make it compatible to any other mod that change .character_running_speed_modifier is to detect that mod and remove manually what they are doing ... what is a pain and I'm not doing ...I declare them incompatible.

Re: Need help to make my mod fit for multiplayer

Posted: Thu Jul 07, 2016 2:37 pm
by DedlySpyder
Ya I was talking more for if there is a mod that adds a static (or changed infrequently) modifier.

As for the bug with no armor I fixed that. And I was just aiming for a small little mod to help a little, not trying to figure out exactly how much to offset the player speed.

Re: Need help to make my mod fit for multiplayer

Posted: Thu Jul 07, 2016 9:57 pm
by Bizz Keryear
DedlySpyder wrote:Ya I was talking more for if there is a mod that adds a static (or changed infrequently) modifier.

As for the bug with no armor I fixed that. And I was just aiming for a small little mod to help a little, not trying to figure out exactly how much to offset the player speed.
That is not my problem, though .... first I will change my mod a little further ... add in all the functionality I want ... then I will try to have a look again on local, global, and how I set everything ...though if I find someone who just hops with me on a TS ... with us both only my mod installed on same map ... just to if my mod works (for reasons) or if it fails miserably ... would be great

Re: Need help to make my mod fit for multiplayer

Posted: Fri Jul 08, 2016 2:37 pm
by DedlySpyder
I mentioned earlier, just download a zip version and you can test Multiplayer yourself. Though, I'd be surprised if the game doesn't desync as soon as you start using the mod