Pseudo-3D as of version 10?

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
jibbins
Prole
Posts: 1
Joined: Fri Jun 17, 2016 7:16 pm

Pseudo-3D as of version 10?

Post by jibbins »

I used Löve a long time ago, and I see there've been a lot of changes since version 5!

I'm interested in making a pseudo-3d game for a gamejam, something like Don't Starve, with a projected 3d plane, and camera-facing billboards.

What's the best way to do this as of version 10?

Should I be using meshes? Shear? Something else?

Image
User avatar
Linkpy
Party member
Posts: 102
Joined: Fri Aug 29, 2014 6:05 pm
Location: France
Contact:

Re: Pseudo-3D as of version 10?

Post by Linkpy »

Drawing something like Don't Starve with a 2D framework, without direct access to OpenGL and the Depth Test, it's something very complex. If you aim to have only 8 camera direction (front, back, left, right, and between each), you just need to have a map (like Tiled, for example), and then draw each object in function of the camera direction.

For the sprite, no need to take care about orientation (except for monsters and players). But the main difficulty, I think, is the draw order of sprites. Can be easy with a fixed camera orientation, but with a free orientation, the algorithm can be quiet heavy.

For the map's tiles, using a mesh can be the work pretty easily, as least if you understand how it's work.
Founder of NeoShadow Studio. Currently working on the project "Sirami".
github / linkpy
User avatar
partnano
Prole
Posts: 20
Joined: Sat Jun 11, 2016 4:53 pm
Location: twitter.com/partnano
Contact:

Re: Pseudo-3D as of version 10?

Post by partnano »

Projects like these depend on a fixed camera rotation (means: no rotation at all), at least in a 2D environment. In my opinion it's one of the coolest artstyles in gaming, but that's just me I guess! :P

Depth test (and therefore render order) is actually quite simple with a z-buffer (For every object you save the depth of the object and then draw it in that order).

To get sprites looking 3D, you can just askew the images in the y direction with the angle you want your (imaginary) camera to look at the sprites.

Collisions are the biggest problems from my experience, the simplest way is to save a dynamic z-buffer value for you character and compare it to the objects (if x and y are in the same range), but that leads to sometimes unpleasing results, so here is a lot of fiddling required.

For projects like these .. you always have to remember that you do not actually have a 3rd dimension, so SOME aspects can be really really tricky.
Skeletonxf
Citizen
Posts: 87
Joined: Tue Dec 30, 2014 6:07 pm

Re: Pseudo-3D as of version 10?

Post by Skeletonxf »

There's also mobile support now so you may want to keep that in mind and try to make your game usable from only touch-mouse controls.
User avatar
Inny
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

Re: Pseudo-3D as of version 10?

Post by Inny »

Drawing sprites in correct Z order is the easiest part. Instead of keeping their X and Y as their highest and leftmost point, keep it as their lowest and centered point. Then your z-order is

Code: Select all

table.sort(sprites, function(a, b)return a.y < b.y end)
The trick is drawing all of the sprites in this pseudo-3d view. With that you need to perform a transformation of their stored X/Y coordinate into a screen X/Y coordinate, with a scaling factor. Which, if you're already do a 3d plane perspective to the floor, then you should be able to figure this out through the same maths of rendering the floor.

Just as a side thought, rather than Don't Starve as your example, have you considered older games and their faux-3d look like the latter Space Quest/Kings Quest/etc games? Those were pretty static flat images, but simulated a 3d look with scaling as your character walked between zones on the screen.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 4 guests