Hi,
I recently received a request on my mod page to make it multiplayer compatible. However, I have no way to bugtest my code changes as I have no friends (sad but true). I'm looking for anyone who might be willing to join a server with me for the sole purpose of bugtesting. This will probably mean continuously rejoining a server that I repeatedly desync due to my ineptitude, but comes with the satisfaction of helping make a mod that you probably have no interest in better for a couple of people who might want to use it. Please, try and contain your excitement.
We can optionally voicechat and virtual refreshments will be provided.
Here is the mod in case you are interested: https://mods.factorio.com/mods/silentcrim/ammo-loader
Modding MP Bugtesting
-
- Burner Inserter
- Posts: 17
- Joined: Sun Apr 09, 2017 10:56 pm
- Contact:
Re: Modding MP Bugtesting
You can run multiple copies of Factorio simultaneously
Head on over to factorio.com, download the .zip version. Extract it somewhere. Symlink your main mods folder to the folder you extracted the .zip too.
Start a new game on original factorio, uncheck verify user, uncheck public. In factorio #2 either use the lan browser or connect directly to 127.0.0.1 or localhost
This will probably be a lot easier
As to desyncs they are easy to figure out..... Don't use local variables if you need it to survive outside of the current tick.
Head on over to factorio.com, download the .zip version. Extract it somewhere. Symlink your main mods folder to the folder you extracted the .zip too.
Start a new game on original factorio, uncheck verify user, uncheck public. In factorio #2 either use the lan browser or connect directly to 127.0.0.1 or localhost
This will probably be a lot easier

As to desyncs they are easy to figure out..... Don't use local variables if you need it to survive outside of the current tick.
Re: Modding MP Bugtesting
turrets = {}
cars = {}
chests = {}
ammo_inventories = {}
inventory_entities = {}
fuel_entities = {}
last_cycle_tick = 0
last_find_item_tick = 0
chest_cycler = {}
ent_count = 0
created_tick = -1
do_update = false
created_wait = 5
In other words, probably all of those need to be saved into the variable called "global" which you set up in on_init
cars = {}
chests = {}
ammo_inventories = {}
inventory_entities = {}
fuel_entities = {}
last_cycle_tick = 0
last_find_item_tick = 0
chest_cycler = {}
ent_count = 0
created_tick = -1
do_update = false
created_wait = 5
In other words, probably all of those need to be saved into the variable called "global" which you set up in on_init
-
- Burner Inserter
- Posts: 17
- Joined: Sun Apr 09, 2017 10:56 pm
- Contact:
Re: Modding MP Bugtesting
Wow.
Thanks a lot, that will be way easier
. I've run multiple clients before while modding but it never even occurred to me that I could MP between them. This will make the whole process a lot faster.
Thanks for the advice as well. I have tons of local variables because my experience in other languages gave me the preconception that global variables should be avoided whenever possible. That'll be a great place to start.
Thanks a lot, that will be way easier

Thanks for the advice as well. I have tons of local variables because my experience in other languages gave me the preconception that global variables should be avoided whenever possible. That'll be a great place to start.
Re: Modding MP Bugtesting
You can save multiplayer game and you are not the player#1 anymore. It's good for multiplayer code testing.
Re: Modding MP Bugtesting
This is still trueSilentCrim wrote:n that global variables should be avoided whenever possible. That'll be a great place to start.

However all your variables at the top are still global in scope, they are just not saved to the map. When client 2 joins all of those variables in his client are set to their defaults which may not match what your scripts have, resulting in desyncs during events (each client is doing its own thing when it needs to do the same thing) To save a variable that is persitent/saves with the map use the special global variable called "global" which if you wanted could you could reference that with a local variable in on_init/on_load
Not all variables need to be saved in global just ones that will get modified (for the most part)