Basics of a Module

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
WillShattuck
Wayist
Posts: 16
Joined: Wed Feb 20, 2008 4:25 am

Basics of a Module

#1 Post by WillShattuck »

Hi DG,

I know you're working on a basic module template. I wanted to find out what are the absolute basics that need to be in a module? I'm going through the ToME module, and man there are a lot of hooks to other files and classes. :)

I copied the ToME Module, renamed the folder, edited the init.lua file to reflect my "Basic Training" module. Needless to say I've broken it many times trying to get down to just the bare minimum. For documentation sake, is it easy to list the essential files needed for a module?

Thanks,
Will

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

Re: Basics of a Module

#2 Post by darkgod »

Well technically there are only 3 required files:
* init.lua that describes the module
* load.lua that is called by the module loaded and must do whatever initialization is required then return the Game class (and the World class if the module uses persistent world data)
* the Game class, usually in class/Game.lua but it could be anything. It must extend the engine.Game class (or a subclass of it)

Obviously this wont do much, but it is the bare minimun. The main game menu for example is a module (located in game/special/mainmenu).

For a playable game you probably need to have your Game class do quite a few things and have at least a Player class that extends engine.Actor (or probably your own extension of Actor).

Most of the rest is optional, specifically the data/ files are only used by the classes that need them, so you can avoid them if you wish, although I dont see much point in that.
[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 ;)

WillShattuck
Wayist
Posts: 16
Joined: Wed Feb 20, 2008 4:25 am

Re: Basics of a Module

#3 Post by WillShattuck »

Excellent. That is exactly what I needed to know. I figured the bare essentials wasn't much, but with the depth of ToME I was having a hard time paring it down. Thanks! :)

Post Reply