Perspective tech demo

Post your own tutorials, guides and demos.

Post » Sun Aug 17, 2008 9:09 pm

Perspective tech demo is about making level from bricks of 3dBoxes. In this example there are shown 2 ways of achieving tiles looking like 3dBoxes:
:arrow: with 3dBoxes (of course)
:arrow: with skewed sprites imitating faces of cube

Readme file:
[code:2el5yc06]"Leo, why?"
This tech demo tries to solve problem of implementing 3d-looking terrain elements in game. By default, 3dBox would be good enough to take care of this, but there's also a way in using sprite skew.

What are those "sprite skew"?
In 3dBox there are 6 surfaces: front, back and 4 sides. This tech demo shows how to make effect looking similar to 3dBox: each "box" sprite (single tile) is provided with 4 "skew" sprites (skewRight, skewTop, skewLeft, skewBottom) that are scaling and skewing to imitate the 3dBox (back surface of 3dBox isn't imitated because it would be invisible all the time).

Profits of using "skew sprites" instead of 3dBox?
-> works faster
-> more control of depth (3dBox don't accept float numbers for depth)
-> can be animated (for example destroying terrain)

Todo for skewing tech demo (3dBox won't be updated):
-> Handling multiple objects (like complete tileset)
-> Correction of skew sprites Z-order
-> Handling background that's on the 2nd plane[/code:2el5yc06]

If you tried this demo please give some feedback. Thanks :).

Screenshot:
[url:2el5yc06]http://www.tymczasownik.republika.pl/perspectiveTechDemo1.png[/url:2el5yc06]

EDIT:
"ENTER" - creating objects
B
6
S
3
G
6
Posts: 219
Reputation: 3,013

Post » Sun Aug 17, 2008 9:45 pm

Not a bad demo, and I agree it is faster. Looks pretty slick. There seems to be some zsorting issues for some of the sides here and there (bottoms showing up above sides) but I'm sure that can be tweaked.

But this:

[quote="BROO":2uzv6ftt]
-> more control of depth (3dBox don't accept float numbers for depth)[/quote:2uzv6ftt]

Is just plain wrong. I'm able to put any decimal number I want into the depth, either in the IDE or at runtime.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Aug 17, 2008 9:49 pm

That's strange. I have problems with float numbers. When writing 0.6 or 0,6 or .6 or 0,6 it changes into "0,6" but then depth visible on Layout for this object goes "0". When I leave object and click on it again, there is depth set as "0". :(

Well, I'll try some more, maybe DirectX issue or Windows XP :).

Update:
Oh I get it. Writing float from Layout editor is impossible on my machine, but passing float numbers in Events works fine. Thanks Deadeye ^^.
B
6
S
3
G
6
Posts: 219
Reputation: 3,013

Post » Mon Aug 18, 2008 12:21 am

[quote="BROO":pywztc0v]
Update:
Oh I get it. Writing float from Layout editor is impossible on my machine, but passing float numbers in Events works fine. Thanks Deadeye ^^.[/quote:pywztc0v]

Well I guess that's good news and bad news, you should be able to enter decimal values in the layout editor as well. I wonder what's causing that to not work on your machine :? At least it works in events.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Aug 18, 2008 10:32 am

I've got the same problem. Can't type floats in the layout editor.
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Mon Aug 18, 2008 11:21 am

Me too. Seems like a pretty common problem. Maybe devs should investigate this?
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Mon Aug 18, 2008 7:12 pm

Broo's post suggests an explanation.
[quote="myself, commenting on the relevant bug on sourceforge,":jnfmj855]Brief experimentation shows that this problem happens when the user's Windows locale defines a decimal separator other than the point (which is either usually or always a decimal comma).

The edit boxes for depth and z "helpfully" replace any decimal points entered by the user with the separator defined in the locale (<-observed to be true up to here; hypothesis follows). It seems (and would make sense) that the function which reads the values from these boxes does not expect to have to do the reverse transformation; so instead of the intended decimal fraction, it reads the integer part and discards the rest (a comma followed by some numbers) as gobbledygook.[/quote:jnfmj855]
B
2
S
1
G
4
Posts: 60
Reputation: 1,320

Post » Mon Aug 18, 2008 7:58 pm

"," separator ruins everything. After changing into "." in settings panel it works fine. Thanks ^^.
B
6
S
3
G
6
Posts: 219
Reputation: 3,013

Post » Mon Aug 18, 2008 9:52 pm

Yeah, the layout editor doesn't seem to like commas being decimal separators, which is annoying. I'll try to fix it for the next build.

3D boxes are not yet fully hardware accelerated (they aren't nearly as fast as they could be). So for now, your tests will show up as skewed sprites being faster. This should change in a future build when 3D boxes are optimised.

Although skewing is a good alternative, you'll have some really tricky problems getting the Z ordering to work right with depth!
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Mon Aug 18, 2008 10:29 pm

Yes, but at the moment main advantage of skewed sprites is that they can be animated (useful for destruction of land), and 3dBoxes have fixed images.
B
6
S
3
G
6
Posts: 219
Reputation: 3,013

Next

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 1 guest