June 25 - Changing JSON Merging

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

  1. OmnipotentEntity

    OmnipotentEntity Code Monkey Forum Administrator

    OmnipotentEntity submitted a new blog post:

    June 25 - Changing JSON Merging

    Continue reading the Original Blog Post
     
    Axe Garian likes this.
  2. OmnipotentEntity

    OmnipotentEntity Code Monkey Forum Administrator

    Axe Garian, Zael and Inco like this.
  3. Aegis J Hyena

    Aegis J Hyena Existential Complex

    I don't know a thing about programming, but the words "if it isn't broken, don't fix it". Breaking/removing this merge thing sounds like it would break dozens of mods (harder than adding a new system anyway). Wouldn't it be easier to just have future coding refer to the new means of doing things and not use "__merge" and have said future coding still call stuff back (ignoring merge but still calling it back) --- you'd still only focus on the latter system, with the code already in place just remaining for its own sake or something.
     
  4. Djinn

    Djinn They're not goats, darnit!

    Even though it would cost potentially dozen of hours to fix across my various mods, I think its still early enough in the development process to be worth it. Short term pain for long term improvement and improved capabilities.

    That's my vote.
     
  5. Inco

    Inco Scruffy Nerf-Herder

    It's better to break something now than have to screw around with workarounds and redundant code in the future.
     
  6. neil_v

    neil_v Big Damn Hero

    I agree with the above two posts. Going back and nipping the problem in the bud is the way to go. I'm sure the long term and short term benefits far outweigh the temporary hindrance.
     
    Zael, Kabu, matheod and 1 other person like this.
  7. malicewagon

    malicewagon Aquatic Astronaut

    I'm still in dev of my own mod, so this doesn't affect me as terribly as say Djinn, but I think the more robust / flexible solution should be used. Count me in for the new system.
     
    Kabu and NanoPi like this.
  8. Nihil K'ri

    Nihil K'ri Void-Bound Voyager

    If a function is lacking functionality that you need, then it is effectively broken, as far as things the new functionality would allow are concerned. Also, old code makes things cluttered.
    If it isn't broken, don't fix it, but if a bone is broken and heals wrong, it will stay crooked for the rest of your life until you rebreak it and fix it correctly.

    My vote is for the new system. Break it until it is no longer broken.
     
    Barlov Monkiss, Zael and A1CZERO like this.
  9. Tamorr

    Tamorr Supernova

    Well as long as it remains simple enough to fix things that used that __merge.

    I actually liked what I could do with the merge as it cuts down quite a bit of what would basically be a copy. I don't know much on the new one your suggesting, and I am not really all that knowledgeable in the modding side of things; however I do know how to read instructions and modify them accordingly.

    Really if it keeps the mod size in mind down to the same size as they are now, that would be fine. As well not have too many redundancies or duplicate info. (What was done before the __merge command)

    So as long as it can be explained simply or utilized simply I would be fine with it either way.
     
  10. matheod

    matheod Big Damn Hero

    I'm also in favor of this change. It's not a good thing to be limited by the actual system.

    There is just something bothering me : how to add a value to an array at the end ? They only give example to add at a defined position/index, but what if we just want to add it at the end and if we didn't know the array lenght ? In fact it would be cool to be able to say "add bar after foo", i.e. [a,b,c,d,e,foo,g] would become [a,b,c,d,e,foo,bar,g]. Same for before.
     
  11. Underbalanced

    Underbalanced Phantasmal Quasar

    Someone should start developing a script to aid!

    I agree the short term pains are worth better functionality! I find my self saying this a lot as well.
     
  12. IvoryOwl

    IvoryOwl Pangalactic Porcupine

    These 3 have said it all.
     
  13. PartyAlarm

    PartyAlarm A "Cool" "Good" poster.

    Add me in as another vote for the new system
     
  14. Jeoshua

    Jeoshua Existential Complex

    Something definitely needs to be changed. As the system currently stands, you have to explicitly declare "overwrite" when a value already exists, and if you forget to do so, the mod doesn't work (and likely crashes the game). I mean, is there ever any reason to have a mod cause the game to fail to load when improperly declaring an overwrite? Is there ever a good reason to ignore that value? I assume that this behavior is because every line is parsed as the line is read into the game, and if something doesn't fit it immediately throws an exception.

    There are many JSON implementations (particularly Java based ones) that first build up a tree of values, silently allow overwrites explicitly, and only parse the data after it is all loaded in. Doing something like this would eliminate the necessity of merge and overwrites, allow seamless changing of values, and even allow comments in mods!

    How?

    Code:
    value = "This is a comment. This requires an integer value"
    value = 1
    
    If the final code is only parsed at the end of mod loading, the final type of "value" is an integer, not a string.

    It would also be nice to be able to inject values into a list, modify or remove from a list, or what have you. This would be a great way to make it easy to add values to treasurepool files, for example, or modify values in celestial.config biome lists (currently a personal source of issues).

    Also, some concept of "includes" or "parent files" would allow mods to explicitly modify a specific file, chose a specific mod to change the values of, for compatibility patches, make building that "tree" of values easier, and more.
     
    Last edited: Jun 26, 2014
  15. Kahzel

    Kahzel Big Damn Hero

    I'm all in for a new system that not only works better than "__merge", but also follows RFC norms.

    i like RFC norms. They make network and database management not so hellish.
     
    Jeoshua likes this.
  16. Ignify

    Ignify Phantasmal Quasar

    I agree with Dijinn. The long-term improvement will pay off. This was actually one the limitations of someone I know who was working on a mod. I also have some ideas I would like to implement if you change the system to the new one you proposed.

    Edit: Thanks for the update!
     
    Last edited: Jun 26, 2014
  17. Fireball14

    Fireball14 Void-Bound Voyager

    As far as i see it, any solution is beter then none. Im all in for new system.
     
  18. Xotano

    Xotano Subatomic Cosmonaut

    i'v made and helped make a few mods with my brother (nothing uploaded) but not too much work and it should be quick to fix, i support the change if it fixes problems.
     
  19. dantronix

    dantronix Big Damn Hero

    I am cool with a new system. Eliminate that sucka!

    Thanks for the consideration.
     
  20. Ramones_fan

    Ramones_fan Pangalactic Porcupine

    not reallly much of a modder but i know the merge functionality is broken and as you are saying it might not be fixable, so essentially we would end up with a new system down the line anyway, i wouls say fix itnow.
     

Share This Page