June 25 - Changing JSON Merging

Discussion in 'Dev Blog' started by OmnipotentEntity, Jun 25, 2014.

  1. Darklight

    Darklight Oxygen Tank

    Choosing madness over potentially more capabilities doesn't seem like a solid choice to me though
     
  2. NanoPi

    NanoPi Scruffy Nerf-Herder

    a much saner way, lacking any array join method...

    Code:
    [
      { "op" : "add",
        "path" : "/defaultBlueprints/tier1/-",
        "value" : { "item" : "kawa_hotpants" }
      },
      { "op" : "add",
        "path" : "/defaultBlueprints/tier1/-",
        "value" : { "item" : "felinbeanbagchair" }
      }
    ]
     
    starboundish likes this.
  3. The | Suit

    The | Suit Agent S. Forum Moderator

    I see a big issue here, in the current discussion.
    Most of the issues being raised are on issues, in which the current system is already capable of.
    That is silly, and holds on merit in the decision.
    That would be akin to the argument if Car A is red and Car B is green. Which car is better - in order to reach the destination.

    If they want to consider a change, we should ONLY consider what the new system can do, which the current system can't. Hence any talk of adding to blueprints is down right trivial and pointless in my opinion. Which would only result in diluting the conversation and wasting time. Where we may end up replacing the current system with the exact same system with different syntax.

    The True question is - Does this new system actually add any functionality which the current system is incapable of, and if so how much? And what are the limitations of the new system as opposed to the current one?

    =====
    The only functionality I see so far is being able to edit square brackets without overwrite

    Code:
    [
        { "op": "add", "path": "/allowedDetachedBiomes/-", "value": "bob" }
    ]
    =====
    While the underground biomes - I have shown earlier. Doesn't seem there anyway to "edit" it - without overwrite. But you probably would be able to add a completely new group to it at least.
    Answered:
    http://community.playstarbound.com/...anging-json-merging.81014/page-3#post-2085816
     
    Last edited: Jun 26, 2014
    Armed Mosquito and Darklight like this.
  4. Archer

    Archer Spaceman Spiff

    If it is possible to "merge" with arrays in some way or another with the new system, then I'm all for it, otherwise I don't see much point in it to be frank (coming from a simple modder with little to no coding experience).
     
  5. NanoPi

    NanoPi Scruffy Nerf-Herder

    if I wanted to add "desert" to the end of the very first biomes list after "sandstonelayer", the patch would look like this:
    Code:
    [
      { "op" : "add",
        "path" : "/undergroundLayers/0/biomes/-",
        "value" : "desert"
      }
    ]
     
    Jeoshua, The | Suit and Archer like this.
  6. Darklight

    Darklight Oxygen Tank

    Sadly only Omni can answer that so we're stuck waiting on him to wake up
     
  7. The | Suit

    The | Suit Agent S. Forum Moderator

    See that is - a great point adding to the new system. Which should have been pointed out.
    Something the current system isn't capable of doing.

    Thanks for clearing that up.
     
    Armed Mosquito likes this.
  8. snefu114

    snefu114 Aquatic Astronaut

    I would love to see anything that can give the devs and modders more room to play with. They have already been doing great work, and we have been waiting awhile already.... So I am in support of waiting for a new, better system! Lets make the game ground breaking!
     
  9. Kawa

    Kawa Tiy's Beard

    Surely you mean "make this game even more ground breaking." :catface:
     
  10. Kawa

    Kawa Tiy's Beard

    Figured out how to add a dungeon~

    { "op": "add", "path": "/surfaceBiomeParameters/forest/dungeonSelection/0/1/-", "value": "felinvillage" }
     
    NanoPi, Jeoshua and The | Suit like this.
  11. Type1Ninja

    Type1Ninja Hard-To-Destroy Reptile

    I know this is an old post but "Don't reinvent the wheel" is suddenly "Don't reinvent the wheel, refine your current wheel until it's awesome."
    :rofl:
     
  12. Kawa

    Kawa Tiy's Beard

    Just finished converting all the __merge files in the Felins mod to Patch. I learned a lot of stuff. All ten relevant files now have counterparts with .patch at the end.

    If you have NPCs and such in your mod, ask me and I'll gladly share my files to help.
     
    Armed Mosquito and The | Suit like this.
  13. Tamorr

    Tamorr Supernova

    Ok, that is simple enough. Thank you. Since the only thing I am doing in my mod with the merge function is just adding a learn on pickup value to my recipes. Hopefully that will work with this new system. :)

    Either way I am just glad it is about as simple to change what I need to modify.

    Now only if they can separate the 3D printer crafting and the regular crafting that would be nice. As in one blueprint will unlock for the printer and one for the actual crafting. That was the only problem I have run into in my own personal mod. At least without having to replicate objects in order to do so.

    I do agree with all that everyone else has said about functionality, as that is important to expand the modding base a bit. Sure it would be nice that the merge be fixed but if there is a better alternative that has more functionality, then I know I would be all for it, even if means learning how to modify this and that again to what I need things to do...
     
  14. Kawa

    Kawa Tiy's Beard

    It's my birthday, and because I'm a weird little man here's a little gift: how to map merchants from __merge to patch.

    Code:
    {
      "__merge" : [],
      "scriptConfig" : {
        "returnToStore" : {
          "dialog" : {
            "follow" : {
              "felin" : [
                //BLOCK-A
                "Follow me to my store, please.",
                "The best prices around, just if you please to come with me."
                //BLOCK-A
              ]
            },
            "welcome" : {
              "felin" : [
                //BLOCK-B
                "What you wish to buy? If you wish to buy...",
                "I got everything that can help you in anything."
                //BLOCK-B
              ]
            },
            "tout" : {
              "felin" : {
                //BLOCK-C
                "default" : [
                  "I got the best goods!",
                  "If you can't find it here... it's not for sale here."
                ],
                "apex" : [
                  "Interested in brand new goods?",
                  "What? Tracking device? Why should it has one?"
                ],
                "felin" : [
                  "Need some help in your hunt?",
                  "Anything I can help with, Hunter?"
                ]
                //BLOCK-C
              }
            }
          }
        },
        "merchant" : {
          "dialog" : {
            "start" : {
              "felin" : [
                //BLOCK-D
                "Stuff for sale~",
                "Anybody need anything?"
                //BLOCK-D
              ] 
            },
            "end" : {
              "felin" : [
                //BLOCK-E
                "Great to see you!",
                "Let's do business again."
                //BLOCK-E
              ]
            }
          },
          "items": {
            "feliningredients": [
              //BLOCK-F
              [ 0, [
                { "item": { "name": "pussplum" }, "cost": 5 },
                { "item": { "name": "neonmelon" }, "cost": 5 },
                { "item": { "name": "grapes" }, "cost": 5 }
              ] ]
              //BLOCK-F
            ]
          }
        }
      },
      "items" : {
        "felin" : [
          //BLOCK-G
          [0, [
            {
              "chest" : [
                { "name" : "kimonochest", "data" : { "colorIndex" : 1 } }
              ],
              "legs" : [
                { "name" : "kimonolegs", "data" : { "colorIndex" : 1 } }
              ]
            },
            {
              "chest" : [
                { "name" : "shirtlong1chest", "data" : { "colorIndex" : 1 } }
              ],
              "legs" : [
                { "name" : "jeans3legs", "data" : { "colorIndex" : 1 } }
              ]
            }
          ] ]
          //BLOCK-G
        ]
      }
    }


    Code:
    [
      { "op" : "add",
        "path" : "/scriptConfig/returnToStore/dialog/follow/felin",
        "value" : [
          //BLOCK-A
        ]
      },
      { "op" : "add",
        "path" : "/scriptConfig/returnToStore/dialog/welcome/felin",
        "value" : [
          //BLOCK-B
        ]
      },
      { "op" : "add",
        "path" : "/scriptConfig/returnToStore/dialog/tout/felin",
        "value" : {
          //BLOCK-C
        }
      },
      { "op" : "add",
        "path" : "/scriptConfig/merchant/dialog/start/felin",
        "value" : {
          //BLOCK-D
        }
      },
      { "op" : "add",
        "path" : "/scriptConfig/merchant/dialog/end/felin",
        "value" : {
          //BLOCK-E
        }
      },
      { "op" : "add",
        "path" : "/scriptConfig/merchant/items/feliningredients",
        "value" : [
          //BLOCK-F
        ]
      },
      { "op" : "add",
        "path" : "/items/felin",
        "value" : [
          //BLOCK-G
        ]
      }
    ]

    The stuff inbetween BLOCK-? bits in the __merge version can be spliced verbatim into the patch version.
     
  15. Unclever title

    Unclever title Cosmic Narwhal

    Where my brain immediately went:

    [​IMG]

    More on topic. I haven't actually written any mods for Starbound myself but my opinion is go for it.
    Something else would likely have (or already has) broken mods sooner or later anyway.
     
    OmnipotentEntity likes this.
  16. Hot Soup 74

    Hot Soup 74 Title Not Found

    I say that the change is worth it. What is the point of trying to use a broken system? If __merge doesn't work then crush it!
     
  17. starboundish

    starboundish Phantasmal Quasar

    Phew I'm not much of a programmer but I guess it will break many mods. However, it might pay off.

    Kudos to NanoPi for showing all that possible alternatives. I think I'm in love with you man ^^. Seems to be easier than I thought.

    Happy birthday!
     
    Last edited: Jun 26, 2014
    Kawa likes this.
  18. NonBritGit

    NonBritGit Cosmic Narwhal

    I was one of the main modders over on Don't Starve and I can tell you all our mods broke almost every two weeks when updates dropped. Sometimes the more complex mods broke so bad they weren't salvageable. I lost count how many days and weeks I tried keeping mods working during development of the game.

    But, it was for the betterment of the game and it also taught me not to spend too much time modding a game that was still changing code-wise.

    Make the game the best you know how and try to make any changes like this as painless as possible with detailed instructions on what changed and how to get old mod code working with your new code.
     
    The | Suit likes this.
  19. Throndir

    Throndir Scruffy Nerf-Herder

    Always better to fix things right, then leave something hacky in place. I'm not a modder for Starbound, but I do dev-work for a living, and I've always been guided to do the correct fix when things like this come up. Aiming for the long run is better than potential future headaches.
     
  20. bartwe

    bartwe Code Cowboy

    Absolute indices in patches should be done carefully, and dynamic queries for the offset should be preffered.
    Mostly so that multiple mods can touch the same file.
     

Share This Page