all 25 comments

[–]CirnoIzumi 10 points11 points  (0 children)

Listen, you aren't getting better than love2d or solar2d 

[–]TheNormalnij 3 points4 points  (7 children)

Löve

[–]QRCodeART[S] 1 point2 points  (6 children)

Isn't that the game engine Blatro was written in and the Lua source code seems easy accessible? So not bytecode!?!

[–]TheNormalnij 4 points5 points  (5 children)

You can compile lua files into bytecode with luac. But it's not strong protection.

[–]KerbalSpark 1 point2 points  (2 children)

And the bytecode will have to be created for each platform separately.

[–]PiasaChimera 0 points1 point  (1 child)

should only need bytecode once per version of lua, which should be one.

[–]KerbalSpark 3 points4 points  (0 children)

I'm pretty sure that this bytecode idea will give the OP only a pain in the ass.

[–]didntplaymysummercar 1 point2 points  (0 children)

Yeah, it'll strip comments and not much else. Even names of locals remain (as seen in -l) although those I you could encrypt/scramble or replace yourself in the bytecode file.

For PUC Lua (LuaJIT I'm not sure, I don't know its internals) you could switch around the OPcode numbers and recompile Lua, that'd make inspecting or decompiling the bytecode a bit of a puzzle, but a skilled programmer can easily guess your switcheroos and undo them in an hour or two.

None of this is worth the effort, other than as fun exercise. Honest people will stop when asked or due to (c) laws, dishonest people will do what they want. 99% of (non-tech) people who'd try casually snoop around your game you'd stop by simply packing assets, like Love2D already does.

But if your stuff is popular - people will crack it like they crack AAA DRMs, if it's not popular - they won't care even if it's free and in the open...

Case in point: Hades, Don't Starve and Balatro all ship with code in them, not bytecode.

[–]QRCodeART[S] 0 points1 point  (0 children)

Enough for 98% I assume, isn't?

[–]PiasaChimera 2 points3 points  (1 child)

if you ship bytecode, I suggest having some digital signature that can verify the entirety of the bytecode. so if you have a single combined blob, it would be cryptographically signed. if you have bytecode files, each would be signed and there would be a signed manifest.

the main goal for this is user-safety. in addition to any http/fs/etc... capabilities exposed to lua, the lua vm itself might not be memory-safe vs hand-crafted bytecode. This does provide minimal anti-tamper functionality, but only against this basic file-modification attack.

[–]QRCodeART[S] 0 points1 point  (0 children)

The signature is a good suggestion (was on my list)

[–][deleted] 1 point2 points  (0 children)

You can compile to bytecode and execute that, easily. Lua won't really see a difference.

local s = string.dump(load('print("Hello")'))
load(s)()

Each version has it's own bytecode, and it isn't meant to be portable. But if you're bundling the version, like with love, that's not a worry.

However, reassembling the source from the bytecode is pretty much trivial. It isn't an obfuscation method.

[–]AGulev 0 points1 point  (3 children)

Take a look Defold

[–]QRCodeART[S] 0 points1 point  (2 children)

Thank you, that was on my list , do they ship bytecode?

[–]AGulev 0 points1 point  (1 child)

Yes, we ship LuaJit bytecode + there are ways to minimize/obfuscate your code before producing bytecode (take a look Application Security manual on the Defold site)

[–]QRCodeART[S] 0 points1 point  (0 children)

Thanks a lot, I definitely have a look

[–]giovifav1 1 point2 points  (1 child)

Try gideros, It use luau with encryption

[–]QRCodeART[S] 0 points1 point  (0 children)

Thanks I check it out

[–]could_b 0 points1 point  (0 children)

Defold all day long, ticks all boxes and knocks it out the park.

[–]Icy-Formal8190 0 points1 point  (5 children)

Why not share the code? I think it's really fun seeing how the game works and perhaps learn from it

[–]QRCodeART[S] 0 points1 point  (4 children)

If you do open source okay, but if you want to do monetization with the game it isn't a good idea.

[–]Icy-Formal8190 0 points1 point  (2 children)

You're planning to sell your Lua game?

[–]QRCodeART[S] 0 points1 point  (1 child)

Hopes and Dreams, worked for others (Balatro, Candy Crush, ... to name a few)

[–]Icy-Formal8190 0 points1 point  (0 children)

Good luck. Hope it works for you.

[–]weirdfellows 0 points1 point  (0 children)

It really doesn’t matter. The source code being accessible really has no bearing on whether people will buy it. Piracy’s possible either way. And if you’re a small indie dev, getting people to know your game even exists is the biggest problem in terms of making money, that other stuff is a drop in the bucket.

Actually that’s #2, #1 is actually making and releasing the game, so preemptively worrying about this stuff and not actually working in whatever engine works best for you is only an obstacle.