Absolute vs. relative path in JSON files

Discussion in 'Content Creation' started by geobeck, Sep 18, 2021.

  1. geobeck

    geobeck
    Expand Collapse

    Joined:
    May 1, 2014
    Messages:
    218
    Are there restrictions on using absolute vs. relative paths in configuration files?

    I'm working on another sandbox map (mount2). This is a Save As of my previous sandbox (WarpGrid), which was a Save As of gridmap_v2. The Save As function isn't perfect, so I've been going through files to replace path names.

    What's wrong with this picture?

    screenshot_2021-09-18_notepad.png

    Right at the top, one of the sky textures is pointing to /levels/jungle_rock_island/... Since I never took any resources from that map, it means gridmap_v2 has these pointers to jungle_rock_island.

    Question1: Since my map is in my user folder, and jungle_rock_island is in /steamapps, is this a dead link, or does the game parse /levels/ from both paths? This would make sense, since personal re-saves of core maps are in userspace.

    Also note that some of the paths in this file start at /levels/, while others start at /art/... including one (indicated by the cursor) that doesn't exist.

    Question 2: Could we avoid this whole renaming mess by using shorter file paths? Could we start all paths only as far up as necessary for any file contained in the current level?

    If that's the case, could be sorted out in 0.24? I'm sure a batch script could make short work of renaming paths for the core maps... and maybe finally pointing them to a /common/ resources folder!
     
  2. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,056
    1. Pretty sure the devs reused JRI assets intentionally and this will definitely work. It's to avoid duplicates I guess.
    2. Long file paths are needed, because otherwise if someone was making a map mod that was copy of a vanilla map, and copied all the assets with renaming stuff, the materials would get assigned to the files in his location as mods have higher priority than vanilla content, which would break the textures on the vanilla map, because the material would be pointing to the same texture in a folder of the mod map which wouldn't exist because it got renamed... That's complex and rare but I have seen this happen.
     
  3. geobeck

    geobeck
    Expand Collapse

    Joined:
    May 1, 2014
    Messages:
    218
    Okay, I can see that. And I solved one of my own mysteries. One level in the path hierarchy seems to be the gameengine.zip library in the core folder (the only place /art/sky_gradients/ exists). My guess is that data files end up pointing here if there's no overriding path to a specific level.

    So the hierarchy would be:

    1. Personal save in user's /levels/ folder
    2. /mods/ folder
    3. Core /levels/ folder
    4. gameengine.zip?
     
  4. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,056
    Yeah that seems to be the case.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice