Demonstrating Kthura Map Editor

👉 BlitzCoder will be building a new platform and other plans to preserve and continue the Blitz legacy.

To be able to achieve this goal, we need your support by becoming a Patreon Paid Member 👈



Kthura Map Editor

In the YouTube video I placed above you can see how a room was created for the "Forbidden Library" dungeon, of my The Fairy Tale REVAMPED game.
TFTR uses the LAURA II engine written in BlitzMax (using Lua as scripting language), and Kthura as map system.
Kthura is an object based map editor. Although it may look tile-based at first glance, do not be fooled, as Kthura has due to its object based nature some tricks that a title based editor cannot provide.
The Kthura editor was written in BlitzMax using the MaxGUI module. Perhaps when watching this video you can see a few things Kthura can do.
Both my Fairy Tale REVAMPED and Star Story were created using Kthura and even my Sixty-Three Fires of Lung game (although written in LÖVE) uses Kthura.

I do know that Kthura is not the most user-friendly editor to use, but I guess it can be useful to those who master it. ;)

markcwm commented:

Hi Tricky,

welcome to Blitzcoder!

Kthura looks good, well done. So it's a tile editor but also works for non-tile games?

The Laura engine sounds interesting, what Lua module did you use for it?

Do you have any links to share yet?

Oh and I don't like the crazy music.

tricky commented:

Well, it's not a title editor at all... It only LOOKS like one... Now this particular place does not show it best, but perhaps this screenshot from The Fairy Tale REVAMPED does show a bit more of how Kthura can work:

LAURA II (Lua-based Advanced Utility for Role-Play and Adventure) uses MaxLua, but I created the GALE (General Allpurpose Lua Engine) around it for easier usage as MaxLua is pretty basic.

When it comes to Kthura, it's a bit of a hell to set up a project and I really need to write proper documentation for that, but once it works, it works well :)

The source code for Kthura can be found here (don't mind the C# code, as I only used that to set up a few experimental wizards, but they do not fully satisfy me yet. Kthura itself can work without that).

And if you are interested in the games created with Kthura:

BlitzCoder commented:

Hey Tricky! welcome to the forums really nice editor you got there! would be checking it out when I get a chance. cheers

markcwm commented:

Looks awesome, thanks Tricky!

I see what you mean with the screeny, Kthura looks pretty flexible. So you can use it as a tile map editor too?

I see you have made a lot of modules but I couldn't find the Laura engine, maybe I missed it.

Do you have any advice on how to start learning Lua in Bmax? Thanks.

tricky commented:

LAURA II itself can be found here ;)

I see what you mean with the screeny, Kthura looks pretty flexible. So you can use it as a tile map editor too?

Technically yes... I've made Kthura able to use a 32x32 grid for easiness when designing buildings, and then you have the feel of a tile based editor, but you can easily turn it off and then you can get the effect as with that forest you see above.

When it comes to learning Lua in BlitzMax, I'm afraid that is hard to explain, I spent a few months myself on this subject. A lot of BlitzMax coders prefered to use pub.lua which requires you a programming style that comes pretty close to attaching Lua to a C program. I've used a modified version MaxLua and then writing a Lua API will become as simple as:

Type MyLuaAPI

    Method HelloWord()
        Print "Hello World!"
    End Method

End Type

Then there's a function which I need to look up that will register the entire type into Lua (only works for Methods and Fields. Static functions are ignored) and when the type has been registered you can just type something like


in Lua and "Hello World" should appear on the console. Lua can also send integer and string values to BlitzMax in parameters and integer and string values returned by BlitzMax can be read by Lua. Even Objects can be returned into Lua. Float and Double values often cause trouble in Lua, so if you need Blitz to return a value with 3 decimals, best is to multiply it by 1000 in Blitz and make Lua divide it by 1000. Makes the code slower, but at least you won't have any unwanted behavior.

This entire folder in the LAURA II source code has been dedicated to make Blitz and Lua communicate with each other (Although some code making Lua communicate with Blitz core features are part of the GALE modules).

markcwm commented:

Oops, sorry I really didn't look hard enough.

Thanks for the explanation about Lua, that was helpful, I see it works in a similar way to a wrapper. MaxLua definitely looks a better way to go than Pub.Lua.

Well I'll have to try GALE out, it looks pretty awesome!

tricky commented:

A few notes about GALE...

  • It does call to my other modules, but as you can just download them altogether, I guess that's less of a problem
  • If you just import GALE, you will likely get errors as it uses a modified version of MaxLua which will conflict with the original MaxLua. So this require you to use the FrameWork keyword to block it out. If you have trouble getting GALE compiled (which will then also be a conflict with the original MaxLua), you can go for compiling ALL modules at once. Takes longer, I know, but I never experienced errors this way, and sometimes the result is more important than the time it takes to get it... right?


  • What I forgot to note is that GALE gets all its scripts from JCR6 files. JCR6 is a file packager similar to zip, only more sophisticated on some points I found important. If you use the 'real dir' driver for JCR6 you can just pretend your assets/scripts folder to be a JCR6 file and GALE can then work. If you wanna try JCR6 for "real", you're quite welcome to do so (I designed JCR6 myself as well), I've written some tools to create JCR6 files in Go, however in BlitzMax it only accepts "Store" and "zlib" as compression algorithms (important to know as the Go tools will use lzma as default).
markcwm commented:

Hi Tricky,

thanks for the extra info about GALE.

I'm a bit confused about JCR6 though, I see a jcr6 modscope, so that's just for reading in Blitzmax?
And we use jcr6cli in Go to create compressed jcr6 files?
I see a jcr6.realdir module so we can just import that to use as uncompressed script?

tricky commented:

jcr6.realdir can just fake an actual folder on your system to be a JCR6 indeed... It's just a driver... once it's imported then JCR_Dir("C:\MyDir") will fake C:\MyDir to be a packed JCR file yes.
Indeed the JCR6CLI tools can be used to create a compressed JCR6 file. They run from the command prompt. Like this:

C:\>jcr6 add -cm zlib -fc zlib -i C:\SourceDir C:\TargetFile.jcr

This will put all contents inside C:\SourceDir into C:\TargetFile.jcr and it works recursively so any subfolders are packaged as well. It does however not support empty folders. All files and folders prefixed with a period are ignored, due to the tool being setup to follow the Unix standards, and backslashes will inside the JCR6 file be replaced by normal slashes (even in real dir), so you should keep that in mind.

If you don't want compressed JCR6 files in GALE just add

Import jcr6.realdir

and if you do want compressed JCR6 files in GALE just add

Import jcr6.zlibdriver

The JCR6 core routines will be imported automatically in the process (and GALE also does that by itself). In BlitzMax JCR6 can be used for both reading and writng, although in BlitzMax I only have drivers for zlib and Store(= non-compression). I did try to add lzma but but I never got it working properly in BlitzMax (I did get it to work in the Go and C# versions of JCR6, though).


And I'd like to show you this picture for another Kthura demonstration.

Now this looks like a regular tile based map, right?
WRONG! I did many tricks a tile based map system could never do:

  1. The used grid is 32x32, but if you take a good look at the floor tiles, they are not 32x32, and yet Kthura managed to put them in right and nobody would notice their size is "incorrect". Even around the corners.
  2. The wall tiles are all the same, as well on the back and the sides. Kthura allows you to alter the sizes of objects.
  3. The textures used as "backwall" in the hole in the middle, are all the same. The darkness effect to make it look like a hole is the magic of Kthura.

Now I shall be honest about one thing, this game is written in LÖVE, but the map has been designed in the Kthura editor written in BlitzMax. In order not to make LÖVE process too much stuff (LÖVE is a quick engine only using 100% pure Lua code) I built in a Lua exporter in Kthura. When using the BlitzMax modules for Kthura (which btw also use JCR6 as Kthura map files are just JCR6 files in which all the data Kthura needs has been packaged) you don't need that, as those are the same modules as I used to write the editor itself.

Reply To Topic (minimum 10 characters)

Please log in to reply