Modding Discussion [Nightly] "renderLayer" : "Object+5", and how it works?

Discussion in 'Starbound Modding' started by lazarus78, Apr 4, 2016.

  1. lazarus78

    lazarus78 The Waste of Time

    New nightly update saw the addition of a new line of code added to several objects. "renderLayer" : "Object+5", and I was wondering if anyone knew how it worked. There is also "renderLayer" : "Object-1", on some of them.

    http://helmet.kafuka.org/sbmods/diffs/20160402.txt
     
  2. Mackinz

    Mackinz The Waste of Time

    If I had to guess, there are numerous possible values that are valid, ranging from at least Object+5 to Object and Object-1. The values probably give render priority to certain objects, forcing them to always overlap another object with a lower priority, like z level for blocks.
     
  3. Healthire

    Healthire Can't Most Program the Least

    It's the z-level. There are a bunch of render layers, Object being one of them, and they can also be accompanied by an additional offset. Object will render in front of Object-10, and Object+10 will render in front of Object. Player+10 will render in front of the player, etc.

    This parameter is available in objects, monsters, and projectiles.
     
  4. lazarus78

    lazarus78 The Waste of Time

    Awesome. This is very useful. Thank you.
     
  5. TheElderScroller

    TheElderScroller Pangalactic Porcupine

    Oh yes, thats some good shit heheheh
     
  6. AmazonValkyrie

    AmazonValkyrie Spaceman Spiff

    Can "renderLayer" function properly on the current stable as well, or will it only work on objects on the nightly build? I tried using it for two objects in stable, but couldn't get it to work, but I may have made an error when using it >_<

    EDIT: Just checked in unstable as well, but couldn't get it to work with the objects I made, so I must've made an error. Just so I know I understand correctly, this allows you to place objects in front of other objects right? I made an elaborate, large window but due to it's size decided to build it as an object instead of breaking it into tiles. I wanted to place seating in front of it, so I added "renderLayer" : "Object-10" to the file for the window, and added "renderLayer" : "Object+10" to the seating, but it still won't allow me to place the seating in front of the window. If anyone has any advice, I'd greatly appreciate it :)
     
    Last edited: Apr 28, 2016
  7. lazarus78

    lazarus78 The Waste of Time

    "renderLayer" : "foreground" and "renderLayer" : "background" should work, but being able to set a specific render layer, I'm not sure.
     
  8. AmazonValkyrie

    AmazonValkyrie Spaceman Spiff

    :/ I tried your suggestion in stable and unstable. In stable it still won't render one in front of the other, and in unstable it crashes with the error: "Key 'background' not found in Map::get()" and the same with foreground. Ugh, I may just have to bite the bullet and render the window as a massive amount of tiles to get this to work >_<.
     
  9. lazarus78

    lazarus78 The Waste of Time

    The objects wont overlap one another, if that is what you are trying to do.
     
    AmazonValkyrie likes this.
  10. AmazonValkyrie

    AmazonValkyrie Spaceman Spiff

    >_< lol Yep, that was what I was aiming for. Alrighty, looks like I'm making a lot of tiles lol. Thanks anyway, lazarus!
     
    Last edited: Apr 28, 2016
  11. Charlatan

    Charlatan Parsec Taste Tester

    I dont want to necro this thread, but while my guide about object placement should offer clarity about this and most related topics, one question remains open for me: No matter what I tried, the game seems to only accept the inherent renderLayer set in the .object file when you manually place it - ignoring whether the parameter changes afterwards.

    I have attempted:

    > By script on a target object by object.setConfigParameter = no effect
    > By script and .animation adding it to the part's properties = no effect
    > By script and .animation adding it to the part-state properties = no effect
    > By making a script smash the target object and re-place it in the same spot, with world.placeObject having renderlayer set up in the {JSON parameters}

    While some kind of typo/misunderstanding is possible, all 4 versions do not actually cause any LUA error, and all world.sendEntityMessage go through without problems too, the object simply remains at the default renderLayer.
     
  12. bk3k

    bk3k Oxygen Tank

    Well since this thread has been raised, I can't quite find where I once swear I had a list of renderLayers. Should have saved it. I used a script to tell me all values used in vanilla files are these

    Code:
    "renderLayer" : "BackgroundOverlay",
    "renderLayer" : "foregroundEntity",
    "renderLayer" : "ForegroundEntity",
    "renderLayer" : "FrontParticle+1"
    "renderLayer" : "ItemDrop+1",
    "renderLayer" : "MiddleParticle",
    "renderLayer" : "Monster+1",
    "renderLayer" : "Monster+10"
    "renderLayer" : "Monster+10",
    "renderLayer" : "Monster+11",
    "renderLayer" : "Monster+2",
    "renderLayer" : "Monster+20",
    "renderLayer" : "Monster+50"
    "renderLayer" : "Object+1",
    "renderLayer" : "Object+10"
    "renderLayer" : "Object+5",
    "renderLayer" : "Object+50",
    "renderLayer" : "Object-1",
    "renderLayer" : "Object-10",
    "renderLayer" : "Player+1",
    "renderLayer" : "Player+10",
    "renderLayer" : "Player+12"
    "renderLayer" : "Player+12",
    "renderLayer" : "Projectile+1",
    "renderLayer" : "Projectile-1",
    "renderLayer" : "Projectile-10",
    "renderLayer" : "Projectile-100",
    "renderLayer" : "Projectile-20",
    


    To which I'd simplify to
    Code:
    "renderLayer" : "BackgroundOverlay",
    "renderLayer" : "ForegroundEntity",
    "renderLayer" : "FrontParticle"
    "renderLayer" : "ItemDrop",
    "renderLayer" : "MiddleParticle",
    "renderLayer" : "Monster",
    "renderLayer" : "Object",
    "renderLayer" : "Player",
    "renderLayer" : "Projectile",
    
    +Z level but I feel there where more I'm missing, even if not used for this exact parameter.

    I'm fairly certain that with "BackgroundOverlay" listed, "ForegroundOverlay" should also be even if not used as a value. I'd bet it is valid. As is I know you can have "ForegroundOverlay" in a ship because I use it so this seems a reasonable assumption.

    I think if there is a "ForegroundEntity" then "BackgroundEntity" should be valid.

    Possibly "MidgroundEntity" too? I've seen old references to "Midground" I "think." Or would it be "Middleground"? That assumption is on shakier ground.

    If there is a "FrontParticle" and a "MiddleParticle" then there should be a "BackParticle" too.

    Somehow I think I remember "Parallax" in there, but maybe I'm wrong about that.

    The list I'd say I'm a little more sure of then is
    Code:
    "renderLayer" : "BackgroundOverlay",
    "renderLayer" : "ForegroundOverlay",
    "renderLayer" : "BackgroundEntity",
    "renderLayer" : "ForegroundEntity",
    "renderLayer" : "FrontParticle"
    "renderLayer" : "MiddleParticle",
    "renderLayer" : "BackParticle",
    "renderLayer" : "ItemDrop",
    "renderLayer" : "Monster",
    "renderLayer" : "Object",
    "renderLayer" : "Player",
    "renderLayer" : "Projectile",
    
    It might be something to test with trial and error I guess. Unless someone has the actual complete list.

    And now I'm wondering this too. "BackgroundOverlay" and "ForegroundOverlay" are presumably both layers, but at the same time they're also used in the ships to display images. I might have to experiment on using those nameSpaces in objects etc as a possible/alternate way to draw images to the screen. That could be interesting. Also wondering if I can get some animation into ship images.
     
    lazarus78 likes this.
  13. lazarus78

    lazarus78 The Waste of Time

    How did you find these?
     
  14. bk3k

    bk3k Oxygen Tank

    I've been figuring out how to use Powershell.

    Code:
    Get-ChildItem -Path "C:\Games\Steam\steamapps\common\Starbound\unpacked_assets\packed(1.2.3)" -Filter *.* -Recurse -Exclude *.png,*.lua,*.ogg,*.wav,*.ttf -Include *.* | get-content | Where-Object { $_.Contains('"renderLayer"') } | Foreach {$_.Trim()} | Foreach {$_.Replace('":', '" :')} | Foreach {$_.Replace(':"', ': "')} | Sort-Object -Unique -CaseSensitive | out-file "C:\Games\Steam\steamapps\common\Starbound\vanilla_renderLayers.json"
    That's how I got the initial list anyhow.
     
    lazarus78 likes this.
  15. Charlatan

    Charlatan Parsec Taste Tester

    I see, I was missing foregroundoverlay and backgroundentity. once I get around to testing where they stand in the Z order of layers, I'll add em to my guide.

    EDIT:
    Given the nature of Zlevels however, we already have more than enough layers already to do pretty much everything we want.

    The only thing that stops us is what I said above: the game won't accept changing the layer after initial placement.

    Player, Projectile, Monster, Object and Itemdrop theoretically ARE the MiddlegroundEntity layer anyhow, except they offer much more specific detail. The only one I wouldnt know a substitute for would be a thoretical MiddlegroundOverlay
     
    Last edited: Apr 8, 2017
  16. bk3k

    bk3k Oxygen Tank

    Yeah in general it sometimes doesn't re-evaluate changes in JSON for things that are in place.

    It isn't a problem for scripted matters because our scripts can handle things, but for the engine specific stuff like "renderLayer" that scripts don't handle. They should make an internal change to object.setConfigParameter where calling it also triggers a re-read of those engine specific/hardcoded attributes. Or better yet just provide a separate function for us to manually force the issue when needed.
     
    Last edited: Apr 8, 2017

Share This Page