How do you vacuum?

A place for people with an interest in developing new shmups.
Post Reply
User avatar
DyingIsFun
Posts: 35
Joined: Mon May 31, 2021 7:14 am
Contact:

How do you vacuum?

Post by DyingIsFun »

In many shmups, medals explode out of destroyed enemies, before being vacuumed into the player.

I've implemented this into my own shmup using a timer and standard homing behavior. Medals explode out in a random direction, with a damp on their vel to slow them down. After some duration, I enable standard homing behavior on them (home toward the position the player will be in the future given the player's current vel).

This works pretty well, but I am just curious how others implement this staple of the genre.
User avatar
hechelion
Posts: 29
Joined: Wed Oct 02, 2019 2:19 am

Re: How do you vacuum?

Post by hechelion »

DyingIsFun wrote: but I am just curious how others implement this staple of the genre.
I use a "gravity" system.
The force of attraction is proportional to the distance between the medal and the ship, and multiplied by a constant.
By changing the value of the constant and the distance I can easily alter the attraction of the medals

Watch 16:00 and 16:15
https://youtu.be/qThRTkoA25Q?t=961
User avatar
TrevorMcFurr
Posts: 24
Joined: Thu Jul 20, 2017 11:04 am
Location: Gloucester, UK

Re: How do you vacuum?

Post by TrevorMcFurr »

I've got a bullet vacuum in my shmup, so when the player presses the second fire button, an invisible area of effect (a cone in this case) is projected in front of the player ship. When enemy bullets overlap this cone, they are sucked towards the collector which increases the power of the player's beam shot.
See here: 0:10

Sent from my SM-A505FN using Tapatalk
gamertag/PSN ID: TrevorMcFurr

d_resolution dev thread: https://tinyurl.com/kw5fjnvr
Vulcano dev thread: https://tinyurl.com/43ztk2un

"If she makes it, she should be a perfectly normal and healthy cat. Other than having two faces."
User avatar
9uile
Posts: 50
Joined: Mon Jan 13, 2020 4:57 pm

Re: How do you vacuum?

Post by 9uile »

I only use a homing script with a magnet value increasing each frame.
My tip to have a kind of pop up is to set a negative value at the start.

So the bonus goes a bit in opposite direction, then magnet to the player.
It works well for me.
User avatar
heli
Posts: 585
Joined: Fri Sep 13, 2019 3:58 pm

Re: How do you vacuum?

Post by heli »

You should have two lists, one for the magnet state, one for other state.
In my game if you stop fire, the first of the normal list will be added to the back of the magnet list, then set to zero.
Magnet is agressive homing, you dont want it to mis, else it circles around you.

Dont use math functions, use the fast inverse square root and subtracting vectors.
User avatar
DyingIsFun
Posts: 35
Joined: Mon May 31, 2021 7:14 am
Contact:

Re: How do you vacuum?

Post by DyingIsFun »

Thanks for sharing your techniques everyone!
pieslice
Posts: 200
Joined: Sat Mar 01, 2008 12:15 pm
Location: Finland

Re: How do you vacuum?

Post by pieslice »

In most arcade games the "vacuum"/"hoover" is just linear interpolation lerp(a, b, t) from the medal's position when the effect starts to the player craft. The 't' value needs to be some sort of ease-in-ease-out to have smoother motion
User avatar
trap15
Posts: 7835
Joined: Mon Aug 31, 2009 4:13 am
Location: 東京都杉並区
Contact:

Re: How do you vacuum?

Post by trap15 »

pieslice wrote:In most arcade games the "vacuum"/"hoover" is just linear interpolation lerp(a, b, t) from the medal's position when the effect starts to the player craft. The 't' value needs to be some sort of ease-in-ease-out to have smoother motion
Yup, this indeed. It's common for the motion to be polar (angle & speed, rather than x & y), and generally the angle has a linear interpolation towards the player, which gives it a nice sort of curving rather than just straight movement. Often the speed is another linear interpolation, from whatever base speed to a comfortable max. Adjusting the interpolation rates and maximums is a bit more of an art than a science, so play around with them to find something comfy.
@trap0xf | daifukkat.su/blog | scores | FIRE LANCER
<S.Yagawa> I like the challenge of "doing the impossible" with older hardware, and pushing it as far as it can go.
User avatar
heli
Posts: 585
Joined: Fri Sep 13, 2019 3:58 pm

Re: How do you vacuum?

Post by heli »

I dont have a maximum speed, i keep increasing from zero without limit, it will hit the player fast enough, saves some cycles.
Interpolation looks weird, close items will go slow, as fast as the far items.
User avatar
DyingIsFun
Posts: 35
Joined: Mon May 31, 2021 7:14 am
Contact:

Re: How do you vacuum?

Post by DyingIsFun »

trap15 wrote:
pieslice wrote:In most arcade games the "vacuum"/"hoover" is just linear interpolation lerp(a, b, t) from the medal's position when the effect starts to the player craft. The 't' value needs to be some sort of ease-in-ease-out to have smoother motion
Yup, this indeed. It's common for the motion to be polar (angle & speed, rather than x & y), and generally the angle has a linear interpolation towards the player, which gives it a nice sort of curving rather than just straight movement. Often the speed is another linear interpolation, from whatever base speed to a comfortable max. Adjusting the interpolation rates and maximums is a bit more of an art than a science, so play around with them to find something comfy.
Ah, thanks for the add'l details. When linear interpolation was first suggested, I immediately thought "this won't work for me, since I want a curved trajectory, similar to what you see in Mushi". But using your method of polar representation and interpolating both the angle and the speed, I achieved an effect very similar to Mushi. Thanks again.
Post Reply