Page 6 of 10

Re: Porting my own Veins of the Earth to LOVE

Posted: Tue Oct 18, 2016 7:41 am
by Zireael
I've integrated the astray library for generating dungeons.

The map drawing code has been improved and cleaned up. The mysterious offset which sometimes happened to sprites/labels/overlays doesn't happen anymore. Turns taking by monsters is now more performant, without the debug pause in between.

I also tried to make the camera viewport work, but it isn't working as it should - it doesn't follow the player and it doesn't stop at lg.getHeight()-70, only at window edge. I will probably need a hand there!

Re: Porting my own Veins of the Earth to LOVE

Posted: Wed Oct 19, 2016 7:08 pm
by Zireael
I finally have a working viewport code, thanks to replacing hump's camera lib with gamera. The map drawing code has been optimized to draw only in camera viewport.

The test case is the test room upped to 40x40. The camera is 640 px x 640 px, starting at x = 120 px to account for the HUD on the left side.
I left the space at the bottom empty (default window height is 768 px) since this is where the second HUD part will go.
640 px is a nice multiple of both 32 and 64, as I plan to switch to 64x64 tiles as default at some point and then offer a zoom in/out functionality.

I also fixed an issue that kikito spotted while helping me out (a missed call to loadfile(), which doesn't work in .love form).

Re: Porting my own Veins of the Earth to LOVE

Posted: Fri Oct 21, 2016 6:01 pm
by Zireael
You can now drop items from inventory.

I've also begun working on a player-oriented turns display - at the top left corner of game area. However it has empty space where the non-visible entities would be. I need to somehow make a table without the non-visible entities while preserving the ordering. The player sprite at the top of game area that doesn't really move is part of that display.
Just walk around and pick up some things - this should bring some NPCs to investigate and you can see it in action.

How do I do filter the entities table? So that I can get rid of the empty space? I've already got some code which only grabs the visible entities, but the resulting table has a vastly differing ordering.

Re: Porting my own Veins of the Earth to LOVE

Posted: Fri Oct 21, 2016 9:37 pm
by rmcode
Coming along nicely.

Getting this error when trying to get into the game:

Code: Select all

Error: cannot open data/calendar.lua: No such file or directory
stack traceback:
	[C]: in function 'dofile'
	T-Engine/Calendar.lua:46: in function 'init'
	T-Engine/class.lua:82: in function 'new'
	gamemodes/game.lua:54: in function 'load'
	gamefunctions.lua:20: in function 'loadGamemode'
	gamemodes/menu.lua:12: in function 'keypressed'
	main.lua:56: in function <main.lua:53>
	[string "boot.lua"]:454: in function <[string "boot.lua"]:435>
	[C]: in function 'xpcall'

Re: Porting my own Veins of the Earth to LOVE

Posted: Sat Oct 22, 2016 10:21 am
by Zireael
Sorry about that :oops: , I missed a dofile() call when porting code.

Along the way, I fixed that "empty space" in player turn order display problem. The turn order updates with a slight delay, I will have to look into moving the relevant function somewhere earlier, but it's fully functional!

That means 90% of the UI is functional, time to improve the Area code so that it can change levels (stairs, whatever) and load areas from data. Hopefully without repeating the dofile() whoopsies with other data-loading functions ported lol.
Then it's time for content... The T-Engine game had 39 areas and a ton of items and NPCs to find.

Re: Porting my own Veins of the Earth to LOVE

Posted: Sun Oct 23, 2016 7:06 pm
by Zireael
I heard back from an artist I contacted regarding his tileset. His reply was positive, so I sat down and implemented something that's been tickling the back of my brain ever since I saw the capabilities of LOVE2D.

https://love2d.org/imgmirrur/I0kvAWy.gif
Zooming in (64x64) or out (32x32) at will - an animated GIF

You press Shift + to zoom in and Shift - to zoom out. For those who don't know, + and - are the keys right next to numbers, above the letter keys. The map UI scales to fit (the grid, the border around moused-over tile, the ellipses indicating the actor's attitude, the damage splashes).

You can see the tiles for the actors change, but not for items, which are offset a bit compared to 32x32, and terrain is simply scaled up for now (however I plan to find some good-looking walls in the bigger size). So it's not simply "scale up stuff".

I am thinking on what to name the two modes - "zoomed in" and "zoomed out" sounds silly. I plan to implement some indicators that would be visible only in the "zoomed in" mode (because of the larger amount of space per tile, simply), such as a number telling you how many items are there in a tile or a small icon indicator (8x8?) for monsters which have special abilities of some kind. (Said special abilities aren't implemented yet)

Re: Porting my own Veins of the Earth to LOVE

Posted: Sun Oct 23, 2016 8:21 pm
by pgimeno
Zireael wrote:You press Shift + to zoom in and Shift - to zoom out. For those who don't know, + and - are the keys right next to numbers, above the letter keys.
That doesn't work in my keyboard. You'd be better off using the scancode argument provided by LÖVE 0.10 for that purpose.

Re: Porting my own Veins of the Earth to LOVE

Posted: Mon Oct 24, 2016 7:57 am
by Zireael
pgimeno wrote:
Zireael wrote:You press Shift + to zoom in and Shift - to zoom out. For those who don't know, + and - are the keys right next to numbers, above the letter keys.
That doesn't work in my keyboard. You'd be better off using the scancode argument provided by LÖVE 0.10 for that purpose.
How does one use the scancodes? I am seeing no keypressed(scancode) function in the wiki... help?

Re: Porting my own Veins of the Earth to LOVE

Posted: Mon Oct 24, 2016 8:14 am
by zorg

Code: Select all

function love.keypressed(keycode, scancode, isRepeat)
-- Just use the scancode argument instead of the keycode.
end

function love.keyreleased(keycode, scancode)
-- Same here.
end

down = love.keyboard.isDown(keycode1, ...) -- Works with 1 or more keycodes (true if any is down, not all)
down = love.keyboard.isScancodeDown(scancode1, ... ) -- Works with 1 or more scancodes (true if any is down, not all)
There's also getScancodeFromKey and getKeyFromScancode, but since it only ever uses SDL's own US english keycode layout, it's somewhat useless.

Re: Porting my own Veins of the Earth to LOVE

Posted: Mon Oct 24, 2016 10:07 am
by Zireael
Ok, I converted all the keypressed functions to take scancode instead.

It seems to work on my keyboard. Pgimeno, can you give it a try?