A little rogue like test

Show off your games, demos and other (playable) creations.
Post Reply
XIX
Prole
Posts: 1
Joined: Fri Nov 18, 2011 3:06 pm

A little rogue like test

Post by XIX »

I just had a play at converting a pure lua based roguelike game (still unfinished sorry, but it is getting there :) to run under love.

Just for the hell of it really, I have a similar setup to love in terms of lua code and libs and it might be possible to push and pull some code between my projects and love since we are working along similar lines.


Hit a couple of strange problems in the process


1: was I semed to be creating zip files that love couldn't read all the files from?

The files where created with zip under linuxmint and I was testing with the packaged version of love.


2: that the module loading system in love doesnt honour the package search path within zip files.

3. The append a zip file to the end of the exe trick does not seem to work with wine which is a shame since I was thinking I could treat the windows version as "universal".

The first I solved by switching to 7zip, see atached love file, is it ok to use that? (I tested with unix/windows) will it break under mac?

The second I fixed by using a custom lua loader module, maybe it would be a good idea to remove the current C loader and replace it with a lua based loader more like this.

Code: Select all

local function loadit(modulename)
  local errmsg = ""
  -- Find source
  local modulepath = string.gsub(modulename, "%.", "/")
  for path in string.gmatch(package.path, "([^;]+)") do
    local filename = string.gsub(path, "%?", modulepath)
    if love.filesystem.exists(filename) then
      return assert(loadstring(assert(love.filesystem.read(filename) ), filename))
    else
    end
    errmsg = errmsg.."\n\tno (love) file '"..filename.."'"
  end
  return errmsg
end

-- Install the loader so that it's called just before the normal Lua loader
table.insert(package.loaders, 2, loadit)

The third is probably best ignored, its a cheap trick after all.

Cheers,

Kriss
Attachments
yarn.love
Yet Another Rogue eNgine
(53.65 KiB) Downloaded 380 times
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: A little rogue like test

Post by kikito »

Very nice! Is there a way to get back health, or not yet?
XIX wrote: 1: was I semed to be creating zip files that love couldn't read all the files from?
Your file worked for me under Ubuntu.
XIX wrote: 2: that the module loading system in love doesnt honour the package search path within zip files.
I've seen that happening when there is a folder and a file named the same way, on the same path. You can't have a yarn.lua file next to a yarn/ folder.
XIX wrote: 3. The append a zip file to the end of the exe trick does not seem to work with wine which is a shame since I was thinking I could treat the windows version as "universal".
No idea about this one.
When I write def I mean function.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: A little rogue like test

Post by bartbes »

XIX wrote: 3. The append a zip file to the end of the exe trick does not seem to work with wine which is a shame since I was thinking I could treat the windows version as "universal".
Running the windows binary with wine (even ones with games appended) has always worked for me. Alternatively, a windows binary is still a valid game, so any linux or osx version of love can run it too.
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests