Page 1 of 1
Pseudo-3D as of version 10?
Posted: Fri Jun 17, 2016 7:20 pm
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?
Re: Pseudo-3D as of version 10?
Posted: Sat Jun 18, 2016 12:00 pm
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.
Re: Pseudo-3D as of version 10?
Posted: Sun Jun 19, 2016 9:58 am
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!
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.
Re: Pseudo-3D as of version 10?
Posted: Sun Jun 19, 2016 1:19 pm
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.
Re: Pseudo-3D as of version 10?
Posted: Sun Jun 19, 2016 5:14 pm
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.