Page 1 of 1

Data container for each chunk of tiles.

Posted: Fri Oct 16, 2020 8:47 am
by yagaodirac
Now I have to maintain a table to save all the extra info for each tiles in lua.
In the on_chunk_generated, I added the new chunk to the container. Inside the container, I wrote a container like table. In this way, I can easily iterate all the existing tiles of a surface.
The code is like
container = {}
container[chunk_x][chunk_y][in_chunk_x+32* in_chunk_y]
This is clear and actually works. But array in lua is slow. If staff would like to make some container in cpp and register into lua, we could keep track of water level, temperature, humidity, or any customized info for each tile. And it should be way faster than what I've done.

Re: Data container for each chunk of tiles.

Posted: Fri Oct 16, 2020 9:20 am
by Koub
[Koub] Moved to modding interface requests.

Re: Data container for each chunk of tiles.

Posted: Fri Oct 16, 2020 9:34 am
by boskid
No.