Lovox - Load and render voxels in Love2d

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
SSG_DEV
Prole
Posts: 10
Joined: Sun Nov 13, 2016 5:13 pm

Re: Lovox - Load and render voxels in Love2d

Post by SSG_DEV »

This is amazing :ultrashocked: I would love to make an RTS with this aesthetic.
User avatar
evgiz
Citizen
Posts: 83
Joined: Mon Aug 29, 2016 11:05 pm
Contact:

Re: Lovox - Load and render voxels in Love2d

Post by evgiz »

Hey, I'm the guy who made Sprit3r, cool that you mentioned it. I was wondering, do you do any optimizations when it comes to rendering, or just drawing images on top of each other? I wrote a similar render system for my Ludum Dare game, and I found it to be fairly slow especially with love.js for the web. My solution was using spritebatches and only update them when the camera angle changed. I imagine it could be possible to optimize even further though.
Computer science student and part time game dev! Currently working on Depths of Limbo! :cool:

Check out the game website DepthsOfLimbo.com! :ultrahappy:
And my personal website with all my projects evgiz.net! :megagrin:
User avatar
Tjakka5
Party member
Posts: 243
Joined: Thu Dec 26, 2013 12:17 pm

Re: Lovox - Load and render voxels in Love2d

Post by Tjakka5 »

SSG_DEV wrote:This is amazing :ultrashocked: I would love to make an RTS with this aesthetic.
Do it! I'd love to see what you come up with.
evgiz wrote:Hey, I'm the guy who made Sprit3r, cool that you mentioned it. I was wondering, do you do any optimizations when it comes to rendering, or just drawing images on top of each other? I wrote a similar render system for my Ludum Dare game, and I found it to be fairly slow especially with love.js for the web. My solution was using spritebatches and only update them when the camera angle changed. I imagine it could be possible to optimize even further though.
I dont do any other optimizing except for the way you just described. (And only rendering objects that are in the camera's view in my LD game.)
From my testing I was able to have atleast 1000 models on screen at good fps on my decent laptop.
Of course the results may vary with model size, you seem to be using bigger models?


On a side note; Im currently trying to make the Z-buffer work better. It fails in some situations.
I also got an idea to (majorly) optimize the image/func to model functions, which could make them very usuable in games without having a big performance impact.
User avatar
drikdrok
Prole
Posts: 36
Joined: Sun Mar 15, 2015 9:53 am
Contact:

Re: Lovox - Load and render voxels in Love2d

Post by drikdrok »

Hi, I realize this is an old post, but I would like to use this library for a game.

My question is how do you rotate the camera around a point, like seen in the second gif?

Other than that, awesome work man!
User avatar
drikdrok
Prole
Posts: 36
Joined: Sun Mar 15, 2015 9:53 am
Contact:

Re: Lovox - Load and render voxels in Love2d

Post by drikdrok »

drikdrok wrote: Thu Jul 05, 2018 5:37 pm Hi, I realize this is an old post, but I would like to use this library for a game.

My question is how do you rotate the camera around a point, like seen in the second gif?

Other than that, awesome work man!
Okay so I figured out my problem. By default it rotates around the camera's position. However, I was using another camera lib to handle camera movement (so I was using 2 cameras). That of course results in the camera rotating around 0,0.

But then I have another question:
How do you move the camera left and right, relative to the current rotation?

I've got forwards and backwards movement figured out like so:

Code: Select all

Camera:move(-(math.sin(Camera.rotation) * 200 * dt), -(math.cos(Camera.rotation) * 200 * dt)) -- Forwards

Camera:move(math.sin(Camera.rotation) * 200 * dt, math.cos(Camera.rotation) * 200 * dt) -- Backwards
User avatar
drikdrok
Prole
Posts: 36
Joined: Sun Mar 15, 2015 9:53 am
Contact:

Re: Lovox - Load and render voxels in Love2d

Post by drikdrok »

drikdrok wrote: Thu Jul 05, 2018 5:48 pm
But then I have another question:
How do you move the camera left and right, relative to the current rotation?
I figured it out... Sorry for just writing 3 posts to myself here haha.

The solution is to just add or subtract 90 degrees to the movement and you got it. I can't believe could't figure this out for so long I asked for help here.

So here's the result:

Code: Select all

Camera:move(-(math.sin(Camera.rotation) * 200 * dt), -(math.cos(Camera.rotation) * 200 * dt)) -- Forwards
Camera:move(math.sin(Camera.rotation) * 200 * dt, math.cos(Camera.rotation) * 200 * dt) -- Backwards
Camera:move(math.sin(Camera.rotation-math.pi/2) * 200 * dt, math.cos(Camera.rotation-math.pi/2) * 200 * dt) -- Left
Camera:move(math.sin(Camera.rotation+math.pi/2) * 200 * dt, math.cos(Camera.rotation+math.pi/2) * 200 * dt) --Right
Hopefully this might help someone in the future!
Post Reply

Who is online

Users browsing this forum: No registered users and 61 guests