Abolish element path

This commit is contained in:
Fierelier 2022-11-26 02:13:11 +01:00
parent f0a20ca126
commit 66c6ef44a5
3 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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.