Page 1 of 2

No more than 255 tiles?

Posted: Thu Apr 30, 2020 7:12 am
by Chaos234
I report this as a bug because this game, compared to e. g. minecraft, is not written in java so I don't understand any limitation here and after all not for tiles.
Modding was implemented very early so why limitin tiles to 255 in times where PCs have at last +8 GB memory and at last a quad-core cpu with hyperthreading?

There is no reason for limiting tiles or any other stuff compared to minecraft e. g. the potions due to there potionIDs (well, they where removed later but it is only an example).

I please you, to remove it and implement a dynamic loading for this, thanks.

Re: No more than 255 tiles?

Posted: Thu Apr 30, 2020 7:21 am
by posila
"255 tile types ought to be enough for anybody." - Bill Gates, 1981

Moved to modding interface requests, I suppose.

Re: No more than 255 tiles?

Posted: Thu Apr 30, 2020 2:25 pm
by steinio

Re: No more than 255 tiles?

Posted: Thu Apr 30, 2020 5:05 pm
by Chaos234
Well, wouldn't it possible to check if an game instance is loading more than the "base" mode?

If "yes" > Modded Game > Allow more than 255 tiles at own risk
If "No" > Let the limit untouched because nothing todo here (or maybe reduce it, if possible)

Or is this not possible atm?

Re: No more than 255 tiles?

Posted: Thu Apr 30, 2020 6:04 pm
by Rseding91
Chaos234 wrote:
Thu Apr 30, 2020 5:05 pm
Well, wouldn't it possible to check if an game instance is loading more than the "base" mode?

If "yes" > Modded Game > Allow more than 255 tiles at own risk
If "No" > Let the limit untouched because nothing todo here (or maybe reduce it, if possible)

Or is this not possible atm?
It's not possible. You would have to compile and ship a different version of the game for it to work.

We store tiles on a chunk as an array<array<Tile, 32>, 32>

Where each Tile has:

TileID (1 byte)
Variation (1 byte)

So each Tile is 2 bytes big, that means the entire array of tiles on a chunk is 32 * 32 * 2 tiles big or: 2048 bytes big.

That's a compile time constant and you can't dynamically change it runtime.

Re: No more than 255 tiles?

Posted: Fri May 01, 2020 8:22 am
by GeneralTank
Rseding91 wrote:
Thu Apr 30, 2020 6:04 pm
Chaos234 wrote:
Thu Apr 30, 2020 5:05 pm
Well, wouldn't it possible to check if an game instance is loading more than the "base" mode?

If "yes" > Modded Game > Allow more than 255 tiles at own risk
If "No" > Let the limit untouched because nothing todo here (or maybe reduce it, if possible)

Or is this not possible atm?
It's not possible. You would have to compile and ship a different version of the game for it to work.

We store tiles on a chunk as an array<array<Tile, 32>, 32>

Where each Tile has:

TileID (1 byte)
Variation (1 byte)

So each Tile is 2 bytes big, that means the entire array of tiles on a chunk is 32 * 32 * 2 tiles big or: 2048 bytes big.

That's a compile time constant and you can't dynamically change it runtime.
Even of it costs me an extra Gigabyte or more in memory and a slight performance hit I would take the increased flexibility of having more space for tiles than currently.

Right now you only need 4 mods to hit the limit

Dectorio
Alien Biomes
Asphalt Roads
Krastorio 2

Now because 1.0 is likely more inportant than increasing the limit but it's something that will have to be fixed with sooner or later as this topic will be keep coming back. A temporary solution would be in the in game mod download page and the mod option list the number of tiles a mod would add, how many active per mod and the total amount of tiles active. This would save a lot of trial and error and would let people know how many tiles are currently loaded (or will be loaded).

Re: No more than 255 tiles?

Posted: Fri May 01, 2020 8:56 am
by steinio
Alien biomes tells you in the log which tiles are loaded and which not...

Ah BTW it also let you disable alien tiles to make room for other mods.

Re: No more than 255 tiles?

Posted: Fri May 01, 2020 5:15 pm
by Rseding91
GeneralTank wrote:
Fri May 01, 2020 8:22 am
Even of it costs me an extra Gigabyte or more in memory and a slight performance hit I would take the increased flexibility of having more space for tiles than currently.

Right now you only need 4 mods to hit the limit

Dectorio
Alien Biomes
Asphalt Roads
Krastorio 2

Now because 1.0 is likely more inportant than increasing the limit but it's something that will have to be fixed with sooner or later as this topic will be keep coming back. A temporary solution would be in the in game mod download page and the mod option list the number of tiles a mod would add, how many active per mod and the total amount of tiles active. This would save a lot of trial and error and would let people know how many tiles are currently loaded (or will be loaded).
It's not going to happen. It would be a memory and performance hit for *every single base game player regardless of them using mods* - that's not going to happen.

Re: No more than 255 tiles?

Posted: Sat May 02, 2020 12:57 pm
by GeneralTank
steinio wrote:
Fri May 01, 2020 8:56 am
Alien biomes tells you in the log which tiles are loaded and which not...

Ah BTW it also let you disable alien tiles to make room for other mods.
Not as easy as just seeing a number in the in game mod portal. Basically I want the ability to see i real time in game if enabling a mod or an option in a mod would send me over the 255 limit.

Re: No more than 255 tiles?

Posted: Mon Aug 21, 2023 7:20 am
by spiro9
Rseding91 wrote:
Fri May 01, 2020 5:15 pm
It's not going to happen. It would be a memory and performance hit for *every single base game player regardless of them using mods* - that's not going to happen.
Wouldn't this be inevitable in the future, anyways? If a major content update is ever released, or Factorio nears the end of its development (implication: community patches), wouldn't an increase in tile limit become absolutely necessary to still allow tile modding?

Re: No more than 255 tiles?

Posted: Mon Aug 21, 2023 12:18 pm
by Rseding91
spiro9 wrote:
Mon Aug 21, 2023 7:20 am
Rseding91 wrote:
Fri May 01, 2020 5:15 pm
It's not going to happen. It would be a memory and performance hit for *every single base game player regardless of them using mods* - that's not going to happen.
Wouldn't this be inevitable in the future, anyways? If a major content update is ever released, or Factorio nears the end of its development (implication: community patches), wouldn't an increase in tile limit become absolutely necessary to still allow tile modding?
Maybe. I don't know the future.

Re: No more than 255 tiles?

Posted: Mon Aug 28, 2023 4:00 pm
by Rseding91
As part of the Space Age work we had to bite the bullet and change tiles to support up to 65'000~ tiles. It means more memory used and potentially save file size but it's now going to be there.

Re: No more than 255 tiles?

Posted: Mon Aug 28, 2023 7:01 pm
by spiro9
Rseding91 wrote:
Mon Aug 28, 2023 4:00 pm
As part of the Space Age work we had to bite the bullet and change tiles to support up to 65'000~ tiles. It means more memory used and potentially save file size but it's now going to be there.
Rseding91 wrote:
Mon Aug 28, 2023 4:00 pm
up to 65'000~ tiles.
Holy tile space, Batman!

Re: No more than 255 tiles?

Posted: Tue Aug 29, 2023 12:02 am
by curiosity
Rseding91 wrote:
Mon Aug 28, 2023 4:00 pm
As part of the Space Age work we had to bite the bullet and change tiles to support up to 65'000~ tiles. It means more memory used and potentially save file size but it's now going to be there.
When you eventually mark this as implemented, don't forget about viewtopic.php?f=28&t=103485

Re: No more than 255 tiles?

Posted: Tue Aug 29, 2023 5:50 am
by vjbone
Actually sad that you could not find a way to avoid limit increase

Re: No more than 255 tiles?

Posted: Tue Aug 29, 2023 8:45 am
by Nidan
spiro9 wrote:
Mon Aug 28, 2023 7:01 pm
Rseding91 wrote:
Mon Aug 28, 2023 4:00 pm
up to 65'000~ tiles.
Holy tile space, Batman!
The limit of 255 tiles means that they're stored in one byte currently. The next larger reasonable size is two bytes, which gets us 2^16-1 or 65535 tiles.


A middle ground between expanded tile limit and memory use could have been using 12 bit per tile, but a) it's awkward to read and b) only makes sense if there's something to fill the second half of the second byte, otherwise it'll get rounded up to 2 bytes anyways. The limit for 12 bit would have been 4095 tiles.

Re: No more than 255 tiles?

Posted: Fri Sep 01, 2023 6:12 pm
by pleegwat
Nidan wrote:
Tue Aug 29, 2023 8:45 am
spiro9 wrote:
Mon Aug 28, 2023 7:01 pm
Rseding91 wrote:
Mon Aug 28, 2023 4:00 pm
up to 65'000~ tiles.
Holy tile space, Batman!
The limit of 255 tiles means that they're stored in one byte currently. The next larger reasonable size is two bytes, which gets us 2^16-1 or 65535 tiles.


A middle ground between expanded tile limit and memory use could have been using 12 bit per tile, but a) it's awkward to read and b) only makes sense if there's something to fill the second half of the second byte, otherwise it'll get rounded up to 2 bytes anyways. The limit for 12 bit would have been 4095 tiles.
Awkwardness to read isn't that bad. There are C/C++ language constructs to assemble these bit fields, or the bits of extra data can be relegated to the top of the half-word and simply ANDed out. The second point is more applicable - there isn't anything in the 1-4 bit range you'd want to store per tile and save yourself the time to look up the tile, and things like 'tile variants' can just be handled by duplicating the base tile. A one-off 64k slot lookup table isn't expensive enough to worry about.

I do wonder whether it would have been possible to stay under the 255 tile limit if that limit were applied on a per-surface basis.

Re: No more than 255 tiles?

Posted: Sat Sep 02, 2023 6:30 pm
by TheKillerChicken
If every byte was set to the true 64-bit integer (1 decellion), this game would need ~200 TB of memory. So that is why these practical values exist.

Re: No more than 255 tiles?

Posted: Sat Sep 02, 2023 10:40 pm
by BicycleEater
Rseding91 wrote:
Mon Aug 28, 2023 4:00 pm
As part of the Space Age work we had to bite the bullet and change tiles to support up to 65'000~ tiles. It means more memory used and potentially save file size but it's now going to be there.
YESSSSS

Re: No more than 255 tiles?

Posted: Sun Sep 03, 2023 8:00 pm
by DarkShadow44
TheKillerChicken wrote:
Sat Sep 02, 2023 6:30 pm
If every byte was set to the true 64-bit integer (1 decellion), this game would need ~200 TB of memory. So that is why these practical values exist.
I have no idea where you got that number from. If you were to use a 64bit integer instead of a byte for the tile id, you'd need 8 times as much memory for tile id storage. Nothing else.