On coordinate systems

Here’s a little rant on left vs right handed coordinate systems.

Survivalcraft up to version 1.27 used XNA as rendering engine. If you ever did any 3D coding you probably know that XNA is hardcoded to use a right-handed coordinate system. All my previous 3D experience was with left-handed systems.

Here’s what I am talking about:

Coords.png

Notice how you can get the second right-handed system by rotating the first one by 180° around Y axis. They are the same systems really. You can never get a left-handed system from right-handed by rotations only. You need to flip it. That’s why there are two kinds of coordinate systems in 3D.

I thought (as most people do) that it’s purely a matter of convention and you can get used to one or the other. But after over 4 years of work on Survivalcraft, which uses right-handed coords I figured I am not and will probably never be comfortable with right-handed coordinate systems. They are counter-intuitive to me.

Here’s why, axis by axis.

Up/Down Axis (often called Y, sometimes Z):

This is the simplest one. Increasing values should go up. No questions. It’s dictated by gravity we are all used to. It would be like having an altimeter in an aircraft that shows smaller values the higher you go. Imagine being a pilot trying to get your head around it.

Near/Far Axis (often called Z, sometimes Y):

Increasing values should go far. This is less obvious, but I think most people would agree that the further something is, the bigger the coordinate value should be. It’s like a distance. The other way has an issue if the observer is at the center of the coordinate system (a very common case): you must use negative values for something that is in front of you. No doubt it is more intuitive to have negative values for something that is behind, not in front!

Left/Right Axis (pretty much always called X)

Increasing values should go right. This is the least obvious axis. The preference for right direction comes from western culture of writing. Of course there are other methods of writing that go the other way, mostly originating in Far East. But there is no doubt that when you are a programmer (Chinese, Korean, American, it does not matter) and are looking at a computer screen, you know that horizontal zero coordinate is at the left side of the screen, and increasing the coordinate will move it right. It is a convention ingrained over decades. TVs scan left to right. Even oscilloscopes scan from left to right.

Now where does this leave us? If we adopt the most intuitive axis directions as described above, we get this coordinate system:

LhCoords.png

And it is left handed. Left handed FTW!

Finally comes the biggest disadvantage of right-handed systems. If for some reason you think that right handed system is good for you, it’s not obvious which one (assuming we keep the Y axis pointing up):

RhCoords.png

Either you flip X or Z axis.

Furthermore, once you convert your right-handed coordinates to screen space, you are back at left handed system. Therefore, you need to constantly switch between left and right handedness depending with which space you are working with. Confusion!

To me, it’s a nightmare. I cannot reason in a right-handed system. I cannot visualise anything in my head. I have to draw it and mark the axes directions first. It’s much slower than having it all in my mind.

Since version 1.27, Survivalcraft uses a custom engine for rendering. When working on it I did not switch the coordinate system from XNA right-handed one. I had enough other issues to worry about :-) So sadly the game still uses a right-handed coordinate system. And don’t ask me which one, I am so confused I don’t know myself! It’s probably different systems in world space, different in view space and different still in screen space…

But one day I think I will switch the entire engine and the game to left-handed where there’s only one obvious way!

Btw. This rant is purely subjective and not entirely unbiased. For example a lot of 3D modelling programs (and top-down view games) use Z as up-down axis. The above reasoning does not apply to them.

 

 

 

70 Comments

  1. Posted May 14, 2016 at 19:09 | Permalink | Reply

    I don’t understand D:

  2. Posted May 14, 2016 at 19:21 | Permalink | Reply

    So… What would happen if On Coordinate System ingame will be changed into “Left-handed”?

  3. Posted May 14, 2016 at 19:30 | Permalink | Reply

    I agree with you. Y is up/down in 2D so it should be so in 3D. Simple.

  4. Posted May 14, 2016 at 20:14 | Permalink | Reply

    So glad u finally posted something Kaalus. I want to know. After this update, can the next one add alot more food options? And a fishing pole and/or net? It would really imcrease the incentive for killing large predators other than just so they don’t kill me. And I would have a reason to actually fish cuz it would be more efficient. Can’t wait for this update btw.

  5. Posted May 14, 2016 at 20:21 | Permalink | Reply

    When are we gonna get a video Kaalus?
    Are you almost ready to make one or is there more you have to do?

  6. Posted May 14, 2016 at 20:40 | Permalink | Reply

    This is completely over my head

  7. Posted May 14, 2016 at 20:55 | Permalink | Reply

    i think he’s giving us an indication that he’s still alive, so that we don’t think he quit the game or something, in the form of an over-most-peoples-heads article

  8. Posted May 14, 2016 at 21:01 | Permalink | Reply

    The right-handed system does sound unnecessarily difficult.

  9. brythok
    Posted May 14, 2016 at 22:28 | Permalink | Reply

    I’m gunna try n learn some 3D soon w/ java. I’m trying to master 2D first tho

  10. Posted May 14, 2016 at 22:55 | Permalink | Reply

    From what I read above, it seems like the two right-handed systems are the same except one is handling surface mapping /textures as if they are being applied on the “outside” of a box, and the opposite type is mapped like applying textures to the “inside” of the same box – is that correct?

    I appreciate all of the time and effort that has been put into SC and I think the following is so large because you can build just about anything and you can share what you created with others. I don’t want to debate Survival vs. Creative (i.e. Players vs. Builders) you have done a fine job of using feedback & requests in your updates and decision process. I hope the audience only expands as time goes on.

    Working with Developers, it usually comes down to opportunity cost. You could: (1) expand your features, delight your users or fans, and continue adding new code, or (2) you can go back, do some refactoring, solve those nagging issues that have made it difficult to push forward with the next set of cool features. You cannot do both, simultaneously, so you have to give up something in order to deliver something else. Your users may never fully understand the issues with the coordinate system, or appreciate the improvements to the rendering engine. But I get that dilemma, and think you’re right to ask the question, whether to strengthen the foundations of SC first, or whether to land sweeping changes to the app, knowing that it will mean more extensive cleanup / refactoring in the future.

  11. josmile
    Posted May 15, 2016 at 02:17 | Permalink | Reply

    Kaalus, I know what you mean. Minecraft is the same, it annoyed me that traveling northward is in the negative direction.
    Survivalcraft has not been an issue as I don’t even know how to bring up the x, y, z.

    • Posted May 16, 2016 at 02:02 | Permalink | Reply

      It’s on creative only.
      You click the back arrow which will bring you to the menu with the QUIT and RECIPEDIA options.
      Above that, where it says you been alive # days it will say your coordinates are 1111,1111 at altitude 11.

  12. Posted May 15, 2016 at 02:18 | Permalink | Reply

    Let’s hope a major update is soon…

  13. Posted May 15, 2016 at 03:47 | Permalink | Reply

    YAY LOOK WHOS BACK

  14. Posted May 15, 2016 at 04:28 | Permalink | Reply

    I’m that kinda guy who reads complicated posts and pretends to know what it’s about. Yeah kaalus! I totally agree, trump should be deported!

    • Posted May 15, 2016 at 15:46 | Permalink | Reply

      What do you have against trump?

      • Posted May 16, 2016 at 02:58 | Permalink | Reply

        My guess is he/she knows little (if anything) about Trump, but instead just jumped on the bandwagon.

      • brythok
        Posted May 18, 2016 at 22:04 | Permalink | Reply

        Let me think…
        Everything he said that degraded women, he wants to build a wall and make Mexico pay for it, he often attacks other politicians, all of his racist remarks, did i forget anything?

      • Posted May 19, 2016 at 18:20 | Permalink | Reply

        I live in the UK and here he is a complete joke. There was a petition that you may or may not be aware of to ban him from entering the UK. It has 585,732 signatures. Nobody takes him seriously.

        • Posted May 21, 2016 at 04:48 | Permalink

          It’s because UK has almost no republicans compared to the US. He’s a joke to you because you aren’t republican, therefore you hate his ideas. A lot of his ideas still aren’t republican and just came out of nowhere to be fair though. I personally hate all the candidates though. Trump hates too many types of people, Bernie will single handedly crash the economy, and Hillary is unpredictable in all cases.

        • Posted May 21, 2016 at 06:28 | Permalink

          The UK’s politics is very left wing compared with the US. At the moment one potential prime minister is Jeremy Corbyn. He wants to renationalise the railways. Our main right wing party, The Conservatives, just about line up with your left wing party, The Democrats. I’m not trying to be rude here, but how does not getting free healthcare actually work? If you don’t have enough money do you just die? Having always had the NHS, it seems really strange to contemplate it’s non-existence. Our NHS is not in a good state at the moment; some areas are being privatised.
          Why are we even talking about politics on a blog about SC? This happened before when someone made a giant picture of Obama’s face in SC and posted a picture of it.

  15. Posted May 15, 2016 at 04:32 | Permalink | Reply

    Kaalus, did you go to college to be a game designer? If so, what college? I’m aiming for itvas a major in a few years.

    • brythok
      Posted May 18, 2016 at 22:06 | Permalink | Reply

      Just go for computer science somewjere half decent. You dont need to be a genius to make a popular game in todays world, or at least to make good money.

  16. Posted May 15, 2016 at 04:52 | Permalink | Reply

    And where were you for so long mister?

  17. Posted May 15, 2016 at 05:55 | Permalink | Reply

    I can only understand half of this post(not that it’s bad grammar)

  18. Posted May 15, 2016 at 06:03 | Permalink | Reply

    “Here’s a little rant…” that wasn’t a LITTLE rant.

  19. Posted May 15, 2016 at 15:00 | Permalink | Reply

    he smacked us with all this science to satisfy our impatient selfs.

  20. Posted May 15, 2016 at 16:06 | Permalink | Reply

    Using the right handed thing would make me go crazy.

  21. Posted May 15, 2016 at 19:31 | Permalink | Reply

    How can any of you say this is over your head. This is just about the simplest idea i’ve ever heard, It is not complicated whatsoever. Like seriously what is so confusing

    • Posted May 16, 2016 at 02:56 | Permalink | Reply

      Calm down. I don’t understand why you feel the need to go online and yell at little kids. Looks like everyone has questions that need answered.

  22. Posted May 15, 2016 at 23:56 | Permalink | Reply

    Well, I have no clue of what this is. And I thought the z axis was always up?

    • Posted May 20, 2016 at 10:58 | Permalink | Reply

      That’s his problem. He wants Y to be up. Minecraft is right handed – the X-Y is used for maps, leaving Z for height. I think the difference is LH is more math/sciencey and RH is more engineeringy.

  23. Posted May 15, 2016 at 23:57 | Permalink | Reply

    Never mind, just checked your post again.

  24. colepanzer
    Posted May 16, 2016 at 01:26 | Permalink | Reply

    Furniture? Glad you’re still alive and reforming in-game coordinates, but how is the furniture going?

  25. Posted May 16, 2016 at 02:07 | Permalink | Reply

    Left handed definitely makes sense.
    I like math and the left handed system is what is used in plane geometry so it is what makes more sense to me.

  26. Posted May 16, 2016 at 15:50 | Permalink | Reply

    METH confuses me but the furniture thing or custom blocks something I wanted to know how to make blocks out of it
    Is it mini blocks by mini blocks

  27. Posted May 16, 2016 at 17:11 | Permalink | Reply

    Would more generated structures be too difficult?

  28. MTB adventures/RCs to the limit
    Posted May 16, 2016 at 20:49 | Permalink | Reply

    Nice that you are back. I don’t speak coding and neither does Google translate. :)

  29. Posted May 17, 2016 at 09:11 | Permalink | Reply

    Simple.. Make your own more intuitive one. Maybe even remap the right handed one to fit your needs. It should be written in C. Your a very resourceful man.

  30. Posted May 17, 2016 at 20:31 | Permalink | Reply

    How about a, b and c axes?

  31. Posted May 18, 2016 at 02:44 | Permalink | Reply

    😄

  32. Posted May 18, 2016 at 11:10 | Permalink | Reply

    Thought we defeated the Axis …

    • brythok
      Posted May 18, 2016 at 22:08 | Permalink | Reply

      I love you now. Were best friends.

  33. Posted May 18, 2016 at 12:56 | Permalink | Reply

    Wut

  34. Posted May 18, 2016 at 14:29 | Permalink | Reply

    Kaalus / SurvivalCrafters,
    Ever play “Block Fortress” where there the computer sends enemies to attack your base in a block world environment? It would be awesome it Kaalus incorporated this game mechanic into the game. Like if you have a chest(s) in the game, wild natives will attempt to break into and steel items. I don’t see how this would be difficult to add as he already has pathfinding capabilities, all he would have to add are wild natives that go after chests instead of meat.
    What do you all think? It definitely add a new layer to the survival mechanics and have us also work on defense.

    • Posted May 19, 2016 at 16:33 | Permalink | Reply

      Block Fortress is a good game but I don’t think this really fits with SC.

      • Posted May 21, 2016 at 14:21 | Permalink | Reply

        I beg to differ. The game gets all to easy, even in cruel, when you’re built up and safe behind walls with plenty of resources. I’m not saying to include the crazy waves of enemies our the shear mass numbers, but rather the ossasional attack of a few natives after your resources/chests, wherever they may be located.

  35. Posted May 19, 2016 at 16:28 | Permalink | Reply

    Cmon Kaalus!!!! 1 post a day keeps Kallus’s extremely annoying fans away!

  36. Blocky Warrior
    Posted May 19, 2016 at 23:03 | Permalink | Reply

    Hang in there, Kaalus! : )

  37. Posted May 21, 2016 at 01:56 | Permalink | Reply

    My first icon change since I first started posting here.

  38. Posted May 21, 2016 at 03:27 | Permalink | Reply

    Lol he disappars for months.. then starts ranting about something having nnothing to do with the update.. or at least does not say it has anything to do with it. This is getting so boring. I just want multiplayer and ill be happy. I don’t give 2 bleeps about anything else really…

  39. Posted May 21, 2016 at 03:29 | Permalink | Reply

    Heck im willing to pay Kaalus with an extra inapp purchess for it.. if he decides to go that route…

  40. Posted June 30, 2016 at 09:26 | Permalink | Reply

    My brain hurts

  41. Posted September 27, 2016 at 04:52 | Permalink | Reply

    When I will get the new version?

  42. Posted September 27, 2016 at 04:53 | Permalink | Reply

    I’m waiting from very long ago! My friends have left playing SC because of no New Version released!

  43. Posted September 27, 2016 at 04:56 | Permalink | Reply

    I have crated human mod in sc!

  44. Posted January 9, 2017 at 11:53 | Permalink | Reply

    Hi Kaalus, can you add a part of vehicle? I want to make a car on my city progres later 😊

Leave a Reply. No swearing please.

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s