Page 1 of 1

Overriding engine lua files

Posted: Sun Jun 26, 2011 9:33 pm
by Hirumakai
If I want to fool around with basic engine changes in a module, such as a modifying the energy and turn system, what would be the best way to override the default engine lua files (things living in /games/engines/default/engine/ directory).

Looking at the require statements, in /game/modules/tome/load.lua for example, I see things like:

require engine.KeyBind

require mod.class.Store

mod clearly has been set to represent the module's given top directory (i.e. /game/modules/mymod/) and is going to the class directory and loading the Store.lua file.

And engine somehow knows to go to /games/engines/default/engine/ directory to grab KeyBind.lua.

Is it best to just create an engine directory under the module and redirect any engine loads you want to overload to mod.engine.MyNewEngineFile ? Or is there an alternative method that is prefered? I notice the /game/engines/default directory and wonder if the /games/engines/ was intended to contain multiple engines. Is there a method of getting engine.whatever to point at such a different directory?

Thanks.

Re: Overriding engine lua files

Posted: Sun Jun 26, 2011 9:47 pm
by Grey
Hirumakai wrote: Is it best to just create an engine directory under the module and redirect any engine loads you want to overload to mod.engine.MyNewEngineFile ? Or is there an alternative method that is prefered?
Just declare a different dependancy. Or do a bit of both - use the engine files, with certain exceptions over-riding the engine defaults. There is some built-in scope for this, such as defining keybinds in mod/load.lua.

Re: Overriding engine lua files

Posted: Sun Jun 26, 2011 10:21 pm
by darkgod
You can implement a new engine but it's a huge task, dont do it :)

If you want to change an engine class, just subclass it in your mod.class and use it instead, or if you want a completly different thing, just do it and dont base it on the engine

Re: Overriding engine lua files

Posted: Sun Jun 26, 2011 11:10 pm
by Hirumakai
I agree, I don't want to write a whole new engine. :)

Having watched Tome evolve over the many years, I recognize I don't have the time or the commitment.

Still, I'm curious about playing around with time/action system. Having taken a deeper look at how the code is implemented recently while looking at slow effects, I realized it might not be that hard to change the act() method and break it into two.

By breaking up moving/motion and action, and adding the concept of facing, one can develop linear speed, as opposed to just action speed, which allows for things like vehicles. And vector motion. Which opens an interesting playground. I have no clue if I'll go anywhere with it, but I'd like to tinker with it.

This is mostly while I want to override, or I guess sub-class, rather than rewrite the engine from scratch.

Thanks for the suggestions.

Re: Overriding engine lua files

Posted: Sun Jun 26, 2011 11:13 pm
by darkgod
Yeah just make a GameWhateverEnergy class and implement your stuff (and turn based code too).

Oh and in svn I did split up act in two, one taht works with speed and one base, works great for slow