Alternate verbose blueprint string format

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

sparr
Smart Inserter
Smart Inserter
Posts: 1463
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Alternate verbose blueprint string format

Post by sparr »

I recognize that blueprint strings are short so they will be easier to copy, paste, post online, etc.

I would love to have a way to "expand" a blueprint string to something like a JSON blob or lua object declaration, and then to paste that format back into the game.

The use case for this is to make the blueprint string itself directly editable, and more importantly to allow the strings to exist in source control. I want to expand a blueprint book to a github repository, and accept pull requests against it.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Alternate verbose blueprint string format

Post by darkfrei »

This library helps you convert blueprints to text strings, and text strings to blueprints
https://github.com/DaveMcW/blueprint-st ... string.lua
sparr
Smart Inserter
Smart Inserter
Posts: 1463
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Alternate verbose blueprint string format

Post by sparr »

darkfrei wrote:
This library helps you convert blueprints to text strings, and text strings to blueprints
https://github.com/DaveMcW/blueprint-st ... string.lua
That's an internal library for turning an *actual* lua table into a blueprintstring. It doesn't help with the question of serializing a table or making the game accept serialized tables.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Alternate verbose blueprint string format

Post by ssilk »

This is not translatable, cause a blueprint is a kind of "program", which calls lua functions to place entities.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
sparr
Smart Inserter
Smart Inserter
Posts: 1463
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Alternate verbose blueprint string format

Post by sparr »

ssilk wrote:This is not translatable, cause a blueprint is a kind of "program", which calls lua functions to place entities.
No, it's not. A blueprint exchange string is just a gzip'd json blob describing the objects.

Here is the actual contents of a small blueprint, decoded:

Code: Select all

{
  "blueprint":{
    "icons":[
      {
        "signal":{
          "type":"item",
          "name":"express-splitter"
        },
        "index":1
      }
    ],
    "entities":[
      {
        "entity_number":1,
        "name":"express-underground-belt",
        "position":{
          "x":-2,
          "y":-2
        },
        "direction":4,
        "type":"input"
      },
      {
        "entity_number":2,
        "name":"express-transport-belt",
        "position":{
          "x":-1,
          "y":-2
        },
        "direction":4
      },
      {
        "entity_number":3,
        "name":"express-splitter",
        "position":{
          "x":-1.5,
          "y":-3
        },
        "direction":4
      },
      {
        "entity_number":4,
        "name":"express-underground-belt",
        "position":{
          "x":1,
          "y":-2
        },
        "direction":4,
        "type":"input"
      },
    "item":"blueprint",
    "version":64424902656
  }
}
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Alternate verbose blueprint string format

Post by ssilk »

Oh, looks, like I'm not up to date. :oops: :) Thanks for this hint, I cannot know everything. :)

Well, if that format is that simple, I don't see any need to change it. That de/compression is kind of standard in any programming language.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
sparr
Smart Inserter
Smart Inserter
Posts: 1463
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Alternate verbose blueprint string format

Post by sparr »

ssilk wrote:Well, if that format is that simple, I don't see any need to change it. That de/compression is kind of standard in any programming language.
It doesn't matter how simple it is. If I give someone that blueprint string above, they need some third party tool to convert it. I want them to be able to just paste it into the game.
Post Reply

Return to “Ideas and Suggestions”