{"author_link":"\/users\/eidolon","author_name":"Eidolon","author_uid":"eidolon","comments":[],"epoch":1543553362,"event":"LD43","format":"md","ldjam_node_id":126723,"likes":4,"metadata":{"p_key":"122708","p_author":"Eidolon","p_authorkey":"1002350","p_urlkey":"338772","p_title":"i added code hot reloading to vore","p_cat":"LDJam ","p_event":"LD43","p_time":"1543553362","p_likes":"4","p_comments":"0","p_status":"WAYBACK","us_key":"1002350","us_name":"Eidolon","us_username":"eidolon","event_start":"1543536000","event_key":"71","event_name":"LD 43"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD43","removed_author":false},"_superparent":120415,"_trust":1,"author":2350,"body":"https:\/\/github.com\/HybridEidolon\/love2d-vore-template\n\nit's under `contrib\/tinyx`\n\nfrom `doc\/SystemReload.md`:\n\nSystemReload can be used to automatically reinitialize systems during runtime.\nIt works by checking a set of file paths on an interval for updates, and rerunning\na lua chunk that exports a function for setting up world systems. It requires\nthe lua require path be unmodified from love2d's default.\n\nBootstrapping your world in `main.moon`:\n\n    world = tiny.world!\n\n    initSystems = require 'initsystems'\n    initSystems world\n\nInside `initsystems.moon`:\n\n    (world) ->\n      SystemReload = require 'tinyx.SystemReload'\n      systemInitModule = 'initsystems'\n      moduleRoots = {'systems', 'tinyx', 'sub.path'}\n\n      world\\addSystem (SystemReload systemInitModule, moduleRoots)\n\nYour systems' internal state will be destroyed on reload. This is vitally important\nto understand; you should never assume onAdd\/onRemove will only ever be called once\nor a given entity at runtime, because the systems themselves get recreated. If you\nneed things to only happen once, store that information on the entity itself.\n\nSecond, do not store references to systems or system data inside your entities'\ncomponents. This will easily break hot reloading at runtime. You need to make sure\nthat whatever is used to index system-specific data is only stored as a handle\nor index that can be recreated by that system; alternatively, on the system's\nremoval, delete those handles so that the next version of the system can recreate them.\nIf there is data that should persist between reloads, is not pure Lua data, and\nisn't tied to a specific entity (e.g. an asset manager), store it on the world\nobject because the world itself will persist between reloads.\n\nFor example: instead of storing an Image directly in an entity for use by your system\nthat handles rendering, store the string path to that resource in the entity, have a\nsystem manage loading that asset into a world-global asset manager, then index into\nthe asset manager in the render system when looking at that component again.\n\nEssentially, you need to make your systems as functionally pure as possible, and stick\nany transient state into the world itself.\n\nBonus: if you keep your systems pure and entities pure-data, you can create systems\nthat manage unique IDs for each entity. You can then have references to other entities\nin such a way that saving your game state for debugging becomes as simple as serializing\na table of every entity table in your world.\n","comments":0,"created":"2018-11-30T04:46:56Z","files":[],"files-timestamp":0,"id":126723,"love":4,"love-timestamp":"2018-11-30T09:44:50Z","meta":[],"modified":"2018-11-30T09:44:50Z","name":"i added code hot reloading to vore","node-timestamp":"2018-11-30T04:49:22Z","parent":125683,"parents":[1,5,9,120415,125683],"path":"\/events\/ludum-dare\/43\/$125683\/i-added-code-hot-reloading-to-vore","published":"2018-11-30T04:49:22Z","scope":"public","slug":"i-added-code-hot-reloading-to-vore","subsubtype":"","subtype":"","type":"post","version":368652},"node_metadata":{"n_key":"126723","n_urlkey":"338772","n_parent":"125683","n_path":"\/events\/ludum-dare\/43\/$125683\/i-added-code-hot-reloading-to-vore","n_slug":"i-added-code-hot-reloading-to-vo","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"2350","n_created":"1543553216","n_modified":"1543571090","n_version":"368652","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/43\/$125683\/i-added-code-hot-reloading-to-vore","text":"https:\/\/github.com\/HybridEidolon\/love2d-vore-template\n\nit's under `contrib\/tinyx`\n\nfrom `doc\/SystemReload.md`:\n\nSystemReload can be used to automatically reinitialize systems during runtime.\nIt works by checking a set of file paths on an interval for updates, and rerunning\na lua chunk that exports a function for setting up world systems. It requires\nthe lua require path be unmodified from love2d's default.\n\nBootstrapping your world in `main.moon`:\n\n    world = tiny.world!\n\n    initSystems = require 'initsystems'\n    initSystems world\n\nInside `initsystems.moon`:\n\n    (world) ->\n      SystemReload = require 'tinyx.SystemReload'\n      systemInitModule = 'initsystems'\n      moduleRoots = {'systems', 'tinyx', 'sub.path'}\n\n      world\\addSystem (SystemReload systemInitModule, moduleRoots)\n\nYour systems' internal state will be destroyed on reload. This is vitally important\nto understand; you should never assume onAdd\/onRemove will only ever be called once\nor a given entity at runtime, because the systems themselves get recreated. If you\nneed things to only happen once, store that information on the entity itself.\n\nSecond, do not store references to systems or system data inside your entities'\ncomponents. This will easily break hot reloading at runtime. You need to make sure\nthat whatever is used to index system-specific data is only stored as a handle\nor index that can be recreated by that system; alternatively, on the system's\nremoval, delete those handles so that the next version of the system can recreate them.\nIf there is data that should persist between reloads, is not pure Lua data, and\nisn't tied to a specific entity (e.g. an asset manager), store it on the world\nobject because the world itself will persist between reloads.\n\nFor example: instead of storing an Image directly in an entity for use by your system\nthat handles rendering, store the string path to that resource in the entity, have a\nsystem manage loading that asset into a world-global asset manager, then index into\nthe asset manager in the render system when looking at that component again.\n\nEssentially, you need to make your systems as functionally pure as possible, and stick\nany transient state into the world itself.\n\nBonus: if you keep your systems pure and entities pure-data, you can create systems\nthat manage unique IDs for each entity. You can then have references to other entities\nin such a way that saving your game state for debugging becomes as simple as serializing\na table of every entity table in your world.\n","title":"i added code hot reloading to vore","wayback_source":[]}