Obfuscating your Lua from cheaters

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
Sophia
Concise and Honest
Posts: 4239
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Obfuscating your Lua from cheaters

Post by Sophia »

If you've created some custom Lua scripts for your dungeon and want to hide it from prying eyes, you'll need to make use of the Lua compiler.

Download luac, and put it in your DSB directory:
https://sourceforge.net/projects/luabin ... p/download
(In this example, we'll assume it's in C:\dsb)

You'll need to use the command line (cmd.exe). First, cd to your dungeon:

Code: Select all

cd \dsb\my_dungeon
Then, invoke luac on your startup file: (the ..\ is needed if you haven't added luac to your path)

Code: Select all

..\luac -s -o startup.lxx startup.lua
To obfuscate your custom objects, do:

Code: Select all

..\luac -s -o objects.lxx objects.lua
You won't typically need to do this for dungeon.lua, as your dungeon will already be compiled into DSB's own internal format in dungeon.dsb. However, if your dungeon.lua is weird (for example, it actually randomly generates a dungeon) and would normally have to be distributed in source form, you will want to obfuscate it like this instead.

Include only the .lxx, not the .lua files, when you distribute the dungeon, and your custom code is safe from cheaters. :)

Note: If you're using a lua_manifest, you won't have to change anything. DSB will automatically try to convert the last two letters of the filename to "xx" and load a compiled Lua script if it cannot find a normal Lua script.
Post Reply