Skip to main content
added 241 characters in body
Source Link
kaoD
  • 1.9k
  • 15
  • 17

This is actually very simple if your objects match up with your isometric tiles (even if the objects can stack on top of each other.) Take a look at this image:

Isometric drawing order

You should first draw the object at the red position, then objects at blue, then green, then yellow, then magenta, and so on... It should be fairly obvious how to implement this if your board has objects in it instead of objects having position as an attribute.

  If that's not your case, you should keep a separate data structure, updating it whenever an object moves (which should be fairly easy too.)

This has a new problem: you can easily see how now its complexity is O(N) where N is your board size (N=W*H). To overcome this problem just create a new linear data structure where each index in your structure matches a given depth, updating it whenever an object changes depth.

The case where an object doesn't match with a single tile is a bit harder, so I will post it if you need it as soon as you update your question.

This is actually very simple if your objects match up with your isometric tiles (even if the objects can stack on top of each other.) Take a look at this image:

Isometric drawing order

You should first draw the object at the red position, then objects at blue, then green, then yellow, then magenta, and so on... It should be fairly obvious how to implement this if your board has objects in it instead of objects having position as an attribute.

  If that's not your case, you should keep a separate data structure, updating it whenever an object moves (which should be fairly easy too.)

The case where an object doesn't match with a single tile is a bit harder, so I will post it if you need it as soon as you update your question.

This is actually very simple if your objects match up with your isometric tiles. Take a look at this image:

Isometric drawing order

You should first draw the object at the red position, then objects at blue, then green, then yellow, then magenta, and so on... It should be fairly obvious how to implement this if your board has objects in it instead of objects having position as an attribute. If that's not your case, you should keep a separate data structure, updating it whenever an object moves (which should be fairly easy too.)

This has a new problem: you can easily see how now its complexity is O(N) where N is your board size (N=W*H). To overcome this problem just create a new linear data structure where each index in your structure matches a given depth, updating it whenever an object changes depth.

The case where an object doesn't match with a single tile is a bit harder, so I will post it if you need it as soon as you update your question.

deleted 113 characters in body
Source Link
kaoD
  • 1.9k
  • 15
  • 17

This is actually very simple if your objects match up with your isometric tiles (even if the objects can stack on top of each other.) Take a look at this image:

Isometric drawing order

You should first draw the object at the red position, then objects at blue, then green, then yellow, then magenta, and so on... It should be fairly obvious how to implement this if your board has objects in it instead of objects having position as an attribute.

If that's not your case, you should keep a separate data structure, updating it whenever an object moves (which should be fairly easy too.)

The case where an object doesn't match with a single tile is a bit harder, so I will post it if you need it as soon as you update your question.

EDIT: I see you've updated your question and you're on the simpler case, so that's it. You're good to go.

This is actually very simple if your objects match up with your isometric tiles (even if the objects can stack on top of each other.) Take a look at this image:

Isometric drawing order

You should first draw the object at the red position, then objects at blue, then green, then yellow, then magenta, and so on... It should be fairly obvious how to implement this if your board has objects in it instead of objects having position as an attribute.

If that's not your case, you should keep a separate data structure, updating it whenever an object moves (which should be fairly easy too.)

The case where an object doesn't match with a single tile is a bit harder, so I will post it if you need it as soon as you update your question.

EDIT: I see you've updated your question and you're on the simpler case, so that's it. You're good to go.

This is actually very simple if your objects match up with your isometric tiles (even if the objects can stack on top of each other.) Take a look at this image:

Isometric drawing order

You should first draw the object at the red position, then objects at blue, then green, then yellow, then magenta, and so on... It should be fairly obvious how to implement this if your board has objects in it instead of objects having position as an attribute.

If that's not your case, you should keep a separate data structure, updating it whenever an object moves (which should be fairly easy too.)

The case where an object doesn't match with a single tile is a bit harder, so I will post it if you need it as soon as you update your question.

added 56 characters in body
Source Link
kaoD
  • 1.9k
  • 15
  • 17

This is actually very simple if your objects match up with your isometric tiles (even if the objects can stack on top of each other.) Take a look at this image:

Isometric drawing orderIsometric drawing order

You should first draw the object at the red position, then objects at blue, then green, then yellow, thethen magenta, and so on... It should be fairly obvious how to implement this if your board has objects in it instead of objects having position as an attribute.

If that's not your case, you should keep a separate data structure, updating it whenever an object moves (which should be fairly easy too.)

Even if your objects can occupy several tilesThe case where an object doesn't match with a single tile is a bit harder, so I will post it if you can borrow the same idea over. You just have to draw them wheneverneed it as soon as you find the FARTHEST (from the point of view) tile of the objectupdate your question.

EDIT: I see you've updated your question and ignoreyou're on the restsimpler case, so that's it. You're good to go.

This is actually very simple if your objects match up with your isometric tiles (even if the objects can stack on top of each other.) Take a look at this image:

Isometric drawing order

You should first draw the object at the red position, then objects at blue, then green, then yellow, the magenta... It should be fairly obvious how to implement this if your board has objects in it instead of objects having position as an attribute.

If that's not your case, you should keep a separate data structure, updating it whenever an object moves (which should be fairly easy too.)

Even if your objects can occupy several tiles, you can borrow the same idea over. You just have to draw them whenever you find the FARTHEST (from the point of view) tile of the object and ignore the rest.

This is actually very simple if your objects match up with your isometric tiles (even if the objects can stack on top of each other.) Take a look at this image:

Isometric drawing order

You should first draw the object at the red position, then objects at blue, then green, then yellow, then magenta, and so on... It should be fairly obvious how to implement this if your board has objects in it instead of objects having position as an attribute.

If that's not your case, you should keep a separate data structure, updating it whenever an object moves (which should be fairly easy too.)

The case where an object doesn't match with a single tile is a bit harder, so I will post it if you need it as soon as you update your question.

EDIT: I see you've updated your question and you're on the simpler case, so that's it. You're good to go.

Source Link
kaoD
  • 1.9k
  • 15
  • 17
Loading