Isometric tiled map issue

Nice demo, I like it :slight_smile:

I’d just like to add that you can use (collection) factories to draw large maps (in Kanji Adventure , the exploration map is 100x100 tiles large), you just have to create a routine that manages creation and deletion of tiles that are on-/offscreen respectively.

Oh, and one (pretty significant) performance optimization that I found out a couple days back - make sure to cut up the data that you are going to use into multiple lua tables. Accessing the following tables:

self.tile_styles = self.tilemap()["layers"][1]["data"]
self.object_styles = self.tilemap()["layers"][3]["data"]
self.large_object_styles = self.tilemap()["layers"][4]["data"]
self.grayscale_mods = self.tilemap()["layers"][5]["data"]
self.tilesets = self.tilemap()["tilesets"]

is much faster than accessing them via

local res = sys.load_resource("/maps/" .. self.map_name .. ".lua")
self.tilemap = assert(loadstring(res))

There is also a helpful list of tips on performance in Lua over at https://www.lua.org/gems/sample.pdf

3 Likes