Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Ballistic System Testing  (Read 2952 times)

0 Members and 1 Guest are viewing this topic.

Offline F-3

  • *
  • +2% chance to make useful post
  • F-3 has no influence.
Ballistic System Testing
« on: March 27, 2012, 06:21:37 PM »
After rooting around for a while, I found the scripting behind the ballistic system and I've been toying around with it. But there are some problems.

The technique first requires setting phys_perf_maxvelocity much higher than the default 2000, in this case to "9999999999".

The projectile is actually a custom explosive, set in the weapon script like so:
Code: [Select]
"BulletEntitySpawn" {
"Class" "custom_explosive"
"Type" "556"
"ZVector" "100"
"Power" "49600"
"NpcZVector" "0"
"AngVelocity" "0"
}
The velocity of the projectile is set here, and works great. 49,600 units/sec should be 3,100 feet/sec if I've done the math correctly.

The class in smod_custom_explosive.txt is set up like this:
Code: [Select]
"556" {
"Damage" "0"
"Radius" "0"
"Model" "models/weapons/bt_9mm.mdl"
"Bounce" "0" // -1:never detonate
"GLFuse" "0"
"Timer" "3"
"ExplosionType" "0" // 0:none 1:fireball 2:pulse
"TrailType" "3" // 0:none 1:smoke 2:fire 3:beam
"Bullet" {
"AmmoType" "ak47"
"Damage" "25"
"ShotCount" "10"
"Angle" "0 0"
"Tracer" "0"
"Force" "1"
"TraceLength" "50"
"Penetrate" "12"
"Attenuate" "50"
}
}
No explosive specs have been set, because it doesn't actually explode (ExplosionType is 0). Instead, a bullet is created when the custom explosive hits something. This behaves like a normal hitscan bullet, and provided everything goes as planned, it simply damages whatever the custom explosive projectile hit. Alternatively, it projects from whatever surface the custom explosive hit, simulating a ricochet. TraceLength and Attenuate can be used to limit the range and damage of the bullet after it "ricochets".

The problem is sometimes the custom explosive strikes an enemy and creates a hitscan bullet facing away from the target. In other words, bullets bounce off of enemies. This seems to be caused by the model used for the custom explosive. When the custom explosive is generated, the model spawns at a fixed angle. Face in one direction, and the model comes out straight. Turn 90 degrees, and the model comes out sideways. This wreaks havoc on the direction in which the hitscan bullet is generated when the custom explosive hits. At the angles which the model flies sideways, this technique is nearly useless. Bullets bounce of enemies, crates, barrels, you name it, and ricochet off walls at bizarre parallel angles.

It appears that ShotCount was set to 10 as a workaround. When the custom explosive strikes, 10 hitscan bullets radiate on the horizontal plane from the point of impact. At angles where a single bullet would otherwise bounce off an enemy, the additional bullets hedge the bet and usually at least one hits the intended target.

This looks like complete ass in normal time and even worse in bullet time. You can't really use ricochets, although you'll get plenty of random results as 10 hitscan bullets are spammed in all directions. In bullet time it's just comedy.

So... Can this be fixed? What controls the angle at which the model faces? Is there some way to always make the model spawn in the correct orientation? Frustratingly, SMOD somehow already does this in bullet time using the same bt_9mm model.
« Last Edit: March 27, 2012, 06:24:43 PM by F-3 »

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
Re: Ballistic System Testing
« Reply #1 on: March 27, 2012, 10:49:30 PM »
controlling the angle was always the problem. I remember this came up for discussion when attempting to make a weapon with an under-barrel shotgun.

At the time when we were investigating, no satisfactory solution was ever discovered.

 :-\


Offline Counter-Life™

  • *
  • *
  • +17% chance to make useful post
  • Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!
    • Youtube Channel
Re: Ballistic System Testing
« Reply #2 on: March 28, 2012, 08:54:33 AM »
controlling the angle was always the problem. I remember this came up for discussion when attempting to make a weapon with an under-barrel shotgun.

At the time when we were investigating, no satisfactory solution was ever discovered.

 :-\

yeah I can remember, started by me.It was sadly impossible for me to make one.

Offline F-3

  • *
  • +2% chance to make useful post
  • F-3 has no influence.
Re: Ballistic System Testing
« Reply #3 on: April 09, 2012, 10:51:43 PM »
An interesting alternative is to increase the mass of the projectile in the weapon script and simply have no detonation effect whatsoever. Unfortunately this throws targets comically once they are killed.

I wonder how a roughly spherical model would fare in regards to spawning bullets in the correct direction?

Offline F-3

  • *
  • +2% chance to make useful post
  • F-3 has no influence.
Re: Ballistic System Testing
« Reply #4 on: January 26, 2015, 05:40:53 AM »
Old thread, updating some notes on this. Maybe somebody will come up with something clever here.

custom_explosive method was described above.

EnergyBullet method:
Requires sv_maxvelocity 50000
Code: [Select]
"EnergyBullet" {
"DamageType" "DMG_BULLET"
"Bounce" "0"
"Size" "1"
"LightRadius" "1"
"LightColor" "255 255 255"
"Speed" "49600"
"SpriteMaterial" "effects/yellowflare"
"Gravity" "600"
"TrailSize" "1"
"TrailTime" "0.1"
"FlyTime" "5"
}
Problems: Does not penetrate any objects, including open objects like fencing and rails

BulletEntitySpawn using crossbow_bolt:
Requires phys_perf_maxvelocity 50000 and weapon_crossbow_forcesticky 0; a new crossbow bolt model is preferred
Code: [Select]
"BulletEntitySpawn" {
"Class" "crossbow_bolt"
"ZVector" "100"
"Power" "49600"
"Mass" "0"
"NpcZVector" "0"
"AngVelocity" "0"
}
Problems: Doesn't utilize damage multipliers, can't penetrate walls

Classes for BulletEntitySpawn that don't produce errors in the console:
Code: [Select]
"bt_bullet" // bullet travels as a trail but doesn't impact anything, doesn't use model
"bt_pbullet" // spawns bullet with fixed angle if model is defined, doesn't deal damage
"shoot_bullet" // generates bullet traveling at angle 0 0 0
"waterbullet" // does nothing
"sniperbullet" // does nothing
"svdbullet" // does nothing
"bulletemitter" // does nothing