Barotrauma

Barotrauma

View Stats:
Bwixie May 21, 2022 @ 8:36pm
Electronic circuit non-deterministic?
I had a working counter with two memory components and an adder, with one mem being the value to count by, and the other being the stockpile, so a value of 1 would increment about 60 times a second and i tracked this on a text display, i used a signal check looking for 60 to reset the stockpile to 0, and it would reset successfully.

now i'm testing it after re-launching the game, and it fails to reset despite the signal check sending the 0, i can even copy the whole counter and paste it into another section of the sub and it'll work again, but then not the next time i test.

i feel like im going crazy trying to figure out how to fix a circuit with no problems.
< >
Showing 1-4 of 4 comments
Buggy Boy May 21, 2022 @ 10:59pm 
There is likely a logic flaw somewhere in the design, with each update the devs usually tighten up a few loose ends in the components so you may need to start from scratch, the fact that it may work once shows that part of the circuit seems to be working so maybe use that as a starting point.
Provide us with the circuit and we can help troubleshoot. Without seeing it though, speculation is the best I can do.

I suppose it could be bug related, but it probably has more to do with the way circuits are evaluated in game. If you don't explicitly design the circuit such that it is only executed one way, then you get whatever you get. Depending on how you have the circuit configured, it may be that you are setting up it such that the game thinks it doesn't matter which component signals get processed in which order, and then depending on how the things play out in real time during the game, the circuit goes from executing in the order you expect it to, to one component swapping places with another in execution order, borking the expected result after a point.

Components are always trying to perform their operation on the signals they are receiving so long as they are receiving valid signals for their operation. This means if they have continuous access to valid signals for all of their necessary arguments, they are continuously outputting results. Further, I'm not entirely sure how synchronized components are, in cases where a bunch of components are all wired together in some sort of circuit that feeds back into itself and is continuously providing like, outputs to each others inputs. Also, memory components generally do update properly in my experience, eventually, but sometimes they don't update immediately and their 'set_value' signals can actually queue up and take quite awhile to process -- when I have used memory accumulators in the past, my experience was that they seem dependable in that they eventually work, but that they don't update in a timely manner and care needs to be taken working with them. For proper timers, the oscillator is the way to go in my opinion.
Last edited by climbingeastofwinter; May 21, 2022 @ 11:11pm
Bwixie May 21, 2022 @ 11:57pm 
memory A (increment)
value = 1
signal out = adder signal in 1

memory B (stockpile)
value = 0
signal in = signal check signal out
signal in = adder signal out
signal out = adder signal in 2

adder
clamp max 60
clamp min 0
signal out = text display signal in
signal out = signal check signal in

signal check (reset)
target = 60
output = 0
false = (blank)

this should count to 60 then reset to 0, and is consistent if it has worked already in a test, but fails the next time it would be tested.

the oscillator sounds useful i'll try that
Buggy Boy May 22, 2022 @ 4:27am 
Why do you have two inputs to MEM B? Also there seems to be no 'trigger' or regulator, normally timer circuits use the oscillator to generate regular pulses, without this regulator you're relying on the cosmic background radiation for your timing which is by definition random, that this circuit works at all is a minor miracle.

Check the Workshop for example timer circuits.
Last edited by Buggy Boy; May 22, 2022 @ 4:30am
< >
Showing 1-4 of 4 comments
Per page: 1530 50

Date Posted: May 21, 2022 @ 8:36pm
Posts: 4