Page 1 of 1

Train IDs

Posted: Thu Dec 19, 2019 10:54 pm
by husnikadam
Hi,
I couldn't find an answer (neither in wiki nor forum) for a question - what is train IDs range? How is the ID set? Can somehow happen that two trains get the same id? (f.e. through number overflow or too many trains). These info would be useful for my circuit network. Thank you.

Re: Train IDs

Posted: Fri Dec 20, 2019 10:40 am
by disentius
- train ID is unique
- gets set when train is created, reset when you change the train composition (adding/removing wagons or locomotives)
- Range: could not find any info on that, probably standard factorio integer range (2^31)

Re: Train IDs

Posted: Sat Dec 21, 2019 10:56 pm
by husnikadam
So IDs start at (zero/one)? and then every train update uses a next unused ID, right? Thanks

Re: Train IDs

Posted: Sun Dec 22, 2019 7:59 am
by eradicator
husnikadam wrote: Sat Dec 21, 2019 10:56 pm So IDs start at (zero/one)? and then every train update uses a next unused ID, right? Thanks
It probably uses last_assigned_id+1, regardless of if there are currently unused ids before that. I.e. every ID should be unique for the duration of the whole game even if you destroy lots of trains.

See also viewtopic.php?p=360137#p360137