How would I program something like this in DB3 so the DB3 architecture play nice with it?
In the distant future, probably stuff like this would go in a script (lua or C# or python or maybe the DNA language itself) that you'd load up that would control the flow of things and modify the simulation state after certain conditions. Basically a lot like how mods work for a lot of modern games: they sort of stomp over the scripts that ship with the base game, injecting their changes in directly. At the simplest a straight replace of the entire file, but you could also do diff based merging so you could merge different changes to the same file as long as they don't overlap.
In the slightly less distant future, you'd have to add some code to wherever the simulation loop would be to grab all the robots and do something to them. The more of these sorts of features you add, the longer the simulation loop code gets, so it doesn't scale very well as you add more features.
But none of that code is written yet, so the answer might very well change as things flesh out. But top level features like this aren't that hard to figure out. Harder stuff would be like pausing the simulation to debug the DNA execution of a robot line-by-line, because then you have to figure out how to sync up the simulation thread with the UI thread without creating a hard dependency between them, which means things like async handlers
holding on to closures
, and keeping all that from becoming a ripe mess. It's always the harder to do subtler features than to do straightforward ones, because the subtle features touch a lot of systems at the same time.