• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Isometric Visibility algorithms.

## Recommended Posts

jollyjeffers    1570
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,

##### Share on other sites
KlDzny    122
-------------------

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

##### Share on other sites
cyberben    122
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

##### Share on other sites
jollyjeffers    1570
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,