Exchanging maps

Suggestions that have been added to the game.

Moderator: ickputzdirwech

User avatar
Nova
Filter Inserter
Filter Inserter
Posts: 958
Joined: Mon Mar 04, 2013 12:13 am
Contact:

Exchanging maps

Post by Nova »

How about a special code, which stores every configuration of a map and the random seed? This would make exchanging maps much easier, because you did not have to download a map.
Just for information: (Base64 can encode binary values and doesn't need much space. (Czech) (English))
Greetings, Nova.
Factorio is one of the greatest games I ever played, with one of the best developers I ever heard of.

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

Re: Exchanging maps

Post by kovarex »

Hello, we had small discussion about this few days ago.
The string would specify all map settings (resource/terrain/enemy settings, seed etc).
You could copy paste it. This way we could for example do challenge to finish freeplay of some specific map by just posting the code on forums.

User avatar
Nova
Filter Inserter
Filter Inserter
Posts: 958
Joined: Mon Mar 04, 2013 12:13 am
Contact:

Re: Exchanging maps

Post by Nova »

kovarex wrote:This way we could for example do challenge to finish freeplay of some specific map by just posting the code on forums.
That was exactly what I was thinking. I didn't mention it because i thought: "Well, that's already now possible, just not as easy." ^^
Greetings, Nova.
Factorio is one of the greatest games I ever played, with one of the best developers I ever heard of.

Dakkanor
Fast Inserter
Fast Inserter
Posts: 243
Joined: Wed Feb 27, 2013 6:18 am
Contact:

Re: Exchanging maps

Post by Dakkanor »

connected to this, could there be an option to remember previous freeplay settings? there are certian setups that i pretty much use exclusively, and while its not a big thing i could save a little hassel while making a map(or re making it as i forgot one setting or another and it bothers me into restarting)

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

Re: Exchanging maps

Post by ssilk »

Distinct between setup and seed. The setup defines the parameters (ores etc). The seed is the "starting" point of the pseudo-random-algorithm. Together they built the map. Both can explained in one big number but I would prefer to have that distincted in some way. I would say one json-string, which includes both numbers, the game version and other stuff, would be useful and is human readable. But thats my view as web-developer. :)

The string is shown in the map-generator requester and can be inputed or copied into the buffer.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: Exchanging maps

Post by rk84 »

Dakkanor wrote:connected to this, could there be an option to remember previous freeplay settings? there are certian setups that i pretty much use exclusively, and while its not a big thing i could save a little hassel while making a map(or re making it as i forgot one setting or another and it bothers me into restarting)
I tried workaround for this, but failed. I though loading and restarting old game would have give new map with old settings.
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela

User avatar
cube
Former Staff
Former Staff
Posts: 1111
Joined: Tue Mar 05, 2013 8:14 pm
Contact:

Re: Exchanging maps

Post by cube »

Hey, thanks for reminding me of this!
When we were talking about this, a few questions popped up, so I'd like to hear your opinions about these things:
1) How long do you think would be maximal usable length of the code? (This is basically for practicality, copypasting around forum and stuff like that)
2) What about mods? Do you think that the code should also contain a list of active mods, or is ti OK to work differently if different mods are active?
3) If the code specifies a list of active mods, is it ok to just tell you that you have incorrect mod setup, or should it show what to change? (the first version would shorten the code considerably)

I thought the maximal practical limit was about 40 characters (thats 30 bytes in base64) and that a complete list of mods would be necessary, which wouldn't fit into 30 bytes for most setups. Compression (I was thinking zlib) probably wouldn't help for such short strings....
I have no idea what I'm talking about.

Dakkanor
Fast Inserter
Fast Inserter
Posts: 243
Joined: Wed Feb 27, 2013 6:18 am
Contact:

Re: Exchanging maps

Post by Dakkanor »

cube wrote:Hey, thanks for reminding me of this!
When we were talking about this, a few questions popped up, so I'd like to hear your opinions about these things:
1) How long do you think would be maximal usable length of the code? (This is basically for practicality, copypasting around forum and stuff like that)
2) What about mods? Do you think that the code should also contain a list of active mods, or is ti OK to work differently if different mods are active?
3) If the code specifies a list of active mods, is it ok to just tell you that you have incorrect mod setup, or should it show what to change? (the first version would shorten the code considerably)

I thought the maximal practical limit was about 40 characters (thats 30 bytes in base64) and that a complete list of mods would be necessary, which wouldn't fit into 30 bytes for most setups. Compression (I was thinking zlib) probably wouldn't help for such short strings....

1) if you include a "copy code to clipboard" button then the code length is probably irrelevent, so i would say just try to make it efficient and functional first.

2) i would think that trying to make it fully functional before adding mod support(or just making it while leaving space for mod support) first would be preferable. i don't use mods on this myself so i'm not particularily fussed but there would be some who might prefer to have mod names+versions in short from as a list after the code.

3)if a list of mods is provided with the map code then just a notice saying that you don't have all the right mods should be more than sufficent




just my 2 cents, we really appreciate that you guys even consider this stuff

User avatar
Nova
Filter Inserter
Filter Inserter
Posts: 958
Joined: Mon Mar 04, 2013 12:13 am
Contact:

Re: Exchanging maps

Post by Nova »

Many mods don't change anything on the world generation. There is no need to store this mods in the code.
The total lenght has not to be consistend. More mods = longer code.


Here is a fast example. It can be reduced much in size with constant values for special names like "frequency" or just no code at all: The first value of every object in "startup" would be the frequency or whatever... Compressing the value at the end would be possible, too. (gzip or every other free compressing algorithm.)
One line break after 80 character of the code.

Code: Select all

factorio seed and startup code // Constant starting value to explain if someone tries to decode
seed: 562cef884f1155870a93ab60800f5a8a
startup:
- Dirt:
-- Frequenzy: normal
-- Size: medium
- enemy bases:
-- Frequenzy: normal
-- Size: medium
-- Richness: regular
// ...
needed mods:
- Industrio:
-- Version: 1.2.3
-- // some other things...

Code: Select all

ZmFjdG9yaW8gc2VlZCBhbmQgc3RhcnR1cCBjb2RlIC8vIENvbnN0YW50IHN0YXJ0aW5nIHZhbHVlIHRv
IGV4cGxhaW4gaWYgc29tZW9uZSB0cmllcyB0byBkZWNvZGUNCnNlZWQ6IDU2MmNlZjg4NGYxMTU1ODcw
YTkzYWI2MDgwMGY1YThhDQpzdGFydHVwOg0KLSBEaXJ0Og0KLS0gRnJlcXVlbnp5OiBub3JtYWwNCi0t
IFNpemU6IG1lZGl1bQ0KLSBlbmVteSBiYXNlczoNCi0tIEZyZXF1ZW56eTogbm9ybWFsDQotLSBTaXpl
OiBtZWRpdW0NCi0tIFJpY2huZXNzOiByZWd1bGFyDQovLyAuLi4NCm5lZWRlZCBtb2RzOg0KLSBJbmR1
c3RyaW86DQotLSBWZXJzaW9uOiAxLjIuMw0KLS0gLy8gc29tZSBvdGhlciB0aGluZ3MuLi4=
It would be no problem to copy this code into web messengers like skype, or in the forum.
Greetings, Nova.
Factorio is one of the greatest games I ever played, with one of the best developers I ever heard of.

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

Re: Exchanging mapsu

Post by ssilk »

1) already answered: not relevant nowadays. I would say some lines, where the begin and end should be very clear, like PGP signature. See here http://aktuell.de.selfhtml.org/artikel/ ... /signatur/
This "brackets" is also often used for games-codes or other software licenses because it makes copy/paste much easier and shows clearly, that the following is

Inside of that begin/end-bracket, the stuff can be text, like in Novas example or base64. I would prefer human readable, and that means - for me no question - Json. http://en.wikipedia.org/wiki/JSON

2) I would handle the mods extra. So we have the seed, the setup and the mods.

3) maybe it depends on the mods. I would let this way open and currently won't implement nothing more than absolutely needed to repeat a game. Later there could be more information about.

40 chars per line is ok. More than 70 are a problem.
Compression: yes if not much afford.
But I would also enable a clear text format. The format itself should also have a version, so that you can change it into future and be able to read the old format.

I mean it can look like so:

Code: Select all

-----BEGIN FACTORIO EXCHANGE MAP V1.0-----
{
  "Version": "0.7.5",
  "Seed": {
     "Value": "afu71..........627"
  },
  "Settings": {
    .....     Many stuff.  .....
   },
  "Modules": {
     .....    More stuff ........
   }
}
-----END FACTORIO EXCHANGE MAP V1.0-----
And now this inside the surrounding first and last line can be zipped and encoded, but it's optionally. If it begins and ends with curly brackets it's Json.

Using Json enables to use only parts of the exchange-format to create your own, which is very cool.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

n9103
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Feb 20, 2013 12:09 am
Contact:

Re: Exchanging maps

Post by n9103 »

ssilk wrote:"Re: Exchanging mapsu"
Since when were you Japanese? :P
40 chars per line is ok. More than 70 are a problem
I believe cube meant 40 characters total, not per line?
If every position in the code was predefined, I can easily see this fitting into 40 characters, if mods aren't included in the list. (And I don't think they should be. If it comes out different, then the poster or the copier failed in the process.)
Colonel Failure wrote:You can lose your Ecologist Badge quite quickly once you get to the point of just being able to murder them willy-nilly without a second care in the world.

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

Re: Exchanging maps

Post by ssilk »

I write most articles on iPad, and that keyboard and auto completion is sometimes .... Strange. :)

I know that he meant 40 in total, but for me it's clear, that this makes no sense, because then it's not human-readable/self-write able.

The compromise is to support both. In end effect it's easy, because you just leave out the last two conversion steps (gzip, base64).
I'm not really lucky with the version-encoding yet (of the format and factorio), but I'm sure cube will find a better way himself.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
Nova
Filter Inserter
Filter Inserter
Posts: 958
Joined: Mon Mar 04, 2013 12:13 am
Contact:

Re: Exchanging maps

Post by Nova »

I see no reason to have the features of the code limited through the character count. To paste the code into factorio from a web site should be no problem, even if the code is pretty large.

But even when there is a reason: Why setting the lenght to a fixed value? How about being able to switch mods on and off before creating the code? No mods = small code.
Greetings, Nova.
Factorio is one of the greatest games I ever played, with one of the best developers I ever heard of.

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

Re: Exchanging maps

Post by ssilk »

Json can be lineless. But there is a point with stagged structures, where your brain cannot read it anymore. 1000 chars is technically no problem. And there are json-formaters in the internet. There is no fixed limit, but I said 70, because that is good handleable. With "problem" I meant, that I think most players don't have the level to handle around with those extremly long strings and that should be cared. If there is a longer line, no problem.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

n9103
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Feb 20, 2013 12:09 am
Contact:

Re: Exchanging maps

Post by n9103 »

The point was to share maps, not create them in text format.
Re-think your position accordingly, as you're overshooting that point by quite a bit.

As for limiting length, I imagine the feature would get more use in forums and other social media if people didn't have to scroll a HUGE wall of text just to talk about the map, or read the discussion about it.
Yea, it's a piddly point, but it's one that's relevant to a lot of the internet population. tldr is a Big thing for a reason.
Colonel Failure wrote:You can lose your Ecologist Badge quite quickly once you get to the point of just being able to murder them willy-nilly without a second care in the world.

User avatar
Nova
Filter Inserter
Filter Inserter
Posts: 958
Joined: Mon Mar 04, 2013 12:13 am
Contact:

Re: Exchanging maps

Post by Nova »

That's one of the reasons to use base64: The big wall of garbage can easily be skipped.
Map code
This are 1014 bytes. Like nearly 1 kbyte. Or the anwser to 8112 yes or no questions. More than enough to store all needed mods. Also we don't need to store EVERY mod. I don't know if we have to share even one mod. (why should we?)

The seed needs maybe 64 bits = 8 bytes (C++ long integer), the whole startup code 28 byte for the configurations (one byte for every option. is to much, but better safe than sorry) + map dimensions and 1 bit (or 1 byte, easier to store) for the peaceful mode.
45 bytes whole. Let's say 64 bytes to store some extras like the version or "Factorio" as name.
Example:
RmFjdG9yaW8gM2lhMDM4Y2MwN2EwNWE2YWMwNm90MTByMmMw
M2EyYTUyMmY2cnQ1aTI1OW82MGMyOGkyZmZvOA==
That would be enough to store every needed value to generate exactly the same map again. Not in a nice format, but enough for a simple map sharing feature.
Greetings, Nova.
Factorio is one of the greatest games I ever played, with one of the best developers I ever heard of.

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

Re: Exchanging maps

Post by ssilk »

Sorry guys, that I jump here in again, but I studied that.

This task looks simple, but it ain't. And it's easy to define some format, but it's really not much harder to make it well.

So I list here some stuff, which should be thought about:
- should have versioning
- should be expandable
- should be printable, verifiable, human readable
- should be compressable (and keep of course printable, but looses human readability)

Versioning means, that the version of the format and the game should be included.
-> Just logical.

Expandable means, that the contend follows existing formats like XML, json - no self developed format.
-> Those guys thought a lot about those formats and they will work per sure in the next 5 years. There are also many tools, libraries, knowledge. And it's quite easy to convert a c++ class into some of those formats.

Printable doesn't mean, that it can be printed on paper. And also not, that it has a limited length of line. It means, that there are not chars in it, which cannot be displayed. Chinese charset for example. The charset is clearly defined (recommend utf-8, could be eventually part of the version).
-> ok! you can also print it on a paper and type it yourself. :)

Verifiable means, that I can be sure that there is no error in the input. Normally this means, to add a checksum at the end. I would say this is optional, because otherwise you cannot create the checksum yourself.
-> Another way would be signing it, e. g. via PGP. Also here: the sig is not needed to validate the format.

Human readable means, that the lines should not be too long (possibly <70 chars). It means also that it has a clear and human readable start and end (header, footer) for easy copy paste. It means, that I can read and write it myself.
-> a forced checksum means, that it cannot be created by humans.

Compress/printable means under normal circumstances clearly, that the content is gzip/base64.
-> it means also, that this last step is optional.


I mean the basics are:
- version able
- expandable
- printable
- and header / footer human readable.

Not more.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

n9103
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Feb 20, 2013 12:09 am
Contact:

Re: Exchanging maps

Post by n9103 »

I think we should take a break on this, and wait until cube directly addresses ssilk's impression that cube's looking for a file to share, even though he only said code.
Files have common formats, codes are proprietary.
Colonel Failure wrote:You can lose your Ecologist Badge quite quickly once you get to the point of just being able to murder them willy-nilly without a second care in the world.

User avatar
cube
Former Staff
Former Staff
Posts: 1111
Joined: Tue Mar 05, 2013 8:14 pm
Contact:

Re: Exchanging maps

Post by cube »

Oh, that's a lot of input :-)
thanks for your ideas....

What I originally imagined was something like Nova's example, as lightweight as possible, to keep it all inside a single small textbox in the game gui.
I think that the super extendable format that ssilk is suggesting would be perfect for a file format but is too heavy weight for our purposes (because JSON wastes characters compared to binary + base64, and XML wastes even more).

I like ssilk's idea with versioning and checksum, the code should be pretty robust and resistant to copy paste errors. Also with versioning we get extensibility (almost) automatically, so that's another reason for not using text based format.

Now I'm leaning to listing all mods (I'm not sure about mod versions yet) and trying to compress the code using some custom compressor (maybe just prebuilt Huffman tree). This would mean more than the 40 characters I wanted (in worst case), but I hope the code could fit on two or three lines.
I have no idea what I'm talking about.

User avatar
Nova
Filter Inserter
Filter Inserter
Posts: 958
Joined: Mon Mar 04, 2013 12:13 am
Contact:

Re: Exchanging maps

Post by Nova »

Why do you want to limit the code to a few lines / even 40 character?


If you insist on this, make it configurable: Short version with a maximum of two lines / 40 characters and a long version with ca. 10 Lines with max 80 character per line. :)
Greetings, Nova.
Factorio is one of the greatest games I ever played, with one of the best developers I ever heard of.

Post Reply

Return to “Implemented Suggestions”