Skip to content

How to: Cache Levels

UnbelievableFlavour edited this page Jun 8, 2022 · 1 revision

Introduction

Loading the LDtk levels json files can be a bit slow. However Nic Magnier provided us with a nice little solution to cache your games! Due to development being easier without cache this setting is disabled by default.

how to cache

Levels will automatically be cached when the cache is not being used.

  1. Set useFastLoader to false in config.lua.
  2. Run the game in the simulator.
  3. Cached cached levels are created in your PlayDate game's data directory(<playdate_sdk_location>/Disk/Data/<yourgame>/LDtk_lua_levels)

how to run cached levels

The cached files are saved in in your PlayDate game's data directory. You will have to manually copy it over.

  1. Move <playdate_sdk_location>/Disk/Data/<yourgame>/LDtk_lua_levels to <this_project>/Source/levels/LDtk_lua_levels
  2. finally enable the cache by changing useFastLoader = true in config.lua