diff --git a/element/example.lua b/engine/example.lua similarity index 100% rename from element/example.lua rename to engine/example.lua diff --git a/lib/engine/init.lua b/lib/engine/init.lua index 3400181..030c150 100644 --- a/lib/engine/init.lua +++ b/lib/engine/init.lua @@ -6,7 +6,7 @@ engine.elements = {} engine.elementTypes = {} engine.element = {} -engine.paths = { mainScriptPath } +engine.paths = { mainScriptPath .. "/engine" } function engine.path(path) for i,v in pairs(engine.paths) do local fpath = v .. "/" .. path @@ -26,7 +26,7 @@ function engine.element.create(elementType) _references = 0 } - assert(loadfile(engine.path("element/" ..elementType.. ".lua")))(engine.elementTypes[elementType]) + assert(loadfile(engine.path(elementType.. ".lua")))(engine.elementTypes[elementType]) end engine.elementTypes[elementType]._references = engine.elementTypes[elementType]._references + 1 diff --git a/readme.txt b/readme.txt index 8fce44e..4b700cf 100644 --- a/readme.txt +++ b/readme.txt @@ -1,6 +1,6 @@ This is an agnostic engine that implements a simple system for creating abstract objects. You can implement any engine you want in it, and use it with this. By itself, this engine doesn't do much. You can check out my raylib-lua implementation of the engine here: https://git.lumen.sh/Fierelier/engine-raylib -- This has implementations for cameras, models, etc. -See element/example.lua to see how an element type is implemented. There are two memory regions for each element: memhi and memlo. +See engine/example.lua to see how an element type is implemented. There are two memory regions for each element: memhi and memlo. memhi: Memhi is high-level memory, this what you should generally write to. Only store numbers, strings, booleans and lists in it. Do not have references to the same list in multiple elements. This is how your game's state will be saved/loaded. You are intended to make a memhi metatable, as shown in the example element's self.create. If you, for example, make a model element, you observe changes to memhi.modelPath, and load/unload models as necessary from that change.