Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Tibia is a 2d game, but it's sprites are drawn using certain kind of orthographic projection that is not the same I'm used to:

test

I'm trying to figure out what projection is used here. I've guessed the following:

project(x,y,z) = (x-z/sqrt(2), y-z/sqrt(2))

It produces a circle very similar to that wheel, and alright cubes, but the spheres are not projected as perfect circles like the globe and the crystal ball on the picture above.

test test test

So which is the actual projection that game is using?

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

You guessed properly. The orthographic projection you came up with is the one used for most of the objects. You can tell because parallel lines in the X, Y or Z directions all become parallel lines, indicating that there is no perspective projection. Also, horizontal lines remain horizontal, meaning that X' does not depend on Y. Similarly, Y' does not depend on X. You empirically found the remaining values of the projection matrix.

As for the spheres, it's probably an artist's decision to render them as spheres instead of ellipsoids because they would otherwise look weird. The waterwheel aspect ratio is much more correct in that sense.

share|improve this answer
    
Thanks, but how do you know? Also, any clue on the projection used for the globe? –  Dokkat Dec 23 '12 at 14:42
    
Oh, I see. All good, though I'm still particularly curious as to why z/sqrt(2) worked so well. –  Dokkat Dec 23 '12 at 14:58
4  
@Dokkat sqrt(2) is not a coincidence and was probably chosen because it lets object boundaries fall on grid boundaries. Elevating an object one unit up in the 3D world will move it one grid cell left and one grid cell up in 2D. –  Sam Hocevar Dec 23 '12 at 15:02
    
@SamHocevar Do the maths again, sqrt(2) makes a unit in either axial direction have the same length on screen, but it doesn't fit any exact pixel boundaries. If you look at the rendered cube in the question this should be fairly obvious. –  eBusiness Dec 24 '12 at 14:09
add comment

I'd say that is mixed projection, indeed a lot of the items seem to follow the formula you describe, but with pre-rendered sprites one is not bound to follow one specific formula. I guess the creators simply thought that a non-round sphere looked stupid. Lots of 2D games is made with some mixed projection where stuff that looks stupid in the base projection is rendered in a different fashion.

Edit:
Actually, looking a bit further it seems that the projection varies from item to item, if you assume that the box to the right is as tall as it is wide, then it is around (x-1/3*z, y-1/3*z), but the water wheel and the house seems to be close to your suggestion.

share|improve this answer
    
Thanks, but, how do you know? Also, any clue on the projection used for the globe? (same comment as above) –  Dokkat Dec 23 '12 at 14:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.