Modding Help Looking for information on "imagePosition" & spaceScan?

Discussion in 'Starbound Modding' started by AmazonValkyrie, Apr 27, 2016.

  1. AmazonValkyrie

    AmazonValkyrie Spaceman Spiff

    I've fiddled with both in object files, but I wasn't too sure how much imagePosition & spaceScan each affects an object, nor am I too familiar with properly assigning the coordinates. If anyone could help out with any information on the subject it would be greatly appreciated ^_^
     
  2. Charlatan

    Charlatan Parsec Taste Tester

    > Spacescan
    It's too early to say, because I only just discovered it.
    I am ABSOLUTELY sure and remember I experimented with spacescan and all kinds of values. Still, now, suddenly, removing that entry seems to make a few of my objects almost completely able to overlap

    > Imageposition
    That's simply an option to move the visuals of the object along X or Y axis, basically, it just means where it anchors while you place it.
    When both are 0, the image will be at the bottom left corner of the sprite,
    In most cases, it is 0 on Y and 50% on X - simpler said, if an image is, say, 40 pixels wide, it is usually on 20 points along X, so that it appears exactly in the middle. Y is usually 0, so that the object stands on the ground if it anchors there.
     
    AmazonValkyrie likes this.
  3. Charlatan

    Charlatan Parsec Taste Tester

    PS: Imageposition is somewhat irrelevant, but I should add when the object has an uneven amount of width it will probably frustrate perfectionists, as this can make an object only fit into a narrow place when turned one side - and no longer fit when turned the other.

    If you want the details, I'll give them, but I'm aware I'm kinda longwinded WHEN explaining :p
     
    AmazonValkyrie likes this.
  4. AmazonValkyrie

    AmazonValkyrie Spaceman Spiff

    lol I don't mind detailed explanations! As a perfectionist, I've been time after time frustrated with just that, and in recent months I've even made sure to always constantly render my objects with 8x8 tile sizing in mind so that I don't have to tweak too much with positioning and I can somewhat conserve space. Anyway, I'd love to know your findings, long winded or not!
     
    Charlatan likes this.
  5. Charlatan

    Charlatan Parsec Taste Tester

    Well, my most urgent discovery right now is fact that the Viera Mod is from you, and that I had forgotten to upvote it because I got it from a pack a friend sent to make sure we have all the same mods. So gonna head there next.

    Secondly, I've done exactly the same thing. You know the many vanilla-plants from my mod - actually, it was quite some work because I trimmed all of them to a multiple of 8, and expanded/cut/edited most of them where this created gaps. Mostly did that so that it is convenient for the users without losing out on visuals - only by fitting the 8x8 grid, images can be placed as perfectly as possible.

    Aaaaand on that topic. Well.... the bloodstains from my old, cancelled mod, which eventually evolved into NG recently, can simply overlap HEAVILY. It doesn't work as well with other objects. In fact, as I said, long ago, I played with that parameter as much as I could, and nothing changed at all.

    Here's two simple theories:
    1.) the mechanic behind this value changed with 1.0, or somewhere while I was away, and now allows this under some circumstances.

    2.) These circumstances might be the only clear difference these bloodstains have from my other decorations - they are transparent to varying amounts. Since Starbound seems to "read" the image and try to keep any 8x8 block free (My FU Laboratory has info screens in gaps between the Matter assembler, etc), it would make sense if transparency is somehow related.


    Lastly, if I am right that you seem to seek a way to let decos overlap better, I have a much more flexible, but slightly flawed solution - improvised, just how I like it. If you saw my screens from the future update with the "front layer vines" - it's simple: Only the 16x16 stem at the top is an object. The extended, long vines are fake particle effects, as in, particles that dont animate or move. I later saw Chucklefish actually had the same idea - the light in prism crystals.
     
    AmazonValkyrie likes this.
  6. AmazonValkyrie

    AmazonValkyrie Spaceman Spiff

    lol Yes, that's me ^_^ Thank you for upvoting/reviewing, it really means a lot!

    Yeah, my problems with object sizes and proper positioning arose because the objects I created originally for the Viera didn't abide by or recognize the 8x8 rule >_< I've remedied that recently, but it was definitely a valuable lesson to learn regardless of having to resize/remake earlier work. I don't believe I got to see those screens for the front layer vines. Would you mind linking one or PM'ing me one? I've really wanted to play with ways to make environments more immersive utilizing tricks like that, so if you have more to share, I'd love to know! And here I thought I was crafty when I made full windows into background objects just to get the shape I wanted :p
     
  7. bk3k

    bk3k Oxygen Tank

    Well the best use for it(which I'm not personally interested in) is when you do stuff like [-24, 0] which moves the object over 3 tiles(24/8=3). And if your object is 5 tiles wide, that would move the cursor from being on the bottom left corner of the object(when placing) to the bottom center. That will also affect how you have to place in via blockImages etc. I always just make that [0,0] myself. Plus you'd want to be careful with this if using "spaces" instead of "spaceScan."

    As for the "spaceScan" attribute, you can see how that's used if you look at the LUA documentation for root.md
    So what this does is a substitute for the "spaces" attribute you may find on some objects. You can use this, or you can define the "spaces" the object would occupy. "spaceScan" does this automatically based off of examining the image and therefore is probably slower, but less hassle if you make many objects. But it can be useful to define "spaces" because that lets you determine yourself what tiles the object 'exists' within. That's something I intend to use with great effect on an upcoming project of mine.

    You CAN place another object and foreground tiles on any tile space that isn't part of the "spaces" despite where the actual image lies. From the LUA side, you can get this info from
    Code:
    object.spaces()
    and optionally(if you defined your "spaces") from
    Code:
    config.getParameter("spaces", {})
    Now supposing you did this in your object
    Code:
    "spaces" : [],
    or just plain commenting out both "spaces" and "spaceScan"
    You're objects won't 'exist' anywhere. They can be placed over/be placed over by any object so they can overlay one another. And one could use that for decorative objects perhaps combined with something like
    Code:
    "renderLayer" : "Object+5",
    for great effect in this way.

    One other thing I'll mention which could be of use to some, I believe you can take anything(or most anything) that isn't within "orientations" to be within it, or take the things within it to outside it. The difference being you can have any attribute be different depending upon object orientation. So you could have the wire nodes in a different spot when your object is flipped/upside down/etc... for example. But attributes that will be identical regardless might as well be outside it so you don't need multiple copies of the same data.

    A last thing I'll mention, if you want free floating objects, simply commenting out the "anchors" does the job.
     
  8. Charlatan

    Charlatan Parsec Taste Tester




    Ya that's what I meant with the "50%" I mentioned above, guess it was not specific enough. But then, most vanilla objects apply that centering.

    While all of this is useful for modders, one thing stands out. The "renderLayer". I use most of the rest you said a lot in my mod already, especially the free-floating, but that one is kinda heavy on possibilities. This is also a frequent question by people. Starbound Modding definitely can gain even much more potential if more of these are shared - much exceptionally useful things seem only known by those with advanced LUA experience.

    Just to be clear - does "Object" mean the object's own ID here, or actually the word "Object" ?

    That's pretty much what accidentally revealed this earlier here - however, it's not fool-proof.
    For me, it still has a few spots where they cannot be placed, despite making no sense: No Anchor. No Space. Can overlay other decos, crafting stations, walls, but sometimes can't be put on seemingly random spots of empty walls.

    PS: For anyone intending to use this, be sure to take in mind players will be almost completely unable to single-target any such decor with the MM. Only AOE works on objects with no "space"
     
    Last edited: Nov 30, 2016
  9. bk3k

    bk3k Oxygen Tank

    "renderLayer" : "Object+5" would refer to the object rendering layer. I forget where I found the list of layers(and their order) somewhere. If I dig that up again, I'll let you know. Layers render one on top of another. I think parallax being the back layer etc. "Object+5" will render on top of "Object" but behind "Object+10" etc. You can have "Object-1" or "Player+1" (if you wanted it drawn in front of the player).

    Basically this is render layer with zLevel. But of course the zLevel isn't going to overcome the layer. "BackgroundOverlay+9001" won't draw in front of the player... unless I misunderstand how this works.

    If you want to see many vanilla examples, crack open Notepad++'s "find in files" and search for "renderLayer" starting at the directory you unpacked the assets. I didn't find any LUA code that references this attribute, so it must be implemented entirely on the C++ side.
     
    Charlatan likes this.
  10. Charlatan

    Charlatan Parsec Taste Tester

    Thanks for the many useful infos, once again.
     
  11. olsonpm

    olsonpm Void-Bound Voyager

    I know this thread is old, but since this is one of the top posts on google for "starbound spacescan" - modders should reference this great thread by Charlatan for object placement reference.
     

Share This Page