Projectile size

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
Post Reply
Hypersonic
Posts: 134
Joined: Mon Aug 14, 2017 3:04 pm

Projectile size

Post by Hypersonic »

Type the following sequence in the console (can copy/paste the warp command)

map map21
god
give all
warp 2584 4127 128

Without moving from that spot (between the yellow bars) try killing all monsters in sight using only the rocket launcher and plasma canon. Notice that the projectiles are so large they hit the yellow bars from monsters on the edge. I don't know how many times I killed myself due to thinking I had a clear shot, but forgot how large the projectile bounding box was.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Projectile size

Post by Matt »

Yup.

Rockets have a "radius" of 11 doom units, which means they're roughly a 2'x2' square. This is necessary because the rocket's speed is 20, which means it advances 20 doom units every gametic - and therefore only checks for collisions around its hitbox every 20 units.

If you made the projectile's radius less than half of its speed, it would routinely clip through walls and possibly even monsters in unwanted ways.

Nowadays you can get around it using a FastProjectile, but there are a few drawbacks to that too. (e.g., no gravity unless you program it in yourself)
Hypersonic
Posts: 134
Joined: Mon Aug 14, 2017 3:04 pm

Re: Projectile size

Post by Hypersonic »

I suppose tracing the entire route was too computationally involved for computers of the early 1990s. So even if the rocket traveled at the speed of light any obstruction along the way would still be caught. Instead it just does a radius check every gametic.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Projectile size

Post by Matt »

Exactly.

Nowadays with ZScript, in addition to the way FastProjectile does it, one alternative is to use a LineAttack for each corner plus the middle and check the resulting distances. It's a bit computationally expensive with that many steps in the virtual machine, but it can be better than a FastProjectile (which just does multiple checks every gametic, as many as needed to fill all the spaces) at very high speeds at great distances.

Personally, I just get lazy and do only one hitscan check.
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: Projectile size

Post by Nevander »

I just move to the left or right of the other side of the yellow bars. The projectiles can fit there.
User avatar
kodi
 
 
Posts: 1355
Joined: Mon May 06, 2013 8:02 am

Re: Projectile size

Post by kodi »

@matt
That reminds me, I've thought about shooting one center and 4 radial hitscans in the movement direction of a projectile (or just the player) to get the angles of whatever wall it's facing. Ever tried that? Should allow for complex bouncing behavior, impact puffs with angled momentum and bouncing railgun shots if it works.
Hypersonic
Posts: 134
Joined: Mon Aug 14, 2017 3:04 pm

Re: Projectile size

Post by Hypersonic »

Ya since the projectile doesn't strafe, just tracing the 4 corners in the direction of travel should do, otherwise all 8 corners would be needed. So fast projectile does multiple box or sphere collision checks each gametic, I wonder how that compares to trace checks computationally wise (might depend on the speed/size of the projectile.)

@Nevander
Ya, but the constraint of staying in that one spot was just to demonstrate the projectile size.

Rockets ricocheting of walls hit and obtuse angles might be interesting. Maybe bouncing plasma off mirrored images.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Projectile size

Post by Matt »

@kodi

Never had the bother myself to take it anywhere with projectiles, though the current weapon collision system in HD comes pretty close to the sort of thing you're desribing - by shooting four hitscans for top, bottom, left and right I can check which one is shortest and prevent the player from turning in that direction.
Post Reply

Return to “General”