Repository navigation
Reimplement distance check via ai and optimize performance. - #88
DivineThreepwood wants to merge 6 commits into
Conversation
tommy33790
left a comment
There was a problem hiding this comment.
The pipeline didn't compile.
And see comments about smaller unused / potentially unnecessary code.
I'm unsure about that whole Thread.currentThread().isInterrupted-stuff - whether it's useful or unnecessary.
| companion object { | ||
| const val RASTER_SIZE: Int = 10 | ||
| private const val DISTANCE_MAP_CACHE_SIZE = 128 | ||
| private val distanceMapCaches = WeakHashMap<AbstractLevel, DistanceMapCache>() |
There was a problem hiding this comment.
Is DistanceMapCache per level necessary if it's always cleared when starting a game (in AbstractLevel.reset() via clearDistanceMapCache)?
There was a problem hiding this comment.
We’ll keep the distance-map cache scoped per level, with a maximum of 128 recently used maps per level. Since the game lifecycle allows only one active level at a time, AbstractLevel.reset() will clear the entire cache, rather than removing only that level’s entry. This promptly releases cached maps for inactive levels while preserving level isolation, so distance maps from different layouts cannot be mixed.
There was a problem hiding this comment.
I still don't get the reasoning / implementation behind distanceMapCaches. It's a mapping for Level -> DistanceMapCache but it's cleared when starting a level. Thus, it will never contain more than one single Level & DistanceMapCache (which itself has up to 128 cached distances). If you start a game with the same level you just had, it's still cleared and all distances need to be recalculated.
With this implementation it's essentially used to store a single DistanceMapCache (that of the current level). So why is it a HashMap for Level -> DistanceMapCache?
Please think about once again.
After that, if you're still convinced that it's implemented / used correctly, then I'm fine with it.
It's just that I, myself, cannot grasp why it's the way it is.
I don't want to prevent a really good improvement with my cluelessness tho.
| ?.angle | ||
| } | ||
|
|
||
| private fun stablePosition(): Boolean = |
There was a problem hiding this comment.
stablePosition has no references.
|
All requested changes addressed. |
|
Currently the agents struggle to decide to which agent they should go, if multiple agents are requesting support. |
tommy33790
left a comment
There was a problem hiding this comment.
Looking really good.
Just think about my one new comment (/genuine)
And then merge it.
| companion object { | ||
| const val RASTER_SIZE: Int = 10 | ||
| private const val DISTANCE_MAP_CACHE_SIZE = 128 | ||
| private val distanceMapCaches = WeakHashMap<AbstractLevel, DistanceMapCache>() |
There was a problem hiding this comment.
I still don't get the reasoning / implementation behind distanceMapCaches. It's a mapping for Level -> DistanceMapCache but it's cleared when starting a level. Thus, it will never contain more than one single Level & DistanceMapCache (which itself has up to 128 cached distances). If you start a game with the same level you just had, it's still cleared and all distances need to be recalculated.
With this implementation it's essentially used to store a single DistanceMapCache (that of the current level). So why is it a HashMap for Level -> DistanceMapCache?
Please think about once again.
After that, if you're still convinced that it's implemented / used correctly, then I'm fine with it.
It's just that I, myself, cannot grasp why it's the way it is.
I don't want to prevent a really good improvement with my cluelessness tho.
|
@Jodi-Pa is
still an issue? |
I think it is still an issue, @tommy33790 has looked deeper into it, maybe she knows more. I only managed to capture one, fairly nondescript , video of it today, i will send it to you. |
📜 Description
Changes proposed in this pull request:
Test Procedure