#Algorithm adaptation help in Bevy

6 messages · Page 1 of 1 (latest)

tidal niche
#

I am currently implementing a Genetic Cellular Automata. To pose my question, I will give a simple example:

A cell wants to gather resources from the surrounding 3x3 environment. There are other cells nearby that also wish to collect resources from an overlapping region. If I simply process each gathering of resources in order, there will be unfair biases.

The solution I have requires two or three phases. Basically, there is a request phase, where each cell will publish that it wants to collect resources from a particular tile. Next is a gather phase, where all publish requests are grouped and sorted appropriately. Finally, a cell receives an even share of the resources for a particular tile.

This process seems very parallelisable, which is great. However, I still cannot decide the best tool for this job. I am still relatively new to Bevy, so the details elude me. Events seem to be the wrong approach, since I cannot assert that all cells evenly split their requests. Would the best approach be to have separate systems for each phase? Or is there some other feature or approach that would be even better suited?

With performance being a key component for my considerations, I have found it difficult to determine the best approach that can be easily extended in the future (though that is a whole different problem).

Thanks for your thoughts in advance

-# Sorry if I don't reply immediately. I am tired and am about to head to bed 😅

scenic jasper
#

create a SystemSet like

enum AutomataPhaseSystems {
  First,
  Second,
  Third
}

then have the systems on each phase be in the respective system set using .in_set

and inside each system, iterate over the queries with par_iter

tidal niche
scenic jasper
#

on your app/plugin you need to configure_sets

#

to have then in the proper order