Core chain: processing order and beams. (Learned and Seen, Thanks.)

Started by GoodMorning, February 18, 2016, 07:41:03 AM

Previous topic - Next topic

GoodMorning

Hello,

I need to know what order the units are processed in, within the frame. I also need to know whether this will persist across saves.

The theory is to have a long chain of dumb units, which need to have their code run from first to last, within the same frame. This allows orders to be given by the head of the chain, and propagate through (Specifically, a rush-to-close-gap command.).

This could be done by letting the gap work it's way backward, frame by frame, but...

My hope is that 1) units are processed in order of creation, and 2) that they are saved and loaded in order of creation.

Am I correct?

The eventual idea is a factory making a snake of cores which must be shot down before they form a closed loop. This while battling Creeper, and the cores pushing all damage down the line, until something dies at the back. However, each core will eat a small amount of the damage, allowing the regeneration to work in parallel.

This leads to the other question: In order to better balance this, the factory will have to pass a laser to the first core in line, which passes to the second, etc... until the end one passes it back to the factory, which builds the new unit.
However, I can't seem to find the code for putting a beam between two cores.

Failing that, I can just have a constant time, and make the total production slower.
A narrative is a lightly-marked path to another reality.

Grayzzur

The actual order that each script runs for each core is technically undefined. There's no guarantee which one will run first in a given frame, just that they all run. They do seem to run in UnitID (creation) order, but I wouldn't make a design dependent on that fact. You never know when a future game patch might break that behavior.

As for the beams, take a look at Virgil's Aether map in the Alpha Sector. The crpl gliders in that map make a beam when they destroy units that get too close.
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker

GoodMorning

Thanks. So, if I need a defined runtime order, I should just have n external manager to do all of that?

Thanks for the reference for the beams.
A narrative is a lightly-marked path to another reality.