Porting my own Veins of the Earth to LOVE

Show off your games, demos and other (playable) creations.
Zireael
Party member
Posts: 139
Joined: Fri Sep 02, 2016 10:52 am

Porting my own Veins of the Earth to LOVE

Post by Zireael »

Greetings,

I am in the process of porting my own game, Veins of the Earth to LOVE.

Semi-obligatory pic of what the game looks like, before porting:
Image

The game was originally written for T-Engine (te4.org), an open source roguelike engine which also uses Lua.

The main reason I am porting is smaller engine filesizes as well as less files/folders to manage (T-Engine has multiple subfolders) while a LOVE install is all contained in one folder. To put it in perspective, a standalone version of my game so far, stripped of everything optional (mods etc.), is 100 MB on disk while my own game's code and assets are 20 MB. LOVE engine is less than 7 MB, making the hypothetical working folder 30 MB, and the standalone executable will be even smaller because of compression inherent to .love files.

As fas as I can tell, LOVE offers everything that T-Engine does (shaders? check. framebuffers? check. particles? check.)

The game is a 2D roguelike, using tiles mainly (ASCII as fallbacks and/or a toggleable display mode). Heavy use of GUI such as buttons, tooltips, panels etc. Multiple font support, including obscure Unicode characters (think male sign or Cyrilic letters, not CJK). Maps are randomly generated so STI is not an option unless one can generate a random map with Tiled :P Also maps can sometimes be smaller than screen, but can also be much bigger.

What do you think would be useful in porting the game? Any LOVE-specific tips you can share? What libraries (especially LOVE libraries) should I look at?
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Porting my own Veins of the Earth to LOVE

Post by raidho36 »

I don't know what T-engine is so I wouldn't know the difference, and thus wouldn't know what to hint to you. I guess you could check the wiki?

I think there's a way to feed data to STI for it to generate maps. I mean it does receives it from files, it should be able to receive it from memory.

There is abundance of Lua and LÖVE-specific libraries, quick forum search will reveal plenty of options, e.g. UI library.

I see this is not very helpful but it's just so you know you're not being ignored, it's just not many have anything meaningful to tell. You haven't asked anything particular and there aren't any obvious clues as to what you need to be told about LÖVE either.

EDIT: regarding STI in particular, the critical part is:

Code: Select all

-- function new(map, plugins, ox, oy)
	map = setmetatable(love.filesystem.load(map)(), Map)
	map:init(path, plugins, ox, oy)
So it loads a plain Lua file and runs it, whatever comes out being assigned metatable "Map", and being called :init upon with file path still in order to load textures and whatnot. So, to get STI to load map from memory, you need to generate a valid backbone table for "Map" class object while bypassing the "new" function, and then work with it as if it was returned by that function. Generating proper "Map" object shouldn’t be difficult, since it's nearly identical to input .lua files.

I haven't read through the whole source (it's over 1000 lines) but this is what I immediately see as an option.
Zireael
Party member
Posts: 139
Joined: Fri Sep 02, 2016 10:52 am

Re: Porting my own Veins of the Earth to LOVE

Post by Zireael »

Yes, but I don't know which libraries are supported/developed and which are not. Everyone seems to use STI and I can't get any tips on other tile libraries. Or the libraries don't indicate which love version they are for or don't have demos. For instance, the Wiki lists six or seven GUI libraries alone and I need something that is easy to use and preferably not in one humongous file, as ROT is :P

And the second to last paragraph tells you what kind of a game it is. Roguelike, tile-based. I told you I need GUI and multiple fonts, and Unicode support.

EDIT: Thanks for that hint you added while I was writing this post. Maybe it's time to grab Tiled just to see what it outputs...
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Porting my own Veins of the Earth to LOVE

Post by raidho36 »

Yes that's the problem with community contributions, you'll have to check them out individually.

Fonts and Unicode come out of box, I didn't think that needs to be mentioned.

Now that I think of it, generating valid input file might not be the easiest approach. It certainly is easier just to generate an internally representable map and feed it to the engine than getting around compression and packing only for it to get unpacked and uncompressed immediately afterwards. But it appears the library is tightly built around loading files and has no facilities that allow to even shoehorn your own generated objects into it without giving too much trouble, so you may have to do it like this.
Zireael
Party member
Posts: 139
Joined: Fri Sep 02, 2016 10:52 am

Re: Porting my own Veins of the Earth to LOVE

Post by Zireael »

raidho36 wrote: Fonts and Unicode come out of box, I didn't think that needs to be mentioned.
Thanks.

One more thing which occurred to me: my console output sometimes gets cut off until I close the program, how do I work around it?

Is there a debug switch or something which would allow me to generate text log files, preferably with a timestamp for every line?
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Porting my own Veins of the Earth to LOVE

Post by raidho36 »

That's odd, I never experienced that. You can re-define "print" to append argument to a log file, while prepending with timestamp from os.time LUA function.
User avatar
Beelz
Party member
Posts: 234
Joined: Thu Sep 24, 2015 1:05 pm
Location: New York, USA
Contact:

Re: Porting my own Veins of the Earth to LOVE

Post by Beelz »

Add this line to the top of your main.lua so the console prints out in real-time:

Code: Select all

io.stdout:setvbuf('no')

Code: Select all

if self:hasBeer() then self:drink()
else self:getBeer() end
GitHub -- Website
Zireael
Party member
Posts: 139
Joined: Fri Sep 02, 2016 10:52 am

Re: Porting my own Veins of the Earth to LOVE

Post by Zireael »

Thanks Beelz!

Anyone can tell me how to redefine "print"? I never tried redefining pre-provided Lua functions :P
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Porting my own Veins of the Earth to LOVE

Post by raidho36 »

It can be pretty simple, but you may get fancy if you so choose.

Code: Select all

function print ( data )
  love.filesystem.append ( "log.txt", data )
end
Note that if you do this, reference to original function is permanently lost, so you might want to save it first.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Porting my own Veins of the Earth to LOVE

Post by kikito »

I have not used TOME, but read about it. I expect it will include lots of roguelike-specific parts, like Field of Vision calculation, inventory, UI...

LÖVE is more low-level. It allows you to build any game (not only roguelikes). But as a result, it doesn't provide any roguelike-specific facilities. Keep this in mind.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], rabbitboots and 54 guests