Isometric

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Isometric

Post by Zilarrezko »

Can't remember if I posted something like this before, but if I did I probably would have my answer.

Anyone know any good methods for isometric view? Kinda like Diablo 1, or XCOM. I think the tutorial thing on the wiki is just for more like a face forward type deal.

I think I achieved the look before somehow... But it involved skewing and a lot of jazz hands to get it to look isometric from a basic grid. Which might be difficult if I wanted to draw something that wasn't a grid it'd be contorted.

I'm not really sure how to approach it. I though I could just have every tile, like in a sprite sheet be in that kind of diamond shape and just do some manual offseting in x and y to line them all up.

Then comes the question of drawing things behind the other. I'd guess that I could do a table sort on everything (entities and map and the like [may forsee a problem with having to get agents to draw in front of some tile pieces and behind some others. So I may have to put them in the same table O.o that would at least be my idea of a fix...]).

The more I think of a problem, and my probable way of fixing and implementing, the more I think I'm just going to make it run so over engineered that it would be unplayable when drawing just like 80 tiles :|.
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Isometric

Post by ivan »

Zilarrezko wrote:I'm not really sure how to approach it. I though I could just have every tile, like in a sprite sheet be in that kind of diamond shape and just do some manual offseting in x and y to line them all up.
Take a look at:
http://2dengine.com/doc_1_3_10/gs_isometric.html
and
http://2dengine.com/doc_1_3_10/gs_tiling.html
Zilarrezko wrote:Then comes the question of drawing things behind the other. I'd guess that I could do a table sort on everything (entities and map and the like [may forsee a problem with having to get agents to draw in front of some tile pieces and behind some others. So I may have to put them in the same table O.o that would at least be my idea of a fix...]).
Generally, this is a question of iterating the map in starting from the top rows going down.
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: Isometric

Post by Zilarrezko »

It's a bit more complicated than I thought implementing this...

It'll take me a while, having to scrap stuff and the like. But thanks for the tutorial!
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Isometric

Post by Karai17 »

If you check out my STI library (linked in my sig), I have code that takes an orthogonal grid and renders it isometrically. Perhaps that'll be useful to you.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: Isometric

Post by Zilarrezko »

Karai17 wrote:If you check out my STI library (linked in my sig), I have code that takes an orthogonal grid and renders it isometrically. Perhaps that'll be useful to you.
Maybe. Not sure what a tiled library would do for me, since I won't be using tiled. And I'm not sure how orthogonal grid to isometric would be handled for graphics, although I'm sure that would be fine.

I'll check out the source code... Where is the orthogonal to isometric part in your repo?
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Isometric

Post by Karai17 »

The code isn't Tiled-specific, it simply translates Isometric space to/from Screen space.

https://github.com/karai17/Simple-Tiled ... p.lua#L937
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: Isometric

Post by Zilarrezko »

ivan wrote:
Zilarrezko wrote:I'm not really sure how to approach it. I though I could just have every tile, like in a sprite sheet be in that kind of diamond shape and just do some manual offseting in x and y to line them all up.
Take a look at:
http://2dengine.com/doc_1_3_10/gs_isometric.html
and
http://2dengine.com/doc_1_3_10/gs_tiling.html
Zilarrezko wrote:Then comes the question of drawing things behind the other. I'd guess that I could do a table sort on everything (entities and map and the like [may forsee a problem with having to get agents to draw in front of some tile pieces and behind some others. So I may have to put them in the same table O.o that would at least be my idea of a fix...]).
Generally, this is a question of iterating the map in starting from the top rows going down.
I'm having some trouble with recognizing the mouse over a tile in diamond (haven't tried staggered). I'm not sure what the problem is, it would probably help if I knew what was going on. The link to that source code showed some behind the scene camera magic. Or maybe I'm wrong and I straight up don't know what I'm doing.

Here's my project so far, it's very very messy. Where I implemented the selecting tile with mouse is map.update in the map.lua file.
nameless.love
(202.23 KiB) Downloaded 123 times
I'll continue to try and get this to work. I'll let you know if I fixed it so you don't have to go through trouble.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Isometric

Post by Karai17 »

At the very bottom of map.lua in sti, there are functions that convert world space to and from screen space.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: Isometric

Post by Zilarrezko »

Karai17 wrote:At the very bottom of map.lua in sti, there are functions that convert world space to and from screen space.
oh... I was.. talking... about... Ivan's tutorial >.>
<.<
>.>
:|
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Isometric

Post by ivan »

Zilarrezko wrote:I'm having some trouble with recognizing the mouse over a tile in diamond (haven't tried staggered). I'm not sure what the problem is, it would probably help if I knew what was going on. The link to that source code showed some behind the scene camera magic. Or maybe I'm wrong and I straight up don't know what I'm doing.
A couple of things about the code that converts mouse position to tile index:
-it's designed to work with tiles tilted at 30 degree. in short "atan(tile_width/tile_height)" should equal 30
Image
-for diamond ordering (mx, my) the "mouse position" needs to be in "map coordinates" where the origin (0, 0) is the center of the left tile in the diamond

Image
-lastly, they Y axis increases in the up direction whereas in Love2D the Y axis increases down so keep that in mind with things like "my = math.ceil(-ty/tile.width)"
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 162 guests