Page 1 of 1

Circuit Network Train ID #

Posted: Wed Aug 31, 2022 1:37 am
by ColonelSandersLite
So just a quick question -

When you read the train ID # from a train stop via the circuit network, is this value guaranteed to be non-zero?

I have been working under the assumption that it is without problems, but come to think of it, I honestly have no idea how the game decides a train's ID number.

And you know what they say about assumptions...


Anybody got any interesting insights into these numbers?

Re: Circuit Network Train ID #

Posted: Wed Aug 31, 2022 5:18 am
by FuryoftheStars
The number is simply that: a number. It doesn’t have any relation or pattern to it. Afaik, it starts at 1 (because 0 does not transmit), and every new train or modification to a train’s physical layout (add/remove wagons/locos) causes it to pick the next available number. I think the max is 2^32? Then it rolls over back to 1.

Re: Circuit Network Train ID #

Posted: Wed Aug 31, 2022 7:31 am
by ColonelSandersLite
Well see - you contradicted yourself there and, in the process you told me something interesting I didn't know and accidentally answered the actual question.

You said that "It doesn’t have any relation or pattern to it. " then you went on to describe how it's sequential. That's definitely a pattern and I had no idea that's how it worked. I figured it was just a random number.

My question was more is it "X = rand() % 1000000;" or "X = rand() % 1000000+ 1;" or even "X = rand() % 1000000 - 500000;" but the answer is none of the above!

I'm not sure how this bit of information is useful, but maybe I'll find a use for it someday.

Re: Circuit Network Train ID #

Posted: Wed Aug 31, 2022 7:46 am
by boskid
Train ID's are guaranteed to be non-zero. They are allocated starting from 1 and increasing for each new train. Even if an overflow would happen, a train ID will never be 0 as there is a special check that guards against this case.

Re: Circuit Network Train ID #

Posted: Wed Aug 31, 2022 7:51 am
by ColonelSandersLite
Great to know buddy :D .

Re: Circuit Network Train ID #

Posted: Wed Aug 31, 2022 10:57 am
by FuryoftheStars
ColonelSandersLite wrote: Wed Aug 31, 2022 7:31 am You said that "It doesn’t have any relation or pattern to it. " then you went on to describe how it's sequential. That's definitely a pattern and I had no idea that's how it worked.
What I meant by that was that the actual composition of the train does not determine or affect the ID.