[0.15.16] luadoc for LuaEntity.unit_number
[0.15.16] luadoc for LuaEntity.unit_number
Hi,
So the luadocs for http://lua-api.factorio.com/latest/LuaE ... nit_number is a bit unclear;
Are unit_numbers universally unique for the lifetime of a whole game?
That is to say, if one was destroyed, is there ever any chance that another LuaEntity will have the unit_number of the destroyed one?
Thank you!
So the luadocs for http://lua-api.factorio.com/latest/LuaE ... nit_number is a bit unclear;
Are unit_numbers universally unique for the lifetime of a whole game?
That is to say, if one was destroyed, is there ever any chance that another LuaEntity will have the unit_number of the destroyed one?
Thank you!
Re: [0.15.16] luadoc for LuaEntity.unit_number
Yes ... even though it might oveflow (it is uint32) which would potentially cause two or more entities to have same unit number, but I have never seen it even come close to overflowing.folk wrote:Are unit_numbers universally unique for the lifetime of a whole game?
Re: [0.15.16] luadoc for LuaEntity.unit_number
That's what I assumed
Thank you!
Oh, I see the thread was moved to "modding help". I opened it as a bug report specifically because I wanted the luadocs clarified in the name of posterity, future reference, and the good of mankind. I already assumed it behaved like you described it, but of course it's good to get it confirmed.
Thank you!
Oh, I see the thread was moved to "modding help". I opened it as a bug report specifically because I wanted the luadocs clarified in the name of posterity, future reference, and the good of mankind. I already assumed it behaved like you described it, but of course it's good to get it confirmed.
Re: [0.15.16] luadoc for LuaEntity.unit_number
I changed the doc as I moved the thread, but I felt like it is more appropriate to move the thread to Modding help rather than to resolved issues
Re: [0.15.16] luadoc for LuaEntity.unit_number
Challenge accepted! Anyone?posila wrote:Yes ... even though it might oveflow (it is uint32) which would potentially cause two or more entities to have same unit number, but I have never seen it even come close to overflowing.
I guess the same is true for LuaTrain:id
Re: [0.15.16] luadoc for LuaEntity.unit_number
Same for map tick as wellChoumiko wrote:Challenge accepted! Anyone?posila wrote:Yes ... even though it might oveflow (it is uint32) which would potentially cause two or more entities to have same unit number, but I have never seen it even come close to overflowing.
I guess the same is true for LuaTrain:id
If you ever manage to overflow it in a normal game that isn't purpose-created to do so then I'll give you a free steam key because I don't think anyone will ever do it
If you want to get ahold of me I'm almost always on Discord.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: [0.15.16] luadoc for LuaEntity.unit_number
that's like, 2.3 years of game time before a tick overflow.
4 billion units is something that is far more obtainable. all you really need to do is set up a few biter farms, and eventually it will overflow.
what happens when it does overflow?
4 billion units is something that is far more obtainable. all you really need to do is set up a few biter farms, and eventually it will overflow.
what happens when it does overflow?
Re: [0.15.16] luadoc for LuaEntity.unit_number
You'd have to kill > 1 per tick since the creation of the map for a total of 60 per second or 3600 biters per minute.bobingabout wrote:that's like, 2.3 years of game time before a tick overflow.
4 billion units is something that is far more obtainable. all you really need to do is set up a few biter farms, and eventually it will overflow.
what happens when it does overflow?
If you want to get ahold of me I'm almost always on Discord.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: [0.15.16] luadoc for LuaEntity.unit_number
when I said 2.3 years, that's for the tick counter to overflow.Rseding91 wrote:You'd have to kill > 1 per tick since the creation of the map for a total of 60 per second or 3600 biters per minute.bobingabout wrote:that's like, 2.3 years of game time before a tick overflow.
4 billion units is something that is far more obtainable. all you really need to do is set up a few biter farms, and eventually it will overflow.
what happens when it does overflow?
And yes, when you consider a map is infinite, if your goal is not to clear out nests, you can quite easily run a train line, protected by laser turrets, and have a result where biters are attacking constantly. do this in enough places and you can drastically reduce the amount of time before the unit counter over flows.
Re: [0.15.16] luadoc for LuaEntity.unit_number
You don't seem to understand The map tick and unit number are both unsigned 32 bit numbers. The map tick advances at 1 per tick (obviously). The unit number only increments when a new entity using unit numbers is created. In order to cause a biter to be created you have to kill a biter which means in order to make the unit number advance faster than the map tick you would need to kill > 1 biter per game tick.bobingabout wrote:when I said 2.3 years, that's for the tick counter to overflow.Rseding91 wrote:You'd have to kill > 1 per tick since the creation of the map for a total of 60 per second or 3600 biters per minute.bobingabout wrote:that's like, 2.3 years of game time before a tick overflow.
4 billion units is something that is far more obtainable. all you really need to do is set up a few biter farms, and eventually it will overflow.
what happens when it does overflow?
And yes, when you consider a map is infinite, if your goal is not to clear out nests, you can quite easily run a train line, protected by laser turrets, and have a result where biters are attacking constantly. do this in enough places and you can drastically reduce the amount of time before the unit counter over flows.
If you want to get ahold of me I'm almost always on Discord.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: [0.15.16] luadoc for LuaEntity.unit_number
ya, I get that. a good biter farm can easily be killing 10 biters a second.
if you find a large cluster of nests, and place laser turrets just outside the firing range to hit the nests, you'll have a steady stream of biters coming to attack the turrets and die.
I'll admit, the need to actually do this on purpose isn't really needed in the current game, but in a situation where the biters drop something you need, EG added by a mod, then this setup can become pretty standard.
if you find a large cluster of nests, and place laser turrets just outside the firing range to hit the nests, you'll have a steady stream of biters coming to attack the turrets and die.
I'll admit, the need to actually do this on purpose isn't really needed in the current game, but in a situation where the biters drop something you need, EG added by a mod, then this setup can become pretty standard.