Isometric Z order for long objects

0 favourites
  • 6 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi guys.

    I have the following problem.

    Im making isometric rts and for Z order I find This Plugin quite helpfull, with 1 major problem for me. It doesnt really work for long objects at 45%.

    Here is some illustration of what i mean:

    Here is the perfect situation and everything works fine

    <img src="https://dl.dropbox.com/u/19082408/02.JPG" border="0">

    Here is the problem. The green boxes are situated allright on z, but the red ones wont be ok.

    <img src="https://dl.dropbox.com/u/19082408/01.JPG" border="0">

    Here is what exactly im trying to solve. Imagine there is a unit infron of the wall.

    <img src="https://dl.dropbox.com/u/19082408/03.JPG" border="0">

    Does anyone have an idea how i can manage this?

    Thanks

  • Most z ordering is actually based on the individual objects y.

    Unfortunately an object can only have one y, therefore if an object is bigger than the isometric cell size this z ordering wont work.

    Your solution is to make the objects smaller, or cut them up to fit together.

  • Just a few ideas....

    I am testing a few of these today...

    pretty sure they will work...

    Yes making smaller wall segments is an option but you could also try adding a few instance variables to the Wall segment and Store "fake" Y coordinates in them...

    Determined by getting the BASE Y of the wall segment and then subtracting divisions of measurement to create the Variable "fake" Y positions.

    then if you game is more or less tiles based you can compare the Units Y axis to the Fake Y coordinates of the wall segment....if you know what I mean...

    For example a Wall segment that was 100 pixels wide but spanned say, 100 pixels in Y coordinates..then you could break the Variables up into proportionate "fake" Y coordinates... at each respective jump in Y difference....Does that make sense?

    Of course you will still need to refine it..but it seems that you are using a sort of Grid based snapping system? try to incorporate that into your grid system...if you are not using a snap to position grid then It may be alot harder....

    You could also use image Points to enable snap to positions set at any interval you like along the wall edge ..then when your attacking units

    get close to the wall you could Snap them to the image points position...

    Or even easier, place a small invisible marker sprite at the wall edge image points which you set up in the animations editor..(let's call them "Attack points")

    Then you can very easily "direct" your attacking units to the wall segments "Attack points" via the "Set VECTOR" or "Set angle of motion to object" or similar functions

    Example image

    <img src="http://s10.postimage.org/prldiunx5/FAKE_BASE_LINE_EXAMPLE.jpg" border="0" />

  • Here is a technique for isometric sorting with any sized blocks:

    http://bannalia.blogspot.com/2008/02/filmation-math.html

    The concept is simple, take any two visually overlapping blocks and you can calculate which should be drawn first by comparing their positions and sizes in isometric coordinate space.

    The second part of it is a bit trickier, which involves sorting by that comparison. It's apparently a topological sorting problem but it can be thought of in a simpler way.

    1. Make a list for each block of the blocks that need to be drawn first.

    2. Keep track of what blocks have been drawn.

    3. Draw the blocks whose list contains only drawn blocks.

    4. repeat 2 and 3 until all blocks are drawn.

    EDIT:

    Here is a test:

    http://dl.dropbox.com/u/5426011/examples17/iso3.4.13.capx

    Sorting fails if any objects are overlapping in isometric space or if there is a loop of blocks that need to be drawn before each other.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for the time you guys spend to help with my problem.

    I'm mere an 3D artist so I'm trying to keep the game as simpler as i can. Math is not one of my best skills.

    mystazsea I think i got what your idea is and it sounds reasonable, but still i prefer using the z order plugin, it saves me a lot of headache.

    R0J0hound i tried several times to understand the tutorial you linked, before i post that question. Well I'm helpless :)

    Anyways i figure i can do this:

    <img src="https://dl.dropbox.com/u/19082408/WallCut.jpg" border="0" />

    Cut the walls in half horizontally. So the upper part covers the units behind the wall, and the lower is staying behind the units infront of it. Problem is that there should be no taller than the cutline units and sprites but i hope it wont be a problem.

  • i'm trying to make a similar game but drop and drag walls with touch and i'm having an issue with the walls being in front of or behind each other when dropped in place. i have read alot on it and looked at many post just cant figure out the best way to make an item go behind or infront of an another item so it looks like an iso wall.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)