Alternative format for map exchange string

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply

Can you see yourself hand-editing the exchange string if it was human-readable?

Yes
5
50%
No
5
50%
 
Total votes: 10

hoho
Filter Inserter
Filter Inserter
Posts: 677
Joined: Sat Jan 18, 2014 11:23 am
Contact:

Alternative format for map exchange string

Post by hoho »

TL:DR - make the map exchange string to accept both base64 encoded thingy and a human-readable* Lua object representing the same data. That way it would be possible to see at a glance what settings were used in generation plus additionally people could hand-edit it if they wish (e.g change ore richness or peaceful mode on an otherwise nicely generated map).

*) to certain degree, of course. There is no reason to e.g represent richness as string value (e.g "very good") when a numeric value (e.g 5) works just fine.

For example it might look roughly like this. Here are lots of missing fields + comments wouldn't exist in the actual string. I'm not even sure if this would be a valid Lua object :D

Code: Select all

"map-exchange-string" = {
	-- version of the exchange string format
	version = "0.01"
	-- generated resource layer data
	ores =
	{
		{"copper", 1, 2, 3},
		{"stone", 2, 3, 4},
		{"iron", 2, 2, 2},
	},
	segmentation = 2,
	water = 3,
	peaceful = true,
	seed = "1234",
	-- 0 == infinite
	size = { 0, 0 },
}

___

Now the longer, mostly useless, stuff :).
I ran one exchange string through python decoder and this was the result:

Code: Select all

>>> import base64
>>> coded = '''AAAKAAAAGAADAw8AAAAEAAAAY29hbAEDAgoAAABjb3BwZXItb3JlAQMCCQAAAGNydWRlLW9pbAEDAgoAAABlbmVteS1iYXNlAwMCCQAAAGdlbXN0b25lcwMDAggAAABnb2xkLW9yZQMDAggAAABpcm9uLW9yZQEDAggAAABsZWFkLW9yZQMDAgUAAABtYWdtYQMDAgQAAABzYW5kAwMCCgAAAHNpbHZlci1vcmUDAwIFAAAAc3RvbmUBAwIHAAAAdGluLW9yZQMDAgwAAAB0dW5nc3Rlbi1vcmUDAwIIAAAAemluYy1vcmUDAwIkdHwlI1wAAG3CAAAAAAAAAAAAAAMAi4OyoA=='''
>>> base64.b64decode(coded)
'\x00\x00\n\x00\x00\x00\x18\x00\x03\x03\x0f\x00\x00\x00\x04\x00\x00\x00coal\x01\x03\x02\n\x00\x00\x00copper-ore\x01\x03\x02\t\x00\x00\x00crude-oil\x01\x03\x02\n\x00\x00\x00enemy-base\x03\x03\x02\t\x00\x00\x00gemstones\x03\x03\x02\x08\x00\x00\x00gold-ore\x03\x03\x02\x08\x00\x00\x00iron-ore\x01\x03\x02\x08\x00\x00\x00lead-ore\x03\x03\x02\x05\x00\x00\x00magma\x03\x03\x02\x04\x00\x00\x00sand\x03\x03\x02\n\x00\x00\x00silver-ore\x03\x03\x02\x05\x00\x00\x00stone\x01\x03\x02\x07\x00\x00\x00tin-ore\x03\x03\x02\x0c\x00\x00\x00tungsten-ore\x03\x03\x02\x08\x00\x00\x00zinc-ore\x03\x03\x02$t|%#\\\x00\x00m\xc2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x8b\x83\xb2\xa0'
>>>
I have a bunch of mods so that's why there are all sorts of extra ores there :)


The format doesn't seem to be too complex. I managed to decode that for each ore layer frequency, size and richness is encoded in a single byte. There are extra 4 bytes of information per-ore (possibly one of them being newline).

For example (not from the long example I gave):
copper-ore \x03\x02\x01\t\x00\x00\x00
That means copper ore will be with frequency 3 (normal), size 2 (small) and richness of 1 (poor)

I have no idea what the rest of the data means and probably won't try to figure it out.



___

Analyzing the string I found that surprisingly frequency/size/richness were mapped 1:1 to GUI values. I would have expected that internally they are some specific values on a much greater scale. E.g richness could vary between 0-100% with the GUI options being 20% steps within that scale. It would be somewhat nice if such fine-tuning of those parameters was possible through the exchange string (or even built into the GUI itself with sliders).

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Alternative format for map exchange string

Post by ssilk »

I said no. The reason is, that is makes sense to have the string as short as possible and it can be proprietary.

I see a sense to have some functions inside Factorio/Lua/Console, which take the string and returns exactly what you want (and vice versa).
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

sillyfly
Smart Inserter
Smart Inserter
Posts: 1099
Joined: Sun May 04, 2014 11:29 am
Contact:

Re: Alternative format for map exchange string

Post by sillyfly »

How about allowing the map setting screen to load settings from the exchange string? Then you can use the same UI to edit whatever parameters you wish (Although changing the seed would be somewhat against the point :P )

hoho
Filter Inserter
Filter Inserter
Posts: 677
Joined: Sat Jan 18, 2014 11:23 am
Contact:

Re: Alternative format for map exchange string

Post by hoho »

Both of those options you two gave are great and would achieve most of what I proposed. Being able to directly load options from the string and be able to alter them would be awesome and even better than what I suggested :)

Post Reply

Return to “Ideas and Suggestions”