#[SPZ2-3838] [0.0.9-rc7] Identical wire circuits can behave differently
14 messages · Page 1 of 1 (latest)
The top and bottom circuits are identical and the expectation is that they should behave the same.
The problem is that the behavior is non-deterministic and can change even when the circuit does not change. For example, by copy and pasting the platform or restarting the game, the behavior might change.
the first time I pasted this circuit the top counter would strictly count up, but the bottom counter was weird: the left 2 bits would count up, but the right 2 bits would count down.
It's random. Sometimes they are in perfect sync.
You can fiddle with the behavior by making small changes and it will keep working the same way. But then it might change again even if you make an unrelated change.
What behavior do we expect(/want) from this specific circuit? I think we would want it to either count up or down but I'm not sure which it "should" be... I think it changes depending on the update order of the XORs and GATEs: (XOR0, GATE0, XOR1, GATE1, etc) vs (GATE0, XOR0, GATE1, XOR1, etc). I think we would definitely want the pairs of XORs and GATEs to update from left to right (like the gates would if the XORs weren't there (probably idk)).
I don't want to make any guesses or suggestions on how it can be fixed, but ideally wires should always behave in a deterministic way. I don't really care if it counted up or down, as long as it didn't change.
At least a guarantee that it always counts either up or down would be very valuable.
If for some reason the behavior is ambiguous, perhaps the addition of a new component like a Delay Diode could give explicit control of the timing to the player. https://shapez-2.nolt.io/2704
[SPZ2-3838] [0.0.9-rc7] Identical wire circuits can behave differently
Thank you for your report!
A ticket has been logged into our internal system for further investigation.
A little more technical background on this issue (and other related wiring timing issues) if you're interested!
The short version is: anytime there is a loop in your circuit, you can get inconsistent timing.
Your example is a great, concise demonstration of that.
From the dev team, behind the scenes, there was a refactor for 0.0.9 which helped in a few ways, but there are a few things that make fully deterministic circuits difficult:
- For 0.0.9, the wires were moved to be part of our overall simulation graph. This helped with timing, and also allowed for better multi-threading.
- The wires now tick at 12Hz (previously they were tied to frame rate).
- Signal buildings used to have an output delay that was partially based on the placement order, but there were some other simulation quirks. Now, if there are no loops, the signal will be updated in a single pass from inputs to outputs "instantaneously". Unfortunately, if there is a loop, the update order is then based on placement order, and will have a delay for some of the looped buildings.
- Global wire Tx/Rx have additional delays to support better partitioning between threads (and avoid everything becoming one degenerate single thread again).
It's actually a pretty complicated problem (especially considering the performance constraints), so we're continuing to look for creative solutions.
Any errors in the presentation of this information are entirely my own. 🙂 And obviously the future-looking parts, here, may or may not make it into a future version, but we're all hoping to see wires get some more love going forward.
Thanks for the update. I understand that this is "advanced wires" stuff that won't effect most players and may take a lower priority. We do expect (and want) a delay when there are loops, but the problem is that it is non-deterministic and can change. Please consider adding a new building that allows the player to control where the delay is located in the circuit, as suggested in 2704 and other posts on the nolt.io site.