Page 2 of 5
Re: Closed source love2d games...
Posted: Tue Dec 16, 2014 10:10 am
by undef
Robin wrote:Minor point: this thread is about hidden source, not closed source. Everything that falls under copyright law is closed source by default.
Really? But that would make every open source software a free software...
Re: Closed source love2d games...
Posted: Tue Dec 16, 2014 10:39 am
by vrld
undef wrote:Really? But that would make every open source software a free software...
Nope, if anything, it's the other way around. Free software means that the license of the code must meet certain standards. See also
here.
Back to the original topic: While you certainly make it harder to get to the code, it is still there, embedded into love.dll. Case in point, this is your code (extracted using a text editor):
Code: Select all
angle = 0
function love.draw()
love.graphics.translate(500,200)
love.graphics.rotate(math.rad(angle))
love.graphics.rectangle("fill", 0, 0, 60, 120 )
angle = angle + 20
end
And your love.conf:
Code: Select all
function love.conf(t)
t.title = "Proof of concept" -- The title of the window the game is in (string)
t.author = "HerryBiscuit" -- The author of the game (string)
t.identity = nil -- The name of the save directory (string)
--t.version = 0.9 -- The LÖVE version this game was made for (number)
t.console = false -- Attach a console (boolean, Windows only)
t.window.width = 800 -- The window width (number)
t.window.height = 600 -- The window height (number)
t.window.fullscreen = false -- Enable fullscreen (boolean)
t.window.vsync = true -- Enable vertical sync (boolean)
t.window.fsaa = 0 -- The number of FSAA-buffers (number)
t.modules.joystick = false -- Enable the joystick module (boolean)
t.modules.audio = true -- Enable the audio module (boolean)
t.modules.keyboard = true -- Enable the keyboard module (boolean)
t.modules.event = true -- Enable the event module (boolean)
t.modules.image = true -- Enable the image module (boolean)
t.modules.graphics = true -- Enable the graphics module (boolean)
t.modules.timer = true -- Enable the timer module (boolean)
t.modules.mouse = true -- Enable the mouse module (boolean)
t.modules.sound = true -- Enable the sound module (boolean)
t.modules.physics = false -- Enable the physics module (boolean)
end
Re: Closed source love2d games...
Posted: Tue Dec 16, 2014 11:22 am
by bartbes
And I should have read on and noticed vrld had beat me to it, but I opened a hex editor and found two files directly below boot.lua:
Code: Select all
angle = 0
function love.draw()
love.graphics.translate(500,200)
love.graphics.rotate(math.rad(angle))
love.graphics.rectangle("fill", 0, 0, 60, 120 )
angle = angle + 20
end
Code: Select all
function love.conf(t)
t.title = "Proof of concept" -- The title of the window the game is in (string)
t.author = "HerryBiscuit" -- The author of the game (string)
t.identity = nil -- The name of the save directory (string)
--t.version = 0.9 -- The LÖVE version this game was made for (number)
t.console = false -- Attach a console (boolean, Windows only)
t.window.width = 800 -- The window width (number)
t.window.height = 600 -- The window height (number)
t.window.fullscreen = false -- Enable fullscreen (boolean)
t.window.vsync = true -- Enable vertical sync (boolean)
t.window.fsaa = 0 -- The number of FSAA-buffers (number)
t.modules.joystick = false -- Enable the joystick module (boolean)
t.modules.audio = true -- Enable the audio module (boolean)
t.modules.keyboard = true -- Enable the keyboard module (boolean)
t.modules.event = true -- Enable the event module (boolean)
t.modules.image = true -- Enable the image module (boolean)
t.modules.graphics = true -- Enable the graphics module (boolean)
t.modules.timer = true -- Enable the timer module (boolean)
t.modules.mouse = true -- Enable the mouse module (boolean)
t.modules.sound = true -- Enable the sound module (boolean)
t.modules.physics = false -- Enable the physics module (boolean)
end
Starting at an offset of roughly 0x0025560C in love.dll.
Re: Closed source love2d games...
Posted: Tue Dec 16, 2014 11:52 am
by adnzzzzZ
Thanks for writing this, Herry.
Re: Closed source love2d games...
Posted: Tue Dec 16, 2014 1:22 pm
by Azhukar
Damn I was looking in the wrong place.
Re: Closed source love2d games...
Posted: Tue Dec 16, 2014 4:41 pm
by gianmichele
Would be interesting to know how you did it.
Re: Closed source love2d games...
Posted: Tue Dec 16, 2014 4:49 pm
by vrld
gianmichele wrote:Would be interesting to know how you did it.
In case "you" means bartbes or myself: Open love.dll in vim (or any decent text editor) and search for "Proof of concept". Done.
Re: Closed source love2d games...
Posted: Tue Dec 16, 2014 8:18 pm
by szensk
I think the only useful method of 'hiding' the source is compiling to bytecode (luajit -b mycode.lua mycode.out). Then the visible source is simply a shim that adds a bytecode loader. Of course, there are disassemblers and people still could easily distribute modified versions of your game.
This is also a really bad idea on platforms where you don't ship Love with your game, since LuaJIT (and her bytecode) may change. For example, I've produced
a proof of concept but it will only work with the latest builds (with LuaJIT 2.1.0). So more useful is the code:
main.lua
Code: Select all
local bc, size = love.filesystem.read('main.out')
loadstring(bc)()
conf.lua
Code: Select all
function love.conf(t)
local bc, size = love.filesystem.read('conf.out')
local f = loadstring(bc)
setfenv(f, t)
f()
end
Using the old main.lua and conf.lua: main.out is created by luajit -b main.lua main.out and conf.out is created by replacing t. with _G. in conf.lua then running luajit -b conf.lua conf.out. I suspect the best way to do this is to create a package loader.
Re: Closed source love2d games...
Posted: Wed Dec 17, 2014 12:01 am
by herrybiscuit
vrld wrote:Back to the original topic: While you certainly make it harder to get to the code, it is still there, embedded into love.dll. Case in point, this is your code (extracted using a text editor):
damn.. i did not know this was possible... ill have to figure out a workaround.,. BACK TO THE DEV CAVE!
even if i can't avoid this problem then ill just slap some copyright or something to say not to extract the source or ill just go back to SDL C++
Re: Closed source love2d games...
Posted: Wed Dec 17, 2014 9:21 am
by Robin
herrybiscuit wrote:even if i can't avoid this problem then ill just slap some copyright or something to say not to extract the source or ill just go back to SDL C++
Legally, that's the default anyway. But what seems to work well is guilt-tripping: "pls don't use my source code I need the money ppl throw at my game to feed my cats, you don't want to be responsible for the malnutrition and eventual death of my cats, do you? LOOK AT HOW CUTE MY DYING CATS ARE! let them live, I beg of you"
Something like that.