Modern Warfare Mod 3 brings World in Conflict from the Cold War into the Modern Age. It also ups the ante on realism and authenticity in every role – Infantry, Armor, Support and Air, while trying our best to keep everything relatively balanced for fun and interesting gameplay.

Report article RSS Feed Advanced Feature: PredictorFCS

Anti-aircraft artillery (AAA) or simply "AA guns" in modern times have evolved substantially since their early days during World War II. What used to be manually and visually aimed flak cannons to shoot down slow moving prop planes have now evolved into extreme high fire-rate, radar guided cannons that can shoot down not just aircraft, but missiles and mortar shells! The WiC MW Mod has taken the initiative in realistically portraying modern AA guns and we'll show you all of the in's and out's.

Posted by blahdy on Sep 26th, 2010
Article

PredictorFCS



The Modern Warfare Mod (MWM) has revolutionized the way anti-air units function in RTS games, realistically modeling them as much as possible within the permitted engine constraints of WiC.

Perhaps the most impressive eye popping experience of MWM is realistically modelling the radar-controlled Anti-Aircraft Artillery (AAA) units, or simply 'AA guns.' The portrait of AAA in MWM for WiC is not only impressive for its realism within the WiC community itself, but even exceeds the realism and expectations set forth by other modern military-themed games.

The technology or the "neat tricks" that MWM uses to achieve this is our PredictorFCS code. PredictorFCS is a set of procedural programming scripts using Python that are used for simulating fire control and guidance systems in World in Conflict (WiC).


WiC AAA Primer: How it used to work

The AAA units in vanilla, un-modded WiC are known as "Medium Anti-Air" (MAA) units. The MAA units have a fire-rate of 600 rounds per minute (that is, one bullet is fired every 0.1 second) and are pretty effective at tearing up air units. A General-ranked MAA unit will kill a helicopter with every single bullet scoring a precision sniping hit whenever a chopper enters its engagement radius.

Unfortunately, this is not very realistic. Regardless of whether you have the most superior fire control computer available, no anti-air gun is going to consistently hit fast-maneuvering air targets with such precision at a relatively medium fire rate of 600 rounds/min. Despite all the advances that have been made in digital technology and auto-cannons, even today's modern AAA's gain their probability of kill (pK) by using insane fire-rates. You won't find Phalanx CIWS guns shooting down incoming cruise missiles at only one round fired every 0.1 second, irrespective of how accurate its fire control technology is.


Chapter 1: First step in making AAA more realistic: Increase the Fire Rate (if only if it was that easy!)

Unfortunately, in WiC, all unit shooter weapons must be limited to 600 rounds/min in their fire-rate. Sure, you can use higher fire-rate and it will work just fine. But, the moment you try out your mod on a dedicated server with your online friends, the server will crash because the rate at which server updates its clients is limited to 10 frames per second, which translates to 0.1 second. So fire rates higher than 600 rounds/minute will crash the dedicated server in WiC.

This problem was impossible to fix in the early days of WiC modding, it became one of the "holy grails" of advanced WiC modders since the early days. It was simply marked as "game engine limited, cannot fix" for a while.

With MWM 2.0, all of this has changed. MW Mod has solved this holy grail of WiC by gaming the system, or more precisely, "cheating" the server software. Using PythonShooter API programming interface that Massive developers created for modders to use, MWM uses a new set of python scripts known as PredictorFCS.

The PredictorFCS generates insane fire-rates without crashing the server by using a programming logic called "buffered event handling" or "event polling." The actual AAA unit's Shooter weapon is configured to fire at rate of one round per 0.1 second as usual -- which is only 600 rounds per minute. However, every time a round is supposedly to be fired every 0.1 sec, instead of firing the bullet, PredictorFCS script intercepts the call and "games the system." When the script intercepts the firing sequence, instead of spitting out one bullet as usual, it invokes multiple weapon-fire calls while adding variance delay and spread to them. So instead of firing 1 bullet every 0.1 second, we're firing upwards of 8 bullets every 0.1 second. 8 bullets every 0.1 second translates to 80 bullets per second, which translates to 4,800 bullets per minute.

Since the generation of all 8 bullets at interval of 0.1 second happens all at once (hence, "buffered") on the dedicated server side, the server happily cruises along as if nothing happened. And we now have fire-rates as high as 6,000 rounds/minute on dedicated servers without crashing them ever!

There is more science to this than what's described though. In order to make the bullets form up a nice, natural looking "stream" of bullets just like in real-life, the Predictor python script adds random delay in milliseconds between each bullets launched in a single "buffered" call. It also adds slight random accuracy delay based on unit Shooter's accuracy rating for each bullet generated. We also created new graphical animation files that portray the bullets with nicer tracer and burnout effects to compliment the system.


Chapter 2: We now have insane fire-rates, but unfortunately they can't seem to shoot for crap!

One realistic feature that Battlefield Bad Company 2 (BFBC2) game implemented is simulated effect of ballistic physics. Unlike other games, bullets do not fly in straight line in BFBC2. Moreover, bullets also fly at much slower realistic muzzle velocities, where as in other games including WiC and COD4, bullets seem to fly at speed of light. Instead of calling them ballistic fire arms, we ought to call them lasers instead.

So, to make things feel more realistic, almost every projectile in the game has been slowed down in MWM 2.0 with realistically scaled values. For instance, in unmodded WiC, Medium Anti-Air bullets fly at a speed of 900 map units per second -- this means the bullet will cross from one side of the map to the other in do_Hometown in just one second. This is practically a rail-gun and that's exactly why whenever your helicopters fly into an MAA gun radius, it always gets shot at in an instant speed of light without noticeable misses. In MWM 2.0, AAA bullets travel at only 20% of unmodded WiC's MAA bullets!

When your bullets are flying at only 20% of what they used to fly, you suddenly run into a huge problem: the point of aim for your bullets is already too late to hit a moving helicopter. The classic rifle shooting rule of 'leading your target' comes to mind.


Chapter 3: How to accurately deal a deadly blow to even the fastest moving cruise missiles, not just helicopters... at only 20% of original bullet speed.


The Answer: Let's throw math at the problem :P

In new PredictorFCS 2.0 python script, we solve the problem of creating solid target leads by paying attention to our good old high school trigonometry math classes. We use the Law of Sines to do this.

Consider this example:


Our target is flying at position 'T' and we are shooting our gun from position 'G'. But since our target is moving, we have to aim ahead of him, thus the point of collision of our bullet with the target is the 'C', the point of interception.

The exact lengths of distances 'o' and 't' are not known, nor can the position of the interception point 'C' be pinpointed. However, the derivatives of lengths 'o' and 't', aka the speeds of the target and the AA gunner's muzzle velocity are known. Observe that, because when neither the AA gunner nor the target are accelerating, the triangle formed by them will be similar to the one above-- the sides will have the same ratio.

So, let's simplify this and assume that distances 'o' and 't' are equal to speed of their respective classes -- the moving speed of target is 'o' and the speed of projectile/bullet's flying time becomes the 't'.

Now, let's bust out our Law of Sines. The sine law asserts:


Using the law of sines, if we wanted to get the value of length 'a' in a triangle, we can do:


Now, let us go ahead and apply this law of sine to our pretty WiC triangle pictured above. You'll note that ''T, 'G' and 'C' are angles of our WiC scenario triangle, and 'c', 'o' and 't' are lengths of our fictional triangle -- which are the speeds of moving things involved. And we have this:


What this calculation gives us is the value to our angle 'G' -- the angle of turn, the angle of "aim" that the AA gunner has to make to aim his gun turret and point it to, in order to cause his bullets and the moving target to go into a spectacular mid-air collision.


Conclusion

So, there you have it. The partnership of artistic graphics, 1337 hax and trigonometric math producing a beautiful, yet deadly accurate as hell radar-directed anti-aircraft artillery (AAA) for World in Conflict. When you fly into that Vulcan's stream of fire, there's no escape.

Next time when you see your AA gun clearing the sky with such beautiful and ferocious display of violence and efficiency, just remember all the fancy math we've thrown into the thing behind-the-scenes :P


Video Demonstrations



Post comment Comments
formerlyknownasMrCP
formerlyknownasMrCP Sep 27 2010, 12:22am says:

wow! amazing! Love the results.

+3 votes     reply to comment
Color-Copycat
Color-Copycat Sep 27 2010, 12:34am says:

...and that's why you have to learn trigonometry. Real life applications ftw!

+7 votes     reply to comment
aloha2436
aloha2436 Sep 27 2010, 1:17am says:

Are the calculations increase the load on the processor to a noticeable degree?

+2 votes     reply to comment
blahdy Author
blahdy Sep 27 2010, 1:34am replied:

Nope. The processing of 120 bullets flying in the 3d world (120 bullets fired in 1.5 second burst) is more expensive than anything else. But even so, the performance impact is significantly much lower than expected to the point that it's not a problem even for low end computers.

+4 votes   reply to comment
StormOfRazors
StormOfRazors Sep 27 2010, 6:13am says:

Trigonometry = massive fail and hours of hard work to lean.
This mod looks like = a massive win and hours of fun to play xD
Seriously, good job..

+1 vote     reply to comment
Keksz
Keksz Sep 27 2010, 9:35am says:

haha thats just genius!

+2 votes     reply to comment
p*a*t*t*o*n
p*a*t*t*o*n Sep 27 2010, 12:50pm says:

nice work. after all we've heard about the predictor code its nice to finally have it explained nice and simple. looks good

+3 votes     reply to comment
roycewicz Creator
roycewicz Sep 27 2010, 1:16pm says:

lol, you forgot to mention the changes since predictor 2.1. We not only calculate the lead with trigonometric sine law, but offset the target lead centered on a standard bell-curve to take into account for the gun barrel's inaccuracy. En.wikipedia.org

You can see it in action when pantsir opens up fire with 30mm cannons. The bullets seem to spread out like a shotgun blast as they travel in the air.

+2 votes   reply to comment
blahdy Author
blahdy Sep 27 2010, 1:20pm replied:

ah yea, well this article was written before 2.1 anyway ..

+1 vote   reply to comment
nopushbutton
nopushbutton Sep 27 2010, 5:43pm says:

Cool article!

+2 votes     reply to comment
Y2Kwidmer
Y2Kwidmer Sep 27 2010, 11:38pm says:

*Brain broke*

+2 votes     reply to comment
ComeradeStalin
ComeradeStalin Sep 28 2010, 6:27pm says:

Hmm, what can I say? Titanic work!

+2 votes     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Icon
World in Conflict Icon
Platform
Windows
Contact
Send Message
Official Page
Wicmwmod.com
Release Date
Released Dec 22, 2011
Mod Watch
Track this mod
Feature
Browse
Features
Report Abuse
Report article
Related Mods
WIC: Modern Warfare Mod 4 (World in Conflict)
WIC: Modern Warfare Mod 4 World in Conflict - Single & Multiplayer Real Time Strategy
Related Games
World in Conflict
World in Conflict Single & Multiplayer Real Time Tactics
Related Groups
WIC : Modern Warfare Mod Team
WIC : Modern Warfare Mod Team Developer with 21 members