How Isometric Coordinates Work in 2D games

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 พ.ค. 2024
  • Isometric games often use hand-drawn 2D sprites to add depth to a game without having to deal with full 3D rendering.
    In this video, I cover how it works, the math you need to render isometric sprites on the screen, and how to find the isometric tile from a screen coordinate.
    0:00 Intro
    0:21 Orthographic projection
    1:16 Tiling a sprite
    1:40 Transforming tile coordinate to screen
    2:55 Accounting for sprite size
    3:39 Correcting offsets
    4:00 Transforming screen coordinate to tile
    4:46 Adding depth
    4:52 Outro
    Music: Snake Hips - Lucas Pittman (via epidemicsound.com)
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 672

  • @JordanWest
    @JordanWest  ปีที่แล้ว +598

    A few people have been asking for code and how to invert the matrix. Here's some (untested) code I've put together in TypeScript, although it should be similar in other languages. Hopefully this gives an idea of how the math translates to code.
    gist.github.com/jordwest/8a12196436ebcf8df98a2745251915b5

    • @rafaelrosafu
      @rafaelrosafu ปีที่แล้ว +5

      Thanks, the inversion was tricky to implement from the formula. The one thing I added was rounding the results from to_grid_coordinate(), but besides that it worked like a charm. Thanks for the interesting video.
      EDIT: spoke too soon, for some weird reason the Y from to_grid_coordinate() is off by 1, and I don't know why. I can hard code the fix, but it's ugly. Also, the multipliers on the code are all 0.5 and in the video some were 0.25. It works but the mismatch is disconcerting. I tried to change the numbers to match the video and the results are crazy.

    • @metallsnubben
      @metallsnubben ปีที่แล้ว +6

      @@rafaelrosafu If something's stored as an int somewhere and it's being divided, it will be rounded which could explain the error consistently being off by 1

    • @rafaelrosafu
      @rafaelrosafu ปีที่แล้ว +2

      @@metallsnubben good point, I'll double check. thanks.

    • @huutuantran4411
      @huutuantran4411 ปีที่แล้ว

      It now has 101K views

    • @JordanWest
      @JordanWest  ปีที่แล้ว +2

      @@rafaelrosafu Hmm not sure about the Y being off by one, but the 0.25 is after halving the iy and jy (to account for sprite size: 0.5 * 0.5 = 0.25). In the code above I left it unsimplified for clarity, but I suppose in doing that made it more confusing haha.

  • @isonzo686
    @isonzo686 2 ปีที่แล้ว +1288

    This is an incredible and polished explanation, going through the steps, the problems you face, and then how to solve it. It helps the viewer to reslly understand how we got to the final solution.

    • @TimSzabo
      @TimSzabo ปีที่แล้ว +1

      Well said!

    • @AshishXMC
      @AshishXMC ปีที่แล้ว

      I agree!

  • @woodlandcritterpunch
    @woodlandcritterpunch 2 ปีที่แล้ว +452

    This is the best type of tutorial. No fluff, no information that's potentially unnecessary, reference to where to find more information if it *is* necessary. I'd been trying to do this on my own with no help for two days (pride's a troublesome thing) and I'm glad to see it's not something super obvious that I was missing, but not daunting either. Thanks for the video

    • @JordanWest
      @JordanWest  2 ปีที่แล้ว +35

      That's awesome, so glad it helped :)

    • @pucciraskolnikov7266
      @pucciraskolnikov7266 ปีที่แล้ว +3

      I especially value such vibeos!

  • @yan-amar
    @yan-amar 2 ปีที่แล้ว +524

    This is such a great, high quality video, hitting just the right spot between learning and reference.

    • @foul-fortune-feline
      @foul-fortune-feline ปีที่แล้ว +1

      While remaining entergaging (/hj) as well!

    • @foul-fortune-feline
      @foul-fortune-feline ปีที่แล้ว +1

      (the /hj is the ironic use of the term, but the genuine meaning behind it)

    • @foul-fortune-feline
      @foul-fortune-feline ปีที่แล้ว +1

      (tho yk. ik that effective educational content is also entertaining haha. it's also very pretty~)

  • @uhitsethan
    @uhitsethan 3 ปีที่แล้ว +542

    Wow, I already knew all this, but this video is EXTREMELY polished. I especially like how you went through some potential problems people might run into while doing this, such as the offset. Well done!

    • @uhitsethan
      @uhitsethan ปีที่แล้ว +16

      ​@@marianmotorina chillax dude
      I said "i knew all this" to emphasize that I still got something from the video, even if the concepts were familiar. this is a compliment

    • @kingbroseph9773
      @kingbroseph9773 ปีที่แล้ว +6

      @@marianmotorina ratio bozo

    • @uhitsethan
      @uhitsethan ปีที่แล้ว +3

      @@kingbroseph9773 lol he really did go for it after a literal year

  • @dragonfire23141
    @dragonfire23141 3 ปีที่แล้ว +712

    I can't believe that this video only has 574 views with this amazing content.

    • @JordanWest
      @JordanWest  3 ปีที่แล้ว +101

      Thanks, and here I am amazed it's even getting a hundred views :)

    • @recker7017
      @recker7017 2 ปีที่แล้ว +27

      @@JordanWest you deserve much more than that

    • @UndeadAlv
      @UndeadAlv 2 ปีที่แล้ว +17

      I’m still amazed
      I’m sure it will blow up at some point

    • @foul-fortune-feline
      @foul-fortune-feline ปีที่แล้ว +20

      @@UndeadAlv f-four hours ago??? Is that a /j as in u came across it and it had 37k views as it did for me (and abt 1/10th as many likes)? Or did it seriously explode in _four hours??_

    • @michaelthornes
      @michaelthornes ปีที่แล้ว +10

      @@foul-fortune-feline well, we are all here right now

  • @wojtekpolska1013
    @wojtekpolska1013 ปีที่แล้ว +113

    I love how game developers create amazing things, when dealing with hardware limitations.
    isometric view was developed out of limitation, but turned out so appealing that its still used in indie games to this day
    PS: great video, its very well explained, i think the possible "errors" one might encounter when creating such view did the best job at explaining things to me. Too few people show possible errors you might encounter, and just say "you type this here, or it wont work"

  • @MonochromeWench
    @MonochromeWench ปีที่แล้ว +36

    Helped develop an isometric engine about 20 years ago. The 3d nature of isometric games can be surprising. It gets real fun trying to sort non tile aligned Arbitrary sized objects for display. Ordering can get real complex real fast especially if you get cyclic dependencies between objects.

    • @JordanWest
      @JordanWest  ปีที่แล้ว +14

      That sounds fascinating, I wonder at what point is it easier to just go to 3D? I guess there's always a tradeoff, especially if you want hand drawn sprites instead of rendering triangles.

    • @Electrk
      @Electrk ปีที่แล้ว +7

      this just makes me think of what a nightmare chris sawyer must've had with rollercoaster tycoon

  • @fabricionascimento2056
    @fabricionascimento2056 3 ปีที่แล้ว +84

    That’s the most concise and easy to understand video that I found on TH-cam about isometric grids!

  • @Jomity
    @Jomity ปีที่แล้ว +42

    I'm glad to see my linear algebra class is paying off now... haha
    But, this is an amazing video!! (almost even a tutorial it's so thorough)

  • @djmouton251
    @djmouton251 2 ปีที่แล้ว +17

    You just decided to drop an amazing tutorial out of nowhere ?
    I love how there's no code involved so it's applicable in any environnement we want, isometry rocks !

  • @dablackg
    @dablackg 3 ปีที่แล้ว +6

    that wavy isometric had me hypnotised, great vid!

  • @seiuwatches
    @seiuwatches 2 ปีที่แล้ว +2

    This is an amazing video, great job! Love the visualization and maths explained.

  • @mrxpcookie
    @mrxpcookie 2 ปีที่แล้ว +8

    This is wonderful, thank you for the clean explanation and resources.

  • @lukass7156
    @lukass7156 ปีที่แล้ว

    what an elegant explanation and visuals. great job Jordan!

  • @LoStFoReVeRiNtImE
    @LoStFoReVeRiNtImE หลายเดือนก่อน

    this one of my favorite videos of all time. It combines everything I love into one video. Applauds to you jordan! 👏 👏

  • @nanopi
    @nanopi ปีที่แล้ว +11

    I saw it done a different way before. Take a 2D grid, but every odd number of Y is shifted to the left half a space. When you want to move a particular direction, you'd want to check if the current Y position is odd or even and then decide whether or not to change the X value as well as decide whether to increment or decrement the Y value.

  • @noahthompson95
    @noahthompson95 ปีที่แล้ว +1

    I loved this video! It's a simple and quick explanation on how it works and leaves me satisfied. Great work!

  • @boris.karavasilev
    @boris.karavasilev ปีที่แล้ว

    Beautiful visualization and clear explanation!
    I am so happy to see an application of the math that I just learned in the linear algebra course at my university. Really cool!

  • @afs824
    @afs824 ปีที่แล้ว

    This is a fantastic video! I am working through this to render an isometric field step by step. Incredibly lucid description. Thank you!

  • @prathamjohari8301
    @prathamjohari8301 2 ปีที่แล้ว +1

    Bro i need more from you, the quality is top notch. Keep up the absolute amazing work

  • @retrx4236
    @retrx4236 ปีที่แล้ว

    this is extremely high quality and straightforward. I am amazed.

  • @SaladDongs
    @SaladDongs ปีที่แล้ว +1

    I'm going to go ahead and call this the "perfect" illustrative video. Sentences spaced out perfectly, tone of voice is clear and just right, visuals are top-notch, language is simple enough to be understood by a layman but not dumbed down. No awkward pauses, background music not intrusive, the visualization of the problems one might face is really, really smart. The video is quite short but concentrated. I can't find a single flaw. I'm definitely going to study this next time I try to explain something whether in class or otherwise. Have a great day!

  • @miniasriel9951
    @miniasriel9951 ปีที่แล้ว +3

    I've been out of typical schooling for a while, and honestly this made me remember how much I enjoyed math and liked being able to see how numbers work when previously not being able to work it out. Lovely video - very informative in more ways than its original purpose, overall edited and make concisely, along with a nice calming voice leading you through aptly.
    An enjoyable experience - cheers.

  • @balorprice
    @balorprice 3 ปีที่แล้ว +2

    That was a gorgeous piece of education you just put together. Bravo!

  • @juliangabrielalvarez7642
    @juliangabrielalvarez7642 3 ปีที่แล้ว +2

    This is superb, I would love to know more about this! Great job man

  • @mazio_os
    @mazio_os ปีที่แล้ว +1

    This is great timing! I was just thinking of making an isometric adventure game of my own.
    Praising the TH-cam algorithm aside, your scripting and editing is great and I feel like you gave the perfect amount of information.
    Instant subscribe :)

  • @1xCorr
    @1xCorr ปีที่แล้ว

    I love your editing style, such a great tutorial!

  • @nikitosha1000
    @nikitosha1000 2 ปีที่แล้ว +1

    Oh GOD that video is so good! Thank you a lot, Jordan! Always wondered how to do this effectively

  • @justbodewes
    @justbodewes ปีที่แล้ว

    This video is exactly what I needed! I’m working on an isometric project and was having trouble with the tile picking formula. Can’t thank you enough!

  • @CoolExcite
    @CoolExcite ปีที่แล้ว +44

    3:35 how are the occlusions being handled here? Like when 2 sprites partially overlap how do you determine which one is drawn in front when they don't have z coordinates?

    • @JordanWest
      @JordanWest  ปีที่แล้ว +34

      In this animation the sprites are simply rendered from back to front, left to right. Often you can get away with sorting by the screen y coordinate

    • @Allen-R
      @Allen-R ปีที่แล้ว +1

      @@JordanWest oh *nice*

  • @taytheprodigy4388
    @taytheprodigy4388 2 ปีที่แล้ว +1

    absolute godly tutorial, very detailed and dynamically useful

  • @franciscocardoso5819
    @franciscocardoso5819 3 ปีที่แล้ว +4

    Awsome content!!! Keep it up! :D Really well explained, love the fact you showed how it would look like in each step! Kudos!

  • @zmbp
    @zmbp 2 ปีที่แล้ว +4

    Wow, I vaguely knew the translation before, but never understood why. This so perfectly illustrates the problem and solution!

  • @irgendwer3610
    @irgendwer3610 ปีที่แล้ว +3

    I like how you show the problems you could face before getting to the completed code, that gives a lot of insight on this sort of thing

  • @aijc
    @aijc 2 ปีที่แล้ว +1

    This is such a great video, your channel deserves a lot more attention!

  • @zzzergling1079
    @zzzergling1079 ปีที่แล้ว

    Holy cow that was so cool explained. Even with such easy task, each step error explanation with showcase! Wow

  • @sanderbos4243
    @sanderbos4243 2 ปีที่แล้ว +1

    Awesome explanation! This is a great introduction to matrices

  • @metgaming9545
    @metgaming9545 ปีที่แล้ว

    I’ve tried making isometric stuff before, but this explains its EXTREMELY WELL. Thank you!

  • @Gallowtown
    @Gallowtown 2 ปีที่แล้ว +2

    really relaxing and informative, amazing content

  • @anirudhchandrashekhar8938
    @anirudhchandrashekhar8938 2 ปีที่แล้ว +1

    Amazing content :) can’t wait for your channel to blow up. Thanks for the good work

  • @mrtaufner
    @mrtaufner ปีที่แล้ว +8

    I don't know why I was suggested this, but it is certainly a great explanation.
    Reminded me of why I hated matrixes so much, but still, it was pretty simple to understand

  • @McStebb
    @McStebb ปีที่แล้ว

    This is the single most useful isometric tutorial I've ever seen. I will definitely be referencing this a lot.

  • @rostkgb
    @rostkgb ปีที่แล้ว

    pure simple. well done explaining, thanks

  • @theillegaltaco6
    @theillegaltaco6 ปีที่แล้ว

    Really underrated video, it tells you enough to understand whats going on but not so much that you feel overwhelmed.

  • @Niker107
    @Niker107 2 ปีที่แล้ว +2

    This channel looks like it's gonna blow up soon, and I'm all here for it :)
    Awesome tutorial, and I love the presentation style.

  • @Johxzu
    @Johxzu 3 ปีที่แล้ว +1

    Well-made and informative video, thanks!

  • @reitokenvideogamecreation7655
    @reitokenvideogamecreation7655 9 หลายเดือนก่อน

    really good vidéo :D fun to see each result !!!

  • @litlclutch
    @litlclutch ปีที่แล้ว

    This was a great rundown on isometric games setups ...

  • @blitzkreg335
    @blitzkreg335 11 หลายเดือนก่อน

    I've been struggling the whole week and only found this video now. Thank you !

  • @jyke321
    @jyke321 ปีที่แล้ว +2

    I'm currently working as a teaching at a summer camp as Teaching Assistant and love how simply you explained isometric coordinates with linear algebra. I would love to teach it to my kids, but the camp is only three weeks long, and we just introduced objects recently, but maybe if time permits, I can at least give them the formula and show them how it works in the final week.

  • @ipaqmaster
    @ipaqmaster ปีที่แล้ว

    This is really good edutainment. I hope your channel soars Jordan. This is the kind of content modern TH-cam needs more of.

  • @furcob
    @furcob ปีที่แล้ว

    This is an incredible and polished explanation

  • @PedroSilva-rc6ns
    @PedroSilva-rc6ns 2 ปีที่แล้ว +1

    This is just fantastic. Thank you Jordan.

  • @ihateevilbill
    @ihateevilbill ปีที่แล้ว +6

    Thank you! One of my favourite games when I was a kid was called Utopia (on the amiga) and as a developer I always wondered how they programmed the layout.
    I decided never to try it as I had no idea where to start (other than google). But this video gave me enough information that I can now imagine the solution in my head.
    Thats very much appreciated.

  • @pilotharibo5410
    @pilotharibo5410 ปีที่แล้ว

    great vid
    definately deserves way more attention

  • @CYON4D
    @CYON4D ปีที่แล้ว

    Definitely one of the best videos on the subject.

  • @MrOnlineCoder
    @MrOnlineCoder ปีที่แล้ว

    Amazing video. And I always being amazed how linear algebra has so many uses in video games and multimedia in general

  • @alessandromangiapia7082
    @alessandromangiapia7082 2 ปีที่แล้ว +2

    Immediate like for this channel. You are explaining like a boss!

  • @m.a8335
    @m.a8335 2 ปีที่แล้ว +1

    TH-cam needs more videos like this and you deserve way more views.
    Thanks!!!

  • @Maraus92
    @Maraus92 ปีที่แล้ว

    Exactly what I needed to build my engine, thanks!

  • @cadeleighty6595
    @cadeleighty6595 2 ปีที่แล้ว +2

    This is an amazing resource for me! thank you for making such well a explained video, i'm in your debt!

    • @JordanWest
      @JordanWest  2 ปีที่แล้ว

      Thanks for the kind words, glad you found it helpful!

  • @VoidFame
    @VoidFame ปีที่แล้ว +5

    This is a great video. Just showing the process of trial and error very quickly with no fluff you were able to get through the topic very quickly and instructively.
    The only slight error is the term: 1/(ad-bc) is not the determinant, but the reciprocal of the determinant. It might seem a bit nitpicky, but it would be like calling 1/2 the number "2"

    • @JordanWest
      @JordanWest  ปีที่แล้ว +4

      Ah good catch, thanks

    • @TheBlissfulVoid
      @TheBlissfulVoid ปีที่แล้ว +2

      you're the type of guy to correct Albert Einstein, and be right

  • @hamakawa9453
    @hamakawa9453 ปีที่แล้ว

    It was on my suggestion list of TH-cam but it turned out amazing I really love it and it got an idea to try with different things, thank you.
    Plus I like and subscribed.

  • @Akari_202
    @Akari_202 ปีที่แล้ว

    That was a really great explanation of a problem I didnt realize existed but makes a ton of sense!

  • @DCaseyTucker
    @DCaseyTucker ปีที่แล้ว

    This is a really good explanation. I have been building something like this for the past month or so and just came across this video.

  • @omaryahia
    @omaryahia ปีที่แล้ว

    amazing ! I really like aubjects like this, math , geometry , logic , visuals

  • @MrGr33n_
    @MrGr33n_ ปีที่แล้ว

    Well made video, easy to understand. Please make more video like that.

  • @seenPunktSee
    @seenPunktSee 2 ปีที่แล้ว +5

    I just love that this video perfectly matches my youtube search and with such quality content. thanks man

    • @JordanWest
      @JordanWest  2 ปีที่แล้ว +1

      I love that your search perfectly matches my video :) glad it helped!

  • @antonionotbanderas9775
    @antonionotbanderas9775 หลายเดือนก่อน +1

    I only understood about half of this video but it's already answered a lot of questions I had about 2.5D games.

  • @ITSJTG58
    @ITSJTG58 2 ปีที่แล้ว +1

    Amazingly well done!

  • @smoothbraindetainer
    @smoothbraindetainer 2 ปีที่แล้ว +4

    You just tricked 35 thousand people into learning change of basis good job

  • @NowKnownMAWO
    @NowKnownMAWO ปีที่แล้ว

    Very well done video!
    With such high quality content you deserve more subs :)

  • @cartler
    @cartler ปีที่แล้ว

    This is a simple, great explanation!

  • @LowtechLLC
    @LowtechLLC ปีที่แล้ว

    Thank you! This was a great explanation

  • @motbus3
    @motbus3 ปีที่แล้ว

    well well well seems youtube has recommendes me a great channel this time! the explanation was great! thank you!

  • @decencyman4552
    @decencyman4552 ปีที่แล้ว

    Phenomenally helpful.

  • @ShunyValdez
    @ShunyValdez ปีที่แล้ว

    I'm so happy the TH-cam algorithm recommended your video to me. I've liked and subscribed!

  • @MatheusFreitasOrangeMaths
    @MatheusFreitasOrangeMaths ปีที่แล้ว

    Incredible, i love content that shows how maths apply in the context of programing.

  • @ccgarciab
    @ccgarciab 2 ปีที่แล้ว

    Concise, clear and nice looking

  • @armagedonthe1gamer
    @armagedonthe1gamer ปีที่แล้ว

    honestly this is really good content. even though the aim is supposed to be informative, this is really entertaining. excellent script writing and visuals! would expect this type of content from a 1million subscriber youtuber. now its time to get you there.

  • @mgames3209
    @mgames3209 ปีที่แล้ว

    This is a very good video and extremely polished

  • @folkusonme
    @folkusonme 2 ปีที่แล้ว

    this is so informative !
    love

  • @Blue-Maned_Hawk
    @Blue-Maned_Hawk ปีที่แล้ว

    Wonderful! Thanks for this.

  • @Zanytiger6
    @Zanytiger6 ปีที่แล้ว

    Crazy how simple it seems!

  • @Tom-lz9pu
    @Tom-lz9pu ปีที่แล้ว

    I just found this because we have to make a 3d project for uni... and this is super well explained and really well made! Thanks for the quick and amazing explanation

  • @leonoliveira8652
    @leonoliveira8652 ปีที่แล้ว

    Hey, a good part of the math on doing the tiled grid is done here, this is amazing! Thank you, I need to get back into dragonruby and make an isometric map eventually!

  • @NapkinDictator
    @NapkinDictator ปีที่แล้ว +1

    Thank you so much! I was hoping to find a good way to explain how isometric projection works for making a tactical rpg fangame

  • @A.I.Office
    @A.I.Office ปีที่แล้ว

    i love the explanation, I'm a CS student and your video helped me finally understanding reversed matrixes!

  • @dudedude5035
    @dudedude5035 ปีที่แล้ว +1

    I will definitely need this when I start programming soon
    Thank you so much

  • @notveryobservant1056
    @notveryobservant1056 ปีที่แล้ว

    This is really helpful, thank you!

  • @samieb4712
    @samieb4712 ปีที่แล้ว +1

    in 2 minutes, this makin me feel inspired to make a new iso-game. this is the ideal youtube video :) a quick dose of motivation

  • @friendlyfripptit2228
    @friendlyfripptit2228 ปีที่แล้ว

    this was so good I have to watch it again

  • @Mephil
    @Mephil ปีที่แล้ว

    Holy shit, I've been trying to find the name of Mystic Towers for years, knowing that I played a game like it as a child. I couldn't remember the name or even exactly what it looked like and here you are just casually showing a clip from it with its name and release year! The search is finally over, thank you!

  • @pixerpinecone
    @pixerpinecone ปีที่แล้ว

    Although I didn’t really need this for anything, you explained this well, good job 👍

  • @ProQuigley
    @ProQuigley ปีที่แล้ว

    Wonderful animations and math application

  • @paranoidpumpkin98
    @paranoidpumpkin98 ปีที่แล้ว +1

    The cube wave looks so satisfying

  • @N3V3L
    @N3V3L ปีที่แล้ว +1

    Very nice explanation , thanks a lot! :)

  • @Kingtut101
    @Kingtut101 2 ปีที่แล้ว +1

    This video was great. I helped me a lot!

  • @erz3030
    @erz3030 2 ปีที่แล้ว

    Cool quick little tuto, thanks for sharing m8!