Skip to main content
added 167 characters in body
Source Link

I'm creating a 2d isometric game that uses topological sorting to correctly depth sort all of the oddly-shaped isometric objects. I spent a lot of time writing this from scratch, and it works great. However, it has to sort every object every frame since there are moving entities. Once I get a couple hundred objects in the list, it begins to lag significantly. I'm wondering, does anyone know a way to save on these computation costs?

My intuition is to sort immobile objects once, store this, and then only sort moving objects from then on. However, I fear that this may not be possible with something complex like a DAG.

Edit:

I used this video as a starting point, so it's a good example of what I'm sorting exactly.

I'm creating a 2d isometric game that uses topological sorting to correctly depth sort all of the oddly-shaped isometric objects. I spent a lot of time writing this from scratch, and it works great. However, it has to sort every object every frame since there are moving entities. Once I get a couple hundred objects in the list, it begins to lag significantly. I'm wondering, does anyone know a way to save on these computation costs?

My intuition is to sort immobile objects once, store this, and then only sort moving objects from then on. However, I fear that this may not be possible with something complex like a DAG.

I'm creating a 2d isometric game that uses topological sorting to correctly depth sort all of the oddly-shaped isometric objects. I spent a lot of time writing this from scratch, and it works great. However, it has to sort every object every frame since there are moving entities. Once I get a couple hundred objects in the list, it begins to lag significantly. I'm wondering, does anyone know a way to save on these computation costs?

My intuition is to sort immobile objects once, store this, and then only sort moving objects from then on. However, I fear that this may not be possible with something complex like a DAG.

Edit:

I used this video as a starting point, so it's a good example of what I'm sorting exactly.

edited tags
Link
Pikalek
  • 13.4k
  • 5
  • 49
  • 54
Source Link

Topological sorting optimization

I'm creating a 2d isometric game that uses topological sorting to correctly depth sort all of the oddly-shaped isometric objects. I spent a lot of time writing this from scratch, and it works great. However, it has to sort every object every frame since there are moving entities. Once I get a couple hundred objects in the list, it begins to lag significantly. I'm wondering, does anyone know a way to save on these computation costs?

My intuition is to sort immobile objects once, store this, and then only sort moving objects from then on. However, I fear that this may not be possible with something complex like a DAG.