Page 1 of 2

3D Backgrounds for Touhou-like Bullet Hell Shmup

Posted: Thu Apr 06, 2017 5:32 pm
by ExPorygon
Hi all, I'm new here. I've been doing research into LÖVE for a while now to determine if I want to use it for a future game project.

A little background on me:
I've been working on 2D bullet hell shmup fangames for the Touhou Project series using a scripting language engine called Danmakufu. Using this C-based scripting language is my only programming experience. I have no formal programming education so I've been working to learn Lua recently using online resources. I was considering using LÖVE to make my first original bullet hell game, heavily inspired by Touhou, as I'd like to move beyond the limitations of Danmakufu. However, I haven't yet finished all my WIP games in Danmakufu yet, so this project will not be truly started for quite some time, possibly years from now. I'm just researching and dabbling for the time being.

In Danmakufu, I was able to achieve a limited 3D effect on stage backgrounds by arranging 2D graphics in a 3D space while the actual game is played on a regular 2D plane. I was wondering if a similar effect can be achieved using LÖVE. Here are a couple of video examples from my own Danmakufu projects:

https://youtu.be/Fw2ZNc3E6fc?t=30
This one is from an outdated build, but it shows a simple 3D background like what I'm looking to recreate. The ground is one 2D image that's been angled in a 3D space such that it 'points' into the distance with 2D bushes positioned along it.

https://youtu.be/9cZUyv3hEIA
It's a bit harder to see here due to the boss and bullets, but you can see another example of the ground angled into the distance with 2D trees and bushes passing by on the sides.

https://youtu.be/LViF8SiCZ0E
This last one is from the official Touhou series, which is the inspiration for my planned game.

I know LÖVE only has limited 3D capabilities and that they're (probably) very advanced. Can this effect be achieved in LÖVE? How difficult would it be? Would it be worth it?

Re: 3D Backgrounds for Touhou-like Bullet Hell Shmup

Posted: Thu Apr 06, 2017 6:34 pm
by Davidobot
Hey there and welcome to the forums! This effect is very doable and there recent libraries that make it even easier than ever before!

Firstly, I think PlayMat, a mode 7 library will have everything you're looking for, including a depth effect and sprites.
There have also been have been attempts by and my colleagues here to replicate full 3D in LOVE:
Image


I also made a raycaster in LOVE, which is also faux-3D like all the above projects.

So to answer your question - yes it can be done. The exact effect you're looking to replicate can be achieved easily using PlayMat. In my experience, LOVE is very worthwhile - it's always developing and it's very easy to program in; it also runs pretty fast and you are not limited to a engine's limitations with it!

Re: 3D Backgrounds for Touhou-like Bullet Hell Shmup

Posted: Thu Apr 06, 2017 7:15 pm
by Jasoco
Hi. I'm the author of the three projects posted above. Yeah, 3D is fun to do in Löve but it does take work and is very limited. You need to understand how 3D is done first. In my actual 3D projects, you need two things. Point locations and triangle locations. The points are locations in 3D space, i.e. xyz. And the triangles (Or quads if you want, which is what I do.) are just references to each of the points.

You'd have to first do a lot of math to figure out where the 3D point would translate to 2D screen space. Then take all your triangles, sort them by distance from the camera, and draw them. There's no culling though. It's a lot of work and Lua isn't that fast, but it's enough for something simple like my Star Fox clone. I never finished any of them and have rewritten my library multiple times. And even that first screenshot doesn't exist anymore. It's a different engine now. Even though that was my most advanced engine since it had a mostly working inventory system and shop system. Plus an overworld with a neat rounded horizon effect.

Those videos you posted could definitely be done and would be much simpler than making a whole 3D engine. But you'd still need one. It takes a lot of thinking ahead. My engines have "chunk" systems which is what it uses to make sure only parts of the world are rendered and the rest is not. Minecraft uses one so only chunks around the player are rendered. Mine would first figure out which chunks could be potentially seen on screen then would calculate all the points, check which triangles/quads are actually on the screen, then draw them. An engine like what you showed would be much simpler since the camera will always face one direction. My original StarFox engine did the same. But when I started branching out, I had to figure out a way to deal with rotating cameras.

Not to mention that the "point location calculation" takes up a large portion of your frame time. Since Löve can handle a few thousand things in a loop at once, but 3D could end up with a lot more than a thousand calculations at once and math is kind of slow. Plus it would only be fast on high-end machines. Anything else would be very slow frame rates. Sub-60. Maybe even sub-30.

I'd definitely look at PlayMat. It's exactly what you need to achieve the videos you posted. Anything more complicated would be a lot more work.

Re: 3D Backgrounds for Touhou-like Bullet Hell Shmup

Posted: Thu Apr 06, 2017 10:18 pm
by slime
You can do native hardware-accelerated 3D rendering with love since version 0.9 by using vertex shaders, although without something like love3d you won't have a depth buffer (necessary for efficient proper Z ordering of 3D objects).

Re: 3D Backgrounds for Touhou-like Bullet Hell Shmup

Posted: Thu Apr 06, 2017 11:09 pm
by raidho36
Speaking of which, when the depth buffer is coming?

Re: 3D Backgrounds for Touhou-like Bullet Hell Shmup

Posted: Fri Apr 07, 2017 1:47 am
by Jasoco
What do you mean? Is Löve supposed to be getting that? Because how would that even work?

Re: 3D Backgrounds for Touhou-like Bullet Hell Shmup

Posted: Fri Apr 07, 2017 2:20 am
by raidho36
As an option when creating a canvas. Duh. Obviously you don't need it if you draw 2d, because you do depth sorting manually anyway. But if you draw 3d, then you can use it to do avoid rendering back polygons at the front automatically, no sorting required (which is often not possible anyway).

Re: 3D Backgrounds for Touhou-like Bullet Hell Shmup

Posted: Fri Apr 07, 2017 5:26 am
by Jasoco
The way I do it it's possible. Which is to dump all the relevant arguments into a table, sort the table, and draw the objects using that information.

Are you just saying that things like circles, rectangles and images will just have a third Z parameter?

Re: 3D Backgrounds for Touhou-like Bullet Hell Shmup

Posted: Fri Apr 07, 2017 5:49 am
by zorg
ExPorygon wrote: Thu Apr 06, 2017 5:32 pm Hi all, I'm new here. I've been doing research into LÖVE for a while now to determine if I want to use it for a future game project.
A few corrections:

Danmakufu is not C-based, and it can draw real 3D graphics too... depending on which of the two versions you use.
Also, you probably mean that Löve's 3D capabilities are either -not- advanced, or that they're -difficult-.

That said, it's indeed possible to create a bullet hell shooter with löve; there was at least one that was released: Blue Revolver

And i myself have been experimenting with it too:
bhs.gif
bhs.gif (9.75 MiB) Viewed 11719 times

Re: 3D Backgrounds for Touhou-like Bullet Hell Shmup

Posted: Fri Apr 07, 2017 5:52 pm
by ExPorygon
zorg wrote: Fri Apr 07, 2017 5:49 am Danmakufu is not C-based
My bad, I remember friends of mine commenting that the scripting system maybe looked similar to something C-like, so that was a bad assumption.
zorg wrote: Fri Apr 07, 2017 5:49 am it can draw real 3D graphics too... depending on which of the two versions you use.
I use ph3. 0.12m is just too archaic and restrictive. Yeah, I think I know what you mean by it being capable of 'real' 3D. The default "Ice Mountain" background uses this capability. I didn't bring that up cause it's not the type of 3D background that I use (or even know how to work with well) and wasn't specifically looking replicate it (I know nothing about anything with regards to actual 3D modeling).
zorg wrote: Fri Apr 07, 2017 5:49 am That said, it's indeed possible to create a bullet hell shooter with löve; there was at least one that was released: Blue Revolver

And i myself have been experimenting with it too:
bhs.gif
That's great to hear! I was a bit worried with how slow that people say Lua can be so that's reassuring. Part of why I want to move from Danmakufu eventually is the low performance that my Danmakufu projects tend to have.
Jasoco wrote: Thu Apr 06, 2017 7:15 pm Hi. I'm the author of the three projects posted above.
...
I'd definitely look at PlayMat. It's exactly what you need to achieve the videos you posted. Anything more complicated would be a lot more work.
Thanks for the advice, I'll look there when I'm ready to attempt them. As part of my dabbling, I've only managed to do a few basic things, like player and bullet movement and collision detection. Right now, I'm just trying to get a better grasp of object oriented programming.

Thanks for all the responses, I'm glad what I'm looking for is possible. Hope to be posting here more often!