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 globalsraidho36 wrote:It can be pretty simple, but you may get fancy if you so choose.
Note that if you do this, reference to original function is permanently lost, so you might want to save it first.Code: Select all
function print ( data ) love.filesystem.append ( "log.txt", data ) end
Porting my own Veins of the Earth to LOVE
Re: Porting my own Veins of the Earth to LOVE
Re: Porting my own Veins of the Earth to LOVE
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)...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.
Re: Porting my own Veins of the Earth to LOVE
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.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
Code: Select all
--main.lua
local file = require "file"
function printtolog()
end
function love.load()
end
Re: Porting my own Veins of the Earth to LOVE
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?
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
Re: Porting my own Veins of the Earth to LOVE
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
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.
I managed to do it thanks to some timely advice on IRC, though.
Re: Porting my own Veins of the Earth to LOVE
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
Re: Porting my own Veins of the Earth to LOVE
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
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
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.
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
Re: Porting my own Veins of the Earth to LOVE
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!
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!
Who is online
Users browsing this forum: No registered users and 2 guests