Depth sorting - almost solved

For questions about using Classic.

Post » Fri Jan 29, 2010 2:14 pm

I'd just like to inform you all that ...... I SOLVED IT!!!!!!

I've still gotta tweak a few things mathematically till its as accurate as I would like, but it works EFFING BRILLIANTLY

Edit: However I have not been able to fix the family 'bug' when trying to sort a family of different objects
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Fri Jan 29, 2010 8:01 pm

Please. Please... please post how you did it.

I am saying please but what I really mean is "for the love of God and all that is holy I will twist off your head and throw it into the sun if you don't"

So... please? :D




Anyway, I'm sure any family picking issue can be solved with lucid's S plugin, since you can do the family picking trick with that too, only without families.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Jan 29, 2010 9:36 pm

[quote="Arcticus":1xjsxj0a]I'd just like to inform you all that ...... I SOLVED IT!!!!!![/quote:1xjsxj0a]
linky? the one you posted just before gives me HTTP 500
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sat Jan 30, 2010 1:00 am

Haha Deadeye

Here's the updated link guys
[url:2bzcrpaq]http://dl.dropbox.com/u/1289341/REALTEST.cap[/url:2bzcrpaq]

I realised the problem was that the sorting marker diamonds were moving down the Y axis as fast as the player was moving up the 'Z' axis. But in the perspective I'm using, the Y axis is 'squashed', so all I had to do was, instead of adding the ZHeight variable to the Y co-ordinate, I also had to multiply that ZHeight variable by the ratio of how much the Y axis is getting squashed if you get what I mean.
I still don't HAVE the accurate ratio yet, gonna ring up my mathy brother, i've just put a little hack-fix in at the moment, but it still works fine.

Oh also Deadeye could you explain how lucid's S plugin would hopefully fix this family thing? I actually think it's a problem in construct
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Sat Jan 30, 2010 1:14 am

*sigh*

Okay, so I guess my next question is... how do you do this in regular isometric?

Just the sorting algorithm is really all I'm interested in.

Is it this:

[code:1ew6wbfz]Layers.Bottom + Layers.Value('ZHeightBottom') + Layers.Value('ZHeight') - (Layers.Value('ZHeight') * 0.53125)[/code:1ew6wbfz]

Only instead of [color=#FF0000:1ew6wbfz]* 0.53125[/color:1ew6wbfz] at the end, you would have [color=#FF0000:1ew6wbfz]+ Layers.Y[/color:1ew6wbfz]? I don't know if I'm reading your post right.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Jan 30, 2010 1:18 am

I'm not too sure, I'm gonna try and knock up a quick isometric demo and see if I can apply the same or similar code to it. In pixel art isometric though, instead of 0.53125, you would probably just use 0.5

I also realised, I'm referencing from Layer.Bottom, it still works if you use Layer.Y there, in fact it doesn't seem to matter where I reference from, as long as EVERYTHING references from the same spot on the sprite
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Sat Jan 30, 2010 6:25 am

Holy crap... it works!

IT WOOOOOORKS! :shock:

http://dl.dropbox.com/u/529356/isometric.cap

I can't believe it. After a thousand years and a million sleepless nights, it actually, really works. In-friggin-credible.

Now I just have to make collisions work, heh :P


Awesome job, guys :D.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Jan 30, 2010 6:40 am

It's pretty good hey!
I've got my little iso demo to almost exactly where yours is.
It's still not 100%, if you sit halfway between some blocks and raise the height, there's a bit of overlap
Once I work out a few more things I -might- be able to fix that
I've nearly got some crappy collisions done too, but I'm just using 8 direction behaviour lol

Collisions should be reasonably easy for you, because you got the cool 4 directions going, I would just 'invert' the currently active movestate if overlapping an obstacle, assuming the zBottom and zHeight variables fall between the obstacle's respective variables too.
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Sat Jan 30, 2010 7:13 am

I also got a more accurate ratio type thing
Now my sorting code is:
+ System: For each Layers ordered by Layers.Bottom + Layers.Value('ZHeightBottom') + (Layers.Value('ZHeight') * (1 - (35.264 / 54.736))) Ascending
-> Layers: Send to front

For a 2:1 ratio like pixel art isometric, it would be:
+ System: For each ObjectName ordered by ObjectName.Bottom + ObjectName.Value('zBottom') + (Layers.Value('zTop') * (1 - (30 / 60))) Ascending
-> ObjectName: Send to front

The (1 - (30 / 60)) can just be replaced with 0.5, I just put it in there to show how it works.

The difference between the two is that I'm trying out using a true isometric view angle.
Still working on this overlap issue when standing between two blocks....
Still hating this family bug....

EDIT: Actually, with a bit of testing, this formula has a bit of overlap when walking on top of things hmmm......
EDIT 2: Ironically, I'm using a different view angle to 2:1 iso, yet the 2:1 iso sorting formula works perfectly?!
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Sat Jan 30, 2010 11:36 am

I can't make collisions it's veryhard :(

I will try again later :(
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

PreviousNext

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests