Page 1 of 1

Machine guns with ballistic trajectories

Posted: Sat Mar 20, 2010 7:37 pm
by Cudman69
When using the high visibility changes to a map (ViewDistance and fogend set far away) it becomes apparent that the default machine gun fire, and automatic cannon fire for that matter, from airplanes appear to have gravity defying trajectories. As I know the default DefGun's and tank shells have ballistic trajectories I know BF1942 engine can cope with it, but in order to not reinvent the wheel I wonder if anyone has the needed changes to make more realistic machine gun/cannons with ballistic trajectories? I don't know the technical specs but I would assume that range of a .50 cal round is about 500-800m in a weak arc, how would that be scripted in BF1942 engine?

When I know how I will add this to my set of enhanced single-player maps for BG42 (high visibilty, aerial support focused).

Cheers,
Cudman69

Re: Machine guns with ballistic trajectories

Posted: Sun Mar 21, 2010 2:09 am
by Coroner47

Code: Select all

ObjectTemplate.velocity
To me looks like meters per sec. If you compare the M16 in dc 0.7 to real world specs, they're very close.

Also, i found that some of the dc 0.7 weapons have almost identical rates of fire to there real world counter parts. You should be able to use the dc 0.7 gun specs against the real world specs to come up with an equation like i did.

Look at the real world rate of fire here
http://en.wikipedia.org/wiki/M16_rifle
700-950 rnds per sec
also...
930m/s velocity

dc 0.7 M16 rifle rate of fire

Code: Select all

ObjectTemplate.create HandFireArms M16
ObjectTemplate.roundOfFire 13.5
ObjectTemplate.velocity 1000
the equation for rate of fire
[(950-700)/2]+700 = 825 "avg rate of fire"
825/60 "secs" = 13.75 ( per bf1942 min? )
looks pretty close to me! maybe someone else can confirm?

I'm sure you can also modify the deviations to represent a real world effective/max range.

Re: Machine guns with ballistic trajectories

Posted: Sun Mar 21, 2010 12:11 pm
by Senshi
The magic is with this code:
ObjectTemplate.gravityModifier 0.0

Check Objects\Stationaryweapons\Common\objects.con

There you find
ObjectTemplate.create Projectile Browning_Projectile

which is the projectile fired by the browning MG, obviously. In Vanilla, the gravity modifier is 0.0, meaning the bullet flies straight and is not influenced by gravity at all. Just experiment. This modifier is applied to the projectile as long as it's flying, so the ballistic path depends on the initial velocity as well as this modifier. Go with sth. like 1.0 for test purposes.

Easiest way to implement:

Add this to the objectspawntemplates.con of every of your map:

Code: Select all

ObjectTemplate.active Browning_projectile
ObjectTemplate.gravitymodifier 1.0
You might want to do the same for the Mg42_projectile or, if you are modding BG42, you have quite a lot of MG-projectiles to edit this way, actually ;) .

Re: Machine guns with ballistic trajectories

Posted: Tue Apr 06, 2010 12:08 pm
by Cudman69
Thank you Senshi,

GravityModifier is what appears to be what I was after, however unfortunately after extensive testing I cannot see any difference when firing the machineguns on the SBD in BG42 regardless of the value of gravitymodifier. I tried to see this value for the DefGuns but could not find it. Hmm, just realized that perhaps the original DefGun definitions from Battlefield 1942 is used. I will have to check this as well.

Thanks for your spot on answer though!

Re: Machine guns with ballistic trajectories

Posted: Fri Apr 09, 2010 2:17 am
by tekk
Serverside you wont see the change unless you have the patch in your levels folder ( tisk tisk if you put it there ;) )