Page 2 of 10
Re: Porting my own Veins of the Earth to LOVE
Posted: Fri Sep 02, 2016 6:40 pm
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
Re: Porting my own Veins of the Earth to LOVE
Posted: Fri Sep 02, 2016 6:42 pm
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)...
Re: Porting my own Veins of the Earth to LOVE
Posted: Fri Sep 02, 2016 11:05 pm
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
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.
Re: Porting my own Veins of the Earth to LOVE
Posted: Sun Sep 04, 2016 3:27 pm
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?
Re: Porting my own Veins of the Earth to LOVE
Posted: Sun Sep 04, 2016 4:48 pm
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".
Re: Porting my own Veins of the Earth to LOVE
Posted: Mon Sep 05, 2016 7:20 am
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.
Re: Porting my own Veins of the Earth to LOVE
Posted: Mon Sep 05, 2016 10:49 pm
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
Re: Porting my own Veins of the Earth to LOVE
Posted: Tue Sep 06, 2016 6:32 pm
by Zireael
Beelz, thanks!
Some in-development screen shots:
Main menu
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
Re: Porting my own Veins of the Earth to LOVE
Posted: Wed Sep 07, 2016 12:43 pm
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.
Re: Porting my own Veins of the Earth to LOVE
Posted: Thu Sep 08, 2016 6:53 pm
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!