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

Re: Porting my own Veins of the Earth to LOVE

Post by Zireael »

raidho36 wrote: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.
Hmm, so I might want to make a printtolog function that is separate. Hmm, where to stick it so that anything can access it? I tend to work with multiple .lua files with locals, so I'm stumped when it comes to globals :P
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 »

kikito wrote: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.
Yes I know. Fortunately there's the ROT library as well as well, the open source code of T-Engine. Once I get the basics working (tiles, argh!) the rest should come quickly. After all there is nothing stopping me from copy-pasting the functions that don't rely on any particular library (that is, actor parts such as life, combat, skills, spells)...
User avatar
ivcore
Prole
Posts: 2
Joined: Sat Jul 02, 2016 6:35 am
Location: Caracas.

Re: Porting my own Veins of the Earth to LOVE

Post by ivcore »

Zireael wrote:Hmm, so I might want to make a printtolog function that is separate. Hmm, where to stick it so that anything can access it? I tend to work with multiple .lua files with locals, so I'm stumped when it comes to globals :P
I don't have that much experience, but, when you start a .love program or open a folder through love.exe, the first file read is main.lua, and all the other files are required from that one, so you could try to stick it in the main file. Correct me if I'm wrong.

Code: Select all

--main.lua
local file = require "file"

function printtolog()
end

function love.load()
end

Or maybe you could create it inside love.load()... I'm not sure, tho.
:monocle:
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 »

Attached is what I have after 3 days of using LOVE:

A simple map, two (motionless for now) orcs and a moving player character. I have been trying to make the game turn-based.

However I seem to have coded the pausing wrong. For the player to move, he needs to hit the button exactly when his turn comes up. Obviously it's not intended. The game should pause, let the player do whatever and only then resume doing turns.
Can someone help me fix it?
Attachments
turns.love
(821.13 KiB) Downloaded 121 times
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 »

There's two basic way entities can operate in a game: fend for themselves, or be controlled externally. You need latter for a turn-based game. So you need a turn manager, which calls "make_turn" (you get the idea) on particular entity if it is its turn, and just cycle through them, thus making them take turns. For AI controlled entity you can just put a script in there, if it's player's turn you should make it wait until the player is done making a turn, and then carry out the input commands. Such as call a function that allows input from that particular player, and when player is done, it calls according function on the turn manager for it to apply inputs. You can in principle apply this to every entity and not just live users, it's just it doesn't makes as much sense with AI as it does with humans so you can choose the "easy way".
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 »

Actually I had a turn manager actually but couldn't figure out the blocking/waiting part.

I managed to do it thanks to some timely advice on IRC, though.
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 »

I made basically an update manager for an attempted TBS game a few months ago, but never did anything with it... I just pulled it from the project and made a small mockup, maybe it'll help you somehow. (keep in mind the classes are not optimized in the least. I just gave quick inheritance)

Code: Select all

WASD -- Control Players
Return -- End Turn
TBSM_0_0_2.love
Turn Based Strategy Manager
(1.45 KiB) Downloaded 133 times

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 »

Beelz, thanks!

Some in-development screen shots:

Image
Main menu

Image
Game screen

As you see, I have a rudimentary level made. Terrain, monsters and objects spawn and monsters path to the target (the player). The GUI is yet to be improved and also I need to make all the dialogs/panels that the game uses (create character, level up, chat boxes etc.) However I believe in a couple of days I will be able to start porting the actual content - monsters, items, what have you - instead of the most basic stuff required to get the game going. Level generation will be fun, I guess :D
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 »

Here's what I have now, less than a week since starting with LOVE.

Map, player, items, monsters are all in. Basic player GUI is in (you can see in the previous post that it's shaping to be somewhat different from the original). The game is turn-based and you can use the mouse to move, it'll pathfind the same way the monsters do (A*). The basic inventory code is in, ported from T-Engine. I will have to make my item placement more robust, allowing for multiple items on a tile, and then work on the UI so that one can interact with the inventory.

Zerobrane's debugging is a godsend. I can whip up a couple of break points and watch the variables until I figure out what isn't being passed/what is unexpectedly being set to nil.
Attachments
test.love
(1.15 MiB) Downloaded 137 times
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 »

Some more tests of area generation.

Looks like player placement sometimes gets weird in the test case. Can anyone test and help me fix the bug where 1) mouse click to go doesn't work and 2) player tile on map gets doubled? I think I know the reason (game thinks the player is at 1,1 while it's not) but how do I fix it?

Please download the .love and help!
Attachments
dev3.love
(1.15 MiB) Downloaded 108 times
dev2.love
(1.15 MiB) Downloaded 115 times
dev.love
(1.15 MiB) Downloaded 106 times
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests