Overriding engine lua files

If you have a module that you'd like comments on or would like to know how to create your very own module, post here

Moderator: Moderator

Post Reply
Message
Author
Hirumakai
Thalore
Posts: 192
Joined: Wed Aug 11, 2010 2:39 pm

Overriding engine lua files

#1 Post 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.

Grey
Loremaster
Posts: 3517
Joined: Thu Sep 23, 2010 10:18 pm
Location: London, England
Contact:

Re: Overriding engine lua files

#2 Post 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.
http://www.gamesofgrey.com - My own T-Engine games!
Roguelike Radio - A podcast about roguelikes

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Overriding engine lua files

#3 Post 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
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Hirumakai
Thalore
Posts: 192
Joined: Wed Aug 11, 2010 2:39 pm

Re: Overriding engine lua files

#4 Post 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.

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Overriding engine lua files

#5 Post 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
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Post Reply