Do all bullets check hits every frame ?

A place for people with an interest in developing new shmups.
User avatar
heli
Posts: 585
Joined: Fri Sep 13, 2019 3:58 pm

Re: Do all bullets check hits every frame ?

Post by heli »

Oh, you mean line intersect.
I am not using line intersect, i dont know the math.
I might need the math for a laser beam that can shoot any angle.

You can tell how it works ?
thanks
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: Do all bullets check hits every frame ?

Post by casualcoder »

I used a raycast (what you're referring to when yous say "line intersect") for lasers in VariaBULLET.

Image


For the angle it shouldn't matter what your collision method is however. I made the laser rotate relative to a parent object and scale on the x axis.

There are some hidden issues you'll come across such as the raycast colliding with objects through the wall.

Lasers ended up being the most complicated shots in the system (homing being a close second).

If you can find a system to use in an engine, I'd recommend you pick one up. I'm glad I spent the time to make my own but if someone else made it I would have gladly bought it and moved on with development.
User avatar
heli
Posts: 585
Joined: Fri Sep 13, 2019 3:58 pm

Re: Do all bullets check hits every frame ?

Post by heli »

I got the homing figured out cheap, with subtracting 2 vectors.
Then no expensive math-functions are involved.
I have to look what it was exact if you intrested, havent tested yet.

For rotated laser i wanted to use many box intersects, that is not the perfect way i think.
Raycasting is also math-functions involved ?, it sounds very expensive.

I look at the size of the target, and limit the maximum frame time, then i am sure the bullet can not pass the ship on a certain maximum speed.
If you dont limit the speed or frametime then you need raycasting for sure.

I also like this trick very much i want to implement,
if you look at batsugun or battle garegga you see when power up.
The bullet is double as big, the texture is repeated, so it looks like 2 bullets, while you only check once.
That you dont see individual explosion you wont notice in the chaos.
Make sure it deals double damage, maybe increase hitbox.
Post Reply