Access to function that returns a pollution cloud's origin
Posted: Thu Feb 20, 2025 6:56 am
There is clearly an efficient enough way for biters to pick an attack area or target based on pollution clouds.
To reimplement that behaviour for new entities or ones that don't have it built in, I'm using distance checks + surface.find_nearest_enemy_entity_with_owner followed by surface.find_entities_filtered (for polluting entities) alongside caching and load spreading to dodge performance issues.
I've considered creating and traversing a grid of all neighbouring polluted tiles and implementation A* to get the "center" but at this point it might be simpler to make whatever is used internally available.
I do not mind whether it returns a small area, an entity, a position or even something else. This is the most performance unfriendly hurdle I've run into when adding new enemies or adding behaviour to existing ones and I'd love a better solution!
If I've missed something in the API or if there's anything else I'm not thinking of, I'd love to hear it!
To reimplement that behaviour for new entities or ones that don't have it built in, I'm using distance checks + surface.find_nearest_enemy_entity_with_owner followed by surface.find_entities_filtered (for polluting entities) alongside caching and load spreading to dodge performance issues.
I've considered creating and traversing a grid of all neighbouring polluted tiles and implementation A* to get the "center" but at this point it might be simpler to make whatever is used internally available.
I do not mind whether it returns a small area, an entity, a position or even something else. This is the most performance unfriendly hurdle I've run into when adding new enemies or adding behaviour to existing ones and I'd love a better solution!
If I've missed something in the API or if there's anything else I'm not thinking of, I'd love to hear it!