Closed source love2d games...

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

Re: Closed source love2d games...

Post 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...
twitter | steam | indieDB

Check out quadrant on Steam!
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Closed source love2d games...

Post 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
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Closed source love2d games...

Post 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.
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

Re: Closed source love2d games...

Post by adnzzzzZ »

Thanks for writing this, Herry.
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: Closed source love2d games...

Post by Azhukar »

Damn I was looking in the wrong place.
gianmichele
Citizen
Posts: 66
Joined: Tue Jan 14, 2014 11:03 pm

Re: Closed source love2d games...

Post by gianmichele »

Would be interesting to know how you did it.
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Closed source love2d games...

Post 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.
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
szensk
Party member
Posts: 155
Joined: Sat Jan 19, 2013 3:57 am

Re: Closed source love2d games...

Post 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.
herrybiscuit
Prole
Posts: 5
Joined: Mon Dec 15, 2014 8:37 pm
Contact:

Re: Closed source love2d games...

Post 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++
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Closed source love2d games...

Post 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.
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest