0
\$\begingroup\$

So I got my isometric renderer working, it can draw diamond or jagged maps...Then I want to move on...How do I draw characters/objects on it in a optimal way?

What Im doing now, as one can imagine, is traversing my grid(map) and drawing the tiles in a order so alpha blending works correctly.

So, anything I draw in this map must be drawed at the same time the map is being drawn, with sucks a lot, screws your very modular map drawer, because now everything on the game (but the HUD) must be included on the drawer..

I was thinking whats the best approach to do this, comparing the position of all objects(not tile stuff) on the grid against the current tile being draw seems stupid, would it be better to add an id ON the grid(map)? this also seems terrible, because objects can move freely, not per tile steps (it can occupies 2 tiles if its between them, etc.)

Dont know if matters, but my grid is 3D, so its not a plane with objects poping out, its a bunch of pilled cubes.

\$\endgroup\$
3
  • \$\begingroup\$ So, anything I draw in this map must be drawed at the same time the map is being drawn - Can you elaborate on this? I don't understand how that could be possible. \$\endgroup\$
    – Cypher
    Sep 11, 2012 at 16:16
  • \$\begingroup\$ Well, the map cant be entirely drawn, then draw the objects after, because objects can be in front of some map tiles(cubes) but behind others, so everything should be sorted and drawed in the same "pass" \$\endgroup\$ Sep 11, 2012 at 23:45
  • \$\begingroup\$ You'll need to use a technique called z-buffering or depth buffering. You can then sort and draw all your sprites based on a z-buffer to draw them in order. That's what @Luke B. is talking about when he talks about giving sprites a "Z value". \$\endgroup\$
    – Cypher
    Sep 12, 2012 at 16:08

1 Answer 1

3
\$\begingroup\$

Instead of having the map drawer traverse the grid, make it traverse every drawable object and make no distinction between tiles or whatever else you have on the screen. There's no need for the drawer to know about tiles, it should know only about sprites and their position on the screen. You can also add a Z value to your screen objects and have an ordered list based on that Z, so the drawer can just draw from the first to the last in that list and they will be in the right position in the screen.

\$\endgroup\$
4
  • \$\begingroup\$ So you saying 100% of the algorythms for drawing isometric maps out there are unfeasible for objects? \$\endgroup\$ Aug 12, 2012 at 11:27
  • \$\begingroup\$ Do you have a specific algorythm in mind? I can't help much without code. \$\endgroup\$
    – Luke B.
    Aug 13, 2012 at 11:51
  • \$\begingroup\$ @LukeB. I'm making an strategy, medieval-themed, tiled, isometric (dimetric) game and it will have both "city-building" (CMS) and combat aspects. I need a 3D system (XY and Z) for the coordinates of units and projectiles in the world, and I'm worried that, if the render-order is based on the 3D coordinates, if a terrain tile at position [0,0,0] and a unit is also at that coordinate, the unit might be rendered first, thus under the terrain it's supposed to stand above of. --- How do I proceed? \$\endgroup\$ Oct 4, 2013 at 17:00
  • \$\begingroup\$ @TheLima You should make a new question, your problem is different from this question and I'm not sure I understood everything. \$\endgroup\$
    – Luke B.
    Oct 4, 2013 at 17:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .