Knights Lua module system added

I’ve done quite a bit of work recently on making Knights Lua-scriptable.

  • Knights has been completely converted to use Lua for configuration. The old *.txt files in knights_data are gone.
  • “knights_data” has been split into separate “client” and “server” subdirectories.
  • A Lua module system has been implemented. Basically, a “module” is a self-contained directory that goes into knights_data/server.
  • Knights itself comes with a module called “classic” which implements the classic Knights gameplay that we all know and love.
  • Additional modules can be installed, by copying them into knights_data/server. These will modify the gameplay in various ways.
  • Modules only need to be installed on the server, not on the client machine. If the module contains graphics or sound files then these will be downloaded to the client machine as required.
  • As an example of what modules can do, I have converted ImpassIve_rus’s “multiwand” modification to be a Knights module. Installing this module on a server does two things:
    • The wand graphics are replaced so that each wand is colour coded.
    • Two new “Type of Wand” options are added: “Multiple Wands” (this adds the wand of securing and the wand of destruction at the same time); and “All Wands” (this adds all four wand types to the dungeon at the same time).
  • Users who know Lua programming can write their own modules. A module needs to contain at least one Lua code file, plus it can optionally contain new graphics and sound files.

There is a lot of documentation available on the wiki for those who want to make modules of their own.

Of course, this change is not without its disadvantages; the main one being that mod-making now requires a bit more knowledge, since you have to know Lua programming, whereas before it was just editing a txt file. However, in exchange for that, we get a lot more flexibility — you can do things in Lua code that simply aren’t possible in .txt files. I think the tradeoff is worth it.

If you do want to start Knights Lua programming and you find you don’t understand something, or run into other problems, then feel free to post on the Knights forum and I will try my best to help. I expect there to be a few “teething problems” initially, as the Lua API is new and no doubt has bugs and/or missing features. But with your help (in reporting issues), we can get those things fixed, over time 🙂

Finally, just to be clear, note that the Lua version of Knights isn’t released yet. I aim to do that by the end of August.

Tutorial improvements

For my next trick I intend to add a better tutorial to Knights. Although the current tutorial is OK, it doesn’t really explain things in a very structured way and I think it probably blasts too much information at the player at once. The result is that people get confused, don’t really understand how to play Knights, and as a result, no doubt they think the game is “rubbish” and go do something else. Whereas if they had a better understanding, they would enjoy it a lot more.

For those reasons, I have decided to do some work on the tutorial. I posted some ideas in this forum thread for those who are interested. But anyway, that is what I am going to be working on for the next couple of weeks. After that the plan would be to do a release with the new tutorial and the Lua changes.

2 thoughts on “Knights Lua module system added”

  1. I would like Knights to become a more collaborative project… I am getting bored of me doing all the work all the time 🙂

    With the Lua scripting system in place, the barrier to entry for contributors is now much lower. Hopefully people will now start coming forward and adding things to the game.

    Once again, if anyone is thinking of writing some Lua code for Knights, please post on the Knights forums – I’m more than happy to point you in the right direction and explain what to do!

Leave a Reply

Your email address will not be published. Required fields are marked *