Advertisement

Isometric Visibility algorithms.

Started by October 08, 2000 10:32 AM
2 comments, last by jollyjeffers 24 years, 3 months ago
hi, My game is isometric and the maps are pretty big - 200x200 tiles, I want to work out how I can render only the tiles that are on screen, and as I have to do various calculations I want to only do them on visible tiles... Anyone know how? It''s easy with square tiles - but I''m stumped with diamonds... Jack,

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

NEWBIE ANSWER ALERT (but at least I''m helping?)
-------------------

Right, you have the length, width and height of each tile so you could get the width of the screen then divide by the length of each tile to get the number of tiles per screen and then only drawn that many tiles (+1 to make sure?)...

I doubt this helps, but it might...

KlDzny

"You can be in a minority of one but the truth is still the truth." - Gandhi
"Success can make you persevere for hours, failure can make you quit in seconds" - KlDzny
Advertisement
Well with my Iso Game I have a MapTopX and MapTopY variable that specifies how many pixels I am from the upper, left corner of the map. Now when I paint the screen I divide the MapTopX by the tilewidth to get the number of tiles to the left of the screen (Don''t do your calculations on those ones) and divide the TopMapY by tileheight to get the number of tiles "above" the screen (Don''t do calcs on any tile below that number as well) Now you now the X and Y of the very top tile in the screen, now figure out how many tiles fit in your playing field in both directions at the most. So in my game it''s something like 14x38 in one screen (There''s a lot vertically because they are stagered iso tiles right?! good.)

Does that make sense? Well that''s as good as I could put it.
See ya,
Ben
__________________________Mencken's Law:"For every human problem, there is a neat, simple solution; and it's always wrong."
"Computers in the future may weigh no more than 1.5 tons."- Popular Mechanics, forecasting the relentless march of science in 1949
I''m going to use QuadTree''s for the visibility...

Despite being slightly slower in my experience (mayb just me) I like them.

And it sounds clever too =)

Jack,

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

This topic is closed to new replies.

Advertisement