r/love2d • u/Inesh23 • Aug 17 '26
How to Obfuscate and Protect Source Code of My Love2D game?
I don't want people to steal the code and republish my game because I put a lot of work into it and I want to protect my own hardwork/intellectual property.
I can't find any good lua obfuscators online, does anyone know any good methods to obfuscate source code. I want to be able to remove comments, have random variable names and remove whitespaces
0
Upvotes
30
u/Tjakka5 Aug 17 '26
You dont. Obfuscation doesn't help with that. A good license does.
38
u/ruairidx Aug 17 '26 edited Aug 17 '26
I didn't do this for any of my games, not really sure why you would. Two main reasons to not obfuscate:
Obfuscation doesn't prevent this (especially with LLMs). Nothing does really. But it's honestly much less of a problem than you'd think and not worth worrying about. Republishing games isn't trivial and definitely isn't guaranteed to be successful. People are also going to pirate your game no matter what you do. None of this will eat into your sales in a meaningful way. Just focus on the game. Good luck!
11
u/ravenravener Aug 17 '26
There's plenty of obfuscators if you google, here's one
https://github.com/prometheus-lua/Prometheus
You could also consider shipping the compiled bytecode but this comes with some challenges when distributing to different platforms and would not allow publishing a .love
https://love2d.org/wiki/Source_Obfuscation
6
u/Slight-Living-8098 Aug 17 '26
IT wouldn't matter really. If someone wants to reverse engineer your game, they will. You should make the code easily readable and followable so the fans and modders can go wild with it. That's where your fan base and revenue actually grows.
6
u/Calaverd Aug 17 '26
Well, usually the stuff people actually do:
Maybe your best bet is moving the parts you care about into a C library and calling it through FFI, but again, is way more work.🤔
but tbh, what are you protecting against? if it's someone lifting your code, obfuscation buys you a bit of time. if it's piracy, none of it matters, people just share the whole binary. For indie stuff the actual moat is the art and the feel, not so much the code 🙂
7
u/DPS2004 Aug 17 '26
Realistically all that obfuscation will do is annoy modders, who if your game gets popular enough will be among your biggest fans and supporters, so it's just not worth it. If you're worried about people just stealing and republishing your game like has happened with Godot games, love2D isn't a well enough known engine for people to bother with getting their repackaged game to work on the web in most cases.
2
u/MattDTO Aug 17 '26
people can always clone your game without the source code. i wouldnt worry about it
1
u/Intelligent_Art_7565 Aug 17 '26
I mean, I wouldn't really worry about it people will reverse engineer it... obfuscation doesn't really do too much, especially in the age of AI which can figure it out. If you have some next level optimized code a license may help or patent it like WB and the nemesis system... but chances are they would reject it.
1
u/MisterSheep404 Aug 18 '26
Maybe you can use luajit on your .lua file
1
u/StephenRoylance Aug 22 '26
kinda pointless these days. AI can de-obfuscate really easily, and it doesn't even need to. The current frontier models can just read the obfuscated code and understand it.