[Rseding91] [0.16.20] Cannot connect to server: Mod settings mismatch

This subforum contains all the issues which we already resolved.
Post Reply
Mylon
Filter Inserter
Filter Inserter
Posts: 368
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

[Rseding91] [0.16.20] Cannot connect to server: Mod settings mismatch

Post by Mylon » Wed Jan 31, 2018 8:36 pm

I'm trying to configure a server with some mods and it won't let me connect.

I created a save file using a scenario (but I forgot to turn on Bobs Inserters during this step)
I uploaded the save file to the server
I tried to connect: got error mods mismatch, bobs inserters on server)
I enabled that mod
I tried to connect: Mod startup settings mismatch.
I clicked yes to sync settings and restarted the game.
I tried to connect: Mod startup settings mismatch.

I do not recall changing any of the mod settings locally and the server should be running with everything on default settings.

I don't know if the Bobs Inserters bit is relevant.

Attached is the save file. The mod pack I'm using is here: https://www.dropbox.com/s/s2x3kaql5v7dt ... 0.zip?dl=0
Attachments
factoriorpg61-modded.zip
(2.19 MiB) Downloaded 28 times

Rseding91
Factorio Staff
Factorio Staff
Posts: 9453
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.16.20] Cannot connect to server: Mod settings mismatch

Post by Rseding91 » Wed Jan 31, 2018 10:49 pm

Thanks for the report. I found the problem but don't currently have a fix I like.

The problem is JSON doesn't support saving numbers in hex format so saving 0.299999999999999 as a string ends up saving 0.3 and then when loaded back into binary format it's 0.3000000000021 and you get different numbers.

Right now there are 2 options proposed:
  • Change the mod-settings.json file to mod-settings.dat and it will write the settings in binary format
  • Update to JSON 5 which theoretically supports hex formats for numbers which means we could save floats correctly
If you want to get ahold of me I'm almost always on Discord.

kovarex
Factorio Staff
Factorio Staff
Posts: 7387
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [Rseding91] [0.16.20] Cannot connect to server: Mod settings mismatch

Post by kovarex » Thu Feb 01, 2018 3:08 am

That is weird, because we had similar problems when saving numbers in lua state, and as far as I remember, we solved it without using hexes for numbers.

posila
Factorio Staff
Factorio Staff
Posts: 3645
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [Rseding91] [0.16.20] Cannot connect to server: Mod settings mismatch

Post by posila » Thu Feb 01, 2018 1:58 pm

kovarex wrote:That is weird, because we had similar problems when saving numbers in lua state, and as far as I remember, we solved it without using hexes for numbers.
In the end, we did solve it by serializing numbers in lua state in hex format

gheift
Fast Inserter
Fast Inserter
Posts: 184
Joined: Tue Mar 03, 2015 9:20 pm
Contact:

Re: [Rseding91] [0.16.20] Cannot connect to server: Mod settings mismatch

Post by gheift » Thu Feb 01, 2018 3:24 pm

If you use code like this, there shouldn't be any rounding errors:

Code: Select all

#include <float.h>

fprintf(file, "%.*lg", DBL_DIG, v);
See also man float.h, search for DBL_DIG.

Rseding91
Factorio Staff
Factorio Staff
Posts: 9453
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [Rseding91] [0.16.20] Cannot connect to server: Mod settings mismatch

Post by Rseding91 » Thu Feb 01, 2018 11:28 pm

Ok, I found the underlying problem and it should be fixed for the next version of 0.16.

At least testing with the files you provided works correctly now.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Resolved Problems and Bugs”

Who is online

Users browsing this forum: No registered users