Anyone have experience with 3/4 perspective?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
DustyAtticGames
Prole
Posts: 4
Joined: Wed Apr 29, 2015 11:11 pm

Anyone have experience with 3/4 perspective?

Post by DustyAtticGames »

I've been experimenting with how to create a 3/4 perspective game in LÖVE. The issue I'm running into has to do with balancing depth and draws per frame. I'm representing the world with a three dimensional grid (probably unusual) so if I wanted to create a stack of crates, for example, the first one might be at coords 0, 0, 0 and the second one would be at 0, 0 1. Obviously, a brute force approach would be to use a SpriteBatch for the ground layer then draw another canvas iterating the map and characters, drawing each sprite top to bottom.

Like this:

draw:
draw ground SpriteBatch
for z = 1, howHighToDraw do
for x = 1, tilesAcross do
for y = 1, tilesDown do
if tile at x, y, z then draw
if character at x, y, z then draw
end
end
end

This would work but it could be a lot of draws. I considered putting multiple SpriteBatch layers vertically down the screen and then drawing to those but that seems like a lot of SpriteBatches.

Like this:
for y = 1, tilesDown do
make new SpriteBatch for y depth
for x = 1, tilesAcross do
for z = 1, howHighToDraw do
if tile at x, y, z then draw to SpriteBatch
end
end
end

This would be N SpriteBatches (user's vertical resolution / tile size). And the sprite batches would need to be sized tilesAcross by howHighToDraw.

I also considered some sort of masking technique but I'm not sure how I'd implement it yet.

So anyway, sorry for the long post. Just hoping someone out there has some experience and could suggest other options.

Thanks,
Bryan
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 5 guests