![]() |
|
Isometric madness |
DanielH
Member #934
January 2001
![]() |
During game play all I have to do is keep track of the very top tile. And adjust around it. |
Irrelevant
Member #2,382
May 2002
![]() |
What I do is store them thus: 00 01 02 03 04 10 11 12 13 14 20 21 22 23 24 30 31 32 33 34 40 41 42 43 44 & draw them like this (from memory):
I think that's how I do it, anyway. Not sure... [edit: Hideously wrong. I apologise. <code>//----------------//</code>Here be l33tsp33x0rz. |
spellcaster
Member #1,493
September 2001
![]() |
Quote: During game play all I have to do is keep track of the very top tile. And adjust around it. That's the point. If the very top tile is at -1200 (in screen coords), it means that you have to draw a lot of other tiles before you get to the visible ones. -- |
DOAdal3t
Member #2,067
March 2002
![]() |
OMFG store: int tiles[3000][3000];//for whatever int property u wanne use(e.g. like which bitmap used) draw them: 00 01 10 02 11 20 03 12 21 30 13 22 31 23 32 33 which makes it easy(i hope) for u to see that u don't need to draw them all/or check them all. It it really easy to just draw e.g. tiles[2][1] to tiles[3][3] 21 22 31 23 32 33 As for danielH, DON"T U SEE THAT U DON"T HAVE TO DRAW THOSE TILES IN THAT STUPID ORDER.... 0 1 2 3 4 5 6 7 8 9 A B C D E F ~~~~~~equals sick(even when u first store the precalculated positions, by which u also don't need to draw them all)) sorry for my rant... but com'on. __________________ |
Goodbytes
Member #448
June 2000
![]() |
spellcaster is right. Leave him alone. Now, seeing as this is not Off-Topic Ordeals, I can't just leave it at that, I have to contribute something... I think. So, the way I see it... The 'rectangle' layout that spellcaster discussed is better in my opinion, because: 1. Rectangular maps make more sense to the user when you have a map bigger than the screen, for scrolling purposes, because you never have to scroll diagonally when you reach the bounds of the map. 2. Rectangular maps are less complicated when you don't care about drawing tiles that aren't visible, because there are less variables to keep track of, if you can get over the odd/even thing. 3. Rectangular maps are insanely less complicated than diamond-shaped maps when you do care about drawing tiles that are off the screen, because it takes less work and fewer calculations to determine which tiles are on the screen and which are not. I would prove these points, but I'm too lazy. Also, DanielH, why draw your tiles in a different order that they are stored? You do realize that drawing them in this order: 1 2 3 4 5 6 7 8 9 is functionally equivalent to drawing them in this order: 1 4 2 7 5 3 8 6 9
right? [EDIT: Upon re-reading the thread, I'm not sure whether or not to brand this post as "stupid" and "uninformed" or not, but I'll keep it up just in case. |
DOAdal3t
Member #2,067
March 2002
![]() |
hellow goodbites(sorry just had to do that:D(well at first it was spelling fault)) yeah I hope that danielH now gets it, after u and I, just after eachother said just about the same;) here is some comment on your points: 1. as you could have read... it is a wrapped/looping map. so yeah maybe it is a, how do we say,"uninformed". and now everybody bow for me... (pls) __________________ |
spellcaster
Member #1,493
September 2001
![]() |
Quote: which makes it easy(i hope) for u to see that u don't need to draw them all/or check them all. It it really easy to just draw e.g. tiles[2][1] to tiles[3][3]
ahm drawing some tiles in which order what so ever is not the problem. The problem is that you need to find the correct start position in the first place. In closing: I must really say, that if you think using diamond shaped maps is better / more easy or faster than rect maps, then you're simply wrong. Just want to point out that you need algos to solve problems which can be solved with a single formula with rect maps. -- |
23yrold3yrold
Member #1,134
March 2001
![]() |
Quote: and now everybody bow for me... (pls) A lot of your posts seem to convey that you think you are the sole holder of truth and knowledge in this thread Maybe we should have you all make a tilemap demo in 24 hours and see who did the best job -- |
DOAdal3t
Member #2,067
March 2002
![]() |
Quote: ahm drawing some tiles in which order what so ever is not the problem. The problem is that you need to find the correct start position in the first place. com'on did you even read my post... the x,y position of the screen is known so the purple leftmost circle is known... and then also the other purple circle is known. Quote: Do you have a working demo of your engine? Which has maps larger than a single screen? Say maps which are 10x10 screens large? Quote: In closing: I must really say, that if you think using diamond shaped maps is better / more easy or faster than rect maps, then you're simply wrong. nice point u have there... I woundn't take on philosophy or something if I were u, cos for those studies you need reasons... maybe u should believe in god(sorry this is off-topic rant maybe start that threat somewere else:-X) Quote: Just want to point out that you need algos to solve problems which can be solved with a single formula with rect maps. odd/even is not really complex... but more complex than diamond... well see u again tomorrow... /me sleep __________________ |
spellcaster
Member #1,493
September 2001
![]() |
The reasons why rectangular maps better are: This is also stated above (way above) Regarding your clever way to find the first row: Could you now please show me the algorithm to translate this into the first tile you need to draw? -- |
Plucky
Member #1,346
May 2001
![]() |
I'll throw my two cents behind spellcaster. Rectangular isometric maps are more straight-forward. The whole odd-even thing is close to being trivial... anyone who has coded up a standard tile engine would know how to do it... just a few more simple statements in the loop. Screen-to-Tile coordinates is easier with rectangular isometric. Can't argue with the math. From what I can tell from DOAdal3t, he's finding the starting diagonal row and ending diagonal row from screen coordinates and screen size, using a screen-tile coordinate transform. Not a large speed hit. However, his method needs to check at least 2X the number of tiles that can be shown on his screen. A lot of inefficiencies from if statements and additional looping math overhead. Compare with the rectangular isometric: the extra tiles to be checked (to see if they would actually show up on the screen) is on the order of the perimeter size of the screen rather than the area. The number of tiles drawn should be about the same. I don't see an advantage with diamond isometric maps in terms of wrapped maps. The rectangular isometric handles wrapped maps as well as, if not easier than, rectangular isometric. One last tidbit, games like Civ3 seem to use rectangular isometric. I lied; I had another comment: Quote: so bow for me, I am the elite...(still searching for others) and other statements remind me of silly kids in junior high. These sorts of statements aren't exactly persuasive... in fact they just incite the crowd against you. |
DanielH
Member #934
January 2001
![]() |
blah, blah, blah, ... Goodbytes: I realize the drawing would be the same, but the storage would confuse me. I like to have things visual. And this was easier to visualize. spellcaster: I do use rectangle maps. Excerpt from the Book of Dan. In the beginning Dan said 'This is the first time I've done one of these so I'm not sure I know what I'm doing'. It might not have been the correct way to do it, but it is my way. And a very good result in the process, which I'm happy with. How abouts you check it out? Le'me see whas yous guys thinks. Using a rectangle map the way spellcaster says doesn't sound good to me. How do you figure out which tile is up left. Well if the row is odd then it is this, but if the row is even then it is this. UpLeft: That was the one reason I did not do it that way. My way: |
spellcaster
Member #1,493
September 2001
![]() |
DanielH: While writing my reply above I realized that the 2nd best way to draw the map would be the you're doing it Regarding top left tile: the question is how to find "tile" in the first place Or am I missing somthing (wouldn't be the first time)? Could you use my example above to show us how your solution would work with the above values? This way we can compare all three methods... allowing the lurkers to find the method they like best. It would also make the discussion more specific, since we then know the algos (which allows us to talk about the running speed and complexity of the solutions, etc). -- |
MageMog
Member #2,668
August 2002
![]() |
This post will probably be a pain in the arse but wouldn't plotting the map to
---------------------------------- |
spellcaster
Member #1,493
September 2001
![]() |
Nice idea. One problem: -- |
MageMog
Member #2,668
August 2002
![]() |
er... whats the prob w/ sprites? Map -> Page Rotate Page Page -> Screen
---------------------------------- |
spellcaster
Member #1,493
September 2001
![]() |
Sorry, that was too loose. And then you won't need isometric tiles at all, so there's no need to rotate the map. -- |
Oscar Giner
Member #2,207
April 2002
![]() |
But this way there isn't hardware acceleration, so it will be a lot slower. And about the rectangle vs diamond thing: you can have this: - - 1 - - - 2 3 4 - 5 6 7 8 9 - A B C - - - D - - You store the map as a rectangular one, but the you only draw the tiles that would be inside the diamond. You have unused memory, but maybe you can use those dummy tiles for storing some info. The first time I thought about how to do my tile engine, I thought that this could be am easy way, but I ended doing a rectangular map, like spellcaster. I never thought that a 'real' diamond map would be a good aproach. -- |
DOAdal3t
Member #2,067
March 2002
![]() |
tileX=(y+x)/32 tile[x+1][y-1]for going one tile to the right and here the editor: I don't see why i should do the odd/even stuff. __________________ |
PaulSiramy
Member #2,748
September 2002
![]() |
@logan666 : You have to check if there's at least 1 pixel of your tile in the screen. If none at all, don't even use the masked_blit(). The less you'll use drawing functions, the quicker your program will be. Make your own cliping tests, like : for(my=0; my< 30; my++ ) { for(mx=0; mx< 30; mx++ ) { sx = (SCREEN_W/2 -32 x) + (mx * TILEM_W) - (my * TILEM_W); if ((sx >= -64) && (sx < SCREEN_W)) { sy = cy + (my * TILEM_H) + (mx * TILEM_H); if ((sy >= -32) && (sy < SCREEN_H)) masked_blit(tile,buffer,0,0,sx,sy,64,32); } } } For the screen --> tile coordinates, it's not really hard. I'm placing tiles in a virtual space, and I "move" my screen over it. Then knowing the mouse position in the screen, no problem to know where it is on this space, then not really hard to know what tile it's pointing it (it's even a pixel-correct position): {"name":"shem16.gif","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/d\/adc2391a21b71beec500b841ddca0cda.gif","w":601,"h":579,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/d\/adc2391a21b71beec500b841ddca0cda"} If this image is too wide, I can reduce it, np. That's the logic I use for my Diablo II map editor, and it works pretty well. [EDIT : thanks DOAdal3t for the img tag syntaxe.] But it's an old image I have made there. You can speed up the process by making a 2D array, width & height of 1 tile,, and each cell of this table will tell you on which tile you are, like : 0000112222 1 will tell that you're on the x, y tile You've got the idea. Btw, how do put images in your posts guys ? I have searched for a help / list of code, like [img]...[/img] tags but didn't found any.
|
DOAdal3t
Member #2,067
March 2002
![]() |
check the mochup is on: <img src="http://www.allegro.cc/templates/classic/media/logo.gif" /> and join this discussion with all your heart;D __________________ |
spellcaster
Member #1,493
September 2001
![]() |
Quote:
tileX=(y+x)/32 tile[x+1][y-1]for going one tile to the right Ok, let's see: x,y = 734,555 tileX = (734 + 555) / 32 tileX = 40 tileY = (555-734) / 32 tileY = -5
I doubt that. Quote: and here the editor:
Since you can't actually use isometric tiles in your editor, you have several problems: Quote: I think my system is a really clean one.
Not sure how to comment that one. -- |
DOAdal3t
Member #2,067
March 2002
![]() |
d00d.... think. the calc was correct... only for wrapping I need the map size... I'm dumb!. bow for me now??? __________________ |
DanielH
Member #934
January 2001
![]() |
I have no idea which would be the better way. Yours sounds more logical, but I don't like it. Mostly because I'm still thinking rectangularly with a rotated offset. Meaning I'm still looking at the same square, but rotated to a diamond. I got the idea from a 3dpacman game I started where I could switch from isometric to normal drawing mode. I guess it just stuck in the head. And about finding the tile. That's where my method is not prudent. I go through my template grid of 28x28 tiles. And find which one the point resides in using the color method. And as long as I keep track of which tile is at the top then I can find which one is anywhere in the grid. But if I have a map of 100x100, I only look at the 28x28. If I have a map of 4000x4000, I look at the same 28x28. That was my whole thinking of why I created the template in the first place. I didn't know any other way to do it. And that is the end of discussion. No more. Adding this to the ignore list. |
Plucky
Member #1,346
May 2001
![]() |
I think you guys are missing each other. Here's how I think DOAdal3t is doing it: To find the starting tile in tile coordinates, he uses more or less: Now the key is that a negative tile coordinate is okay if the map is not wrapping. The reason seems to be that DOAdal3t is "brute forcing" it. With this starting tile, the drawing loop would check for: With a wrapping map, all tile coordinates are made legal by use of map size. As for the number of tiles per diagonal row, this would be approximately: The number of tiles that go through the loop would then be approximately: This is approximately 2X the number of tiles used in a rectangular iseometric. Thus there is a lot of inefficiencies due to if statements and such. |
|
|