Sunday, October 17, 2010

Shooter Games Part 3: Networked Virtual Simulation

America’s Army is a shooter game (or virtual simulator) that uses the User Datagram Protocol (UDP) protocol over Local, Metropolitan, or Wide Area Network (LAN, MAN, or WAN). This blog discusses various simulation and network protocols, and introduces America's Army. I taught a course for M&S professional development in 2006 entitled "Networked Virtual Simulation using America's Army." The notes for this course may be downloaded at Simulation Educators.

Networked Virtual Simulation

Networked Virtual Simulations typically cooperatively simulate real-world entities or systems. Each simulate some portion of "real-world." They exchange data via network messages using standardized protocols:
  • Simulation, e.g., SIMNET, DIS, ALSP, HLA (see notes)
  • Network, e.g., TCP/IP, VoIP, UDP (see notes)

Notes:
  • SIMNET: Simulation Networking
  • DIS: Distributed Interactive Simulation
  • ALSP: Aggregate Level Simulation Protocol
  • HLA: High Level Architecture
  • TCP/IP: Transmission Control Protocol over Internet Protocol
  • VoIP: Voice over Internet Protocol
  • UDP: User Datagram Protocol
Distributed simulation protocol
A simulation protocol is the format and procedure that governs the transmitting and receiving of data. The term comes from the Greek "
protokollon," which was the cover page to a manuscript that provided a description of the contents. Proto means “the first” and kolla means “to glue together.”

In order for computers to exchange information, there must be a preexisting agreement as to how the information will be structured and how each side will send and receive it. Without a protocol, a transmitting computer, for example, could be sending its data in 8-bit packets while the receiving computer might expect the data in 16-bit packets. Protocols are established by international or industry-wide organizations.


TCP/IP and Ethernet

The Transmission Control Protocol (TCP) is a virtual circuit protocol that is one of the core protocols of the Internet protocol suite, often simply referred to as TCP/IP. Using TCP, applications on networked hosts can create connections to one another, over which they can exchange streams of data. The protocol guarantees reliable and in-order delivery of data from sender to receiver. TCP also distinguishes data for multiple connections by concurrent applications (e.g., Web server and e-mail server) running on the same host.


Steel Beast is a highly accurate simulator of the US M1A1 and German Leopard 2A4 tanks designed to let you create and play scenarios of modern warfare. Scenarios can be played in either single-player mode against the computer, or in a multiplayer-mode against (and with) other players over a network. Steel Beast uses TCP/IP over a LAN. In 2002, I used Steel Beasts to train teams of US Military Cadets in Heavy/Mechanized Platoon tactics.


The TCP/IP Protocol

Are you there? Yes, I am. Are you ready to receive? Yes, I am. Here comes the message--blah, blah, blah-- did you get it? Yes, I did. Here comes the next part--blah, blah, blah-- did you get it? No, I didn't - resend it. Here it comes again-- blah, blah, blah-- did you get it? Yes, I did. There is no more. Goodbye. Goodbye.


The Ethernet Access Method

Is the network busy? Yes, it is. Wait random amount of time. Is the network busy? Yes, it is. Wait random amount. Is the network busy? No, it isn't. Here goes the frame... did it collide with another packet on the line? No, it didn't. Is the network busy? Yes, it is. Wait random amount. Is the network busy? No, it isn't. Here goes the next frame... did it collide? Yes, it did. Wait random amount. Is the network busy? No, it isn't. Here goes the frame again... did it collide?


User Datagram Protocol (UDP)

UDP, documented in RFC 768, provides users access to IP-like services. UDP packets are delivered just like IP packets, except they are connectionless datagrams that may be discarded before reaching their targets. UDP is useful when TCP would be too complex, too slow, or just unnecessary.
UDP provides a few functions beyond that of IP:
  • Port Numbers. UDP provides 16-bit port numbers to let multiple processes use UDP services on the same host. A UDP address is the combination of a 32-bit IP address and the 16-bit port number.
  • Checksumming. Like IP, UDP does checksum its data, ensuring data integrity. A packet failing checksum is simply discarded, with no further action taken. However, in UDP the checksum is not required.
UDP protocol only has a length of eight bytes to be exact. That is twelve bytes less then TCP. Due to this, UDP is much faster as there is less to transmit. An extra twelve bytes may not sound like a lot, but multiply it by thousands of packets, and you will quickly notice a difference on your network. Seen as an UDP header is that much smaller, exactly what does it look like? See below for a diagram of what a UDP header looks like. So we can see from the above that not having the extra twelve bytes of overhead in the UDP header does indeed make a substantial difference. This would account for the lack of “connection orientation” for UDP. You may note, that we also have a checksum in the header for UDP. All of the four core protocols, those being; IP, TCP, UDP, ICMP all have checksums. In all of the four core protocols the checksum will cover the protocol header and any data, if present. One of the last things I would like to mention about UDP and its checksum is that its use is optional. In essence, it does not have to be used, whereas in TCP, ICMP, and IP, it does.

This protocol is connectionless, meaning when the server sends information to a connected player it does not wait for a confirmation that the information was received. This prevents the server from worrying about whether a connected player is receiving information or not. Have you ever played an online shooter game and found yourself eliminated before you knew you where threatened. Welcome to UDP--fast but unforgiving.

America's Army
America's Army (also known as AA or Army Game Project) is a tactical multiplayer first-person shooter owned by the United States Government and released as a global public relations initiative to help with U.S. Army recruitment.


Since July 4, 2002, America's Army has published 9 game releases; offering new game features and simulated training and missions. Each release has provided the America's Army community a virtual Army experience with a careful balance between authentic realism and virtual gaming fun.

The PC version, subtitled "Recon", was first released on July 4, 2002. Subsequently "Operations" was first released on July 12, 2002. Interim versions are listed below.
The Xbox version was released in November, 2005. Version 2.8, "Coalition", debuted Dec 21, 2006 and has had many upgrades since Recon. It was financed through U.S. tax dollars and distributed for free. The latest version 3.0 "Special Forces" was released on June 17, 2009.

The Unreal Engine
The Unreal Engine is a widely-used game engine developed by Epic Games. First illustrated in the 1998 first-person shooter game Unreal, it has been the basis of many games since, including Unreal Tournament , Tom Clancy's Rainbow Six 3: Raven Shield, Red Steel , and Gears of War. Although primarily developed for first-person shooters, it has been successfully utilized in a variety of genres, including 3rd-person stealth (Tom Clancy's Splinter Cell) and MMORPG (Vanguard: Saga of Heroes).

Its core written in C++, the Unreal Engine features a high degree of portability, supporting a plethora of platforms including the IBM PC compatibles (Microsoft Windows, GNU/Linux), Apple Macintosh (Mac OS, Mac OS X) and many consoles (Dreamcast, Xbox, Xbox 360, Playstation 2, Playstation 3). A great deal of the gameplay code is written in UnrealScript, a proprietary scripting language, and as such large parts of the gameplay can be modified without delving deep into the engine internals. Additionally, as with other middleware packages, the Unreal Engine also provides various tools to assist with content creation, both for designers and artists.

Unreal Engine 2 (America’s Army v1.0 ~ v2.x)
The sophomore version of the Unreal Engine got off to a rocky start with the mixed reviews for Unreal Tournament 2003. This generation saw the core code and rendering engine completely re-written and the new UnrealEd 3 integrated. It also integrated the Karma physics software development kit (SDK), which powered the vehicles in Unreal Tournament 2004. Many other engine elements were also updated, with improved and added support for the PlayStation 2 and the Xbox, respectively.

Unreal Engine 3 (America's Army v 3.x)
In America's Army 3, Every Detail Counts and as a result, the game has more authentic military elements including training, technology, weapons, and audio than any other military game. Built on Unreal Engine 3, AA3 delivers stunningly realistic environments, lighting effects, animations, and team-based experiences so that America's Army players can experience how Soldiers train, live, and advance in the Army. Players are bound by Rules of Engagement (ROE) and gain experience as they navigate challenges in team-based, multiplayer, force-on-force operations. In the game, a player's actions and demonstrated Army values are integral to successful mission accomplishment and affect a player's career progression.


Version History
  • America's Army 3: (version 3.0.7) 18 FEB 2010
  • AA3.0.6 Hot Fix Released (v3.0.6 Hot Fix) 17 SEP 2009
  • AA3.0.6 Update Released (v3.0.6) 07 SEP 2009
  • AA3.0.5 Update Released (v3.0.5) 13 JUL 2009
  • America's Army 3: Patch (Version 3.0.4) 03 JUL 2009
  • AA3.0.3 Hot Fix Released (v3.0.3) 24 JUN 2009
  • AA3.0.2 Hot Fix Released (v3.0.2) 19 JUN 2009
  • AA3.0.1 Hot Fix Released (v3.0.1) 18 JUN 2009
  • America's Army 3 PC Action Game (v3.0.0) 17 JUN 2009
  • America's Army : Special Forces (Overmatch) (Version 2.8.5) April 30th 2009
  • America's Army : Special Forces (Overmatch) (Version 2.8.4) October 6th 2008
  • America's Army : Special Forces (Overmatch) (Version 2.8.3.1) March 25th 2008
  • America's Army : Special Forces (Overmatch) (Version 2.8.3) January 31st 2008
  • America's Army : Special Forces (Overmatch) (Version 2.8.2) Septmber 6th 2007
  • America's Army : Special Forces (Overmatch) (Version 2.8.1) March 22nd 2007
  • America's Army: Special Forces (Coalition) (version 2.8) December 21st 2006
  • America's Army: Special Forces (Overmatch) (Version 2.7.0) September 14th 2006
  • America's Army: Special Forces (Link-Up) (Version 2.6.0) February 8th 2006
  • America's Army: Special Forces (Direct Action) (Version 2.5.0) September 6th 2005
  • America's Army: Special Forces (Q-Course) (Version 2.4.0) May 18th 2005
  • America's Army: Special Forces (Firefight) (Version 2.3.0) February 18th 2005
  • America's Army: Special Forces (Vanguard) (Version 2.2.1) November 18th 2004
  • America's Army: Special Forces (Vanguard) (Version 2.2.0) October 19th 2004
  • America's Army: Special Forces (Downrange) (Version 2.1.0) June 1st 2004
  • America's Army: Special Forces (Sandstorm) (Version 2.0.0a) December 21st 2003
  • America's Army: Special Forces (Version 2.0) November 6th 2003
  • America's Army: Operations (Medics) (v1.9.0)) 08 AUG 2003
  • America's Army: Operations (Bridge SE) (v1.7.0) 21 APR 2003
  • America's Army: Operations (Radio Tower) (v1.6.0) 16 MAR 2003
  • America's Army: Operations (Weapons Cache SE) (v1.5.0) 23 DEC 2002
  • America's Army: Operations (River Basin) (v1.4.0) 25 NOV 2002
  • America's Army: Operations (Mountain Pass) (v1.3.0) 10 OCT 2002
  • America's Army: Operations (Map Pack) (v1.2.1) 03 OCT 2002
  • America's Army: Operations (Airborne Pack) (v1.2.0) 22 AUG 2002
  • America's Army: Operations (Marksmanship Pack) (v1.1.1) 01 AUG 2002
  • America's Army: Operations (v1.0.1b) 05 JUL 2002
  • America's Army: Recon (v1.0.0) 04 JUL 2002

Friday, October 8, 2010

Shooter Games and Chance, Part 2

In my most recent blog, I talked about Precision Engagements in the blog titled "Shooter Games and Chance." The following, which is an excerpt from my book, Fundamentals of Combat Modeling, provides an example.

1.7 Direct Fire Accuracy Example

In this section, we want to determine the single-shot accuracy of a given munition against a given target with Monte-Carlo evaluation using bias and dispersion. To do this, we would need to consult AMSAA or JMEMS tables for
µx, µy, σx, and σy for the given munition and situation. Next we would follow the following procedure:

1. Generate two random numbers: X ~
N(µx, σx) , Y ~ N(µy, σy)
2. Compare (X, Y) with target geometry to determine if round hit target.
3. If goal is to assess whether a given shot hit, you are done.
4. If goal is to compute P(Hit) or PH (e.g., to build a table of PH’s), repeat steps 2 and 3 to get a sufficiently large sample; PH is the fraction of rounds that hit.

Consider the infantry fighting vehicle target with frontal profile shown in Figure 1-15.

· A hit in area 1 will produce a firepower kill
· A hit in area 2 will produce a catastrophic kill
· A hit in area 3 will produce a mobility kill
· A hit in other areas will produce no permanent effect


Figure 1-15. Frontal profile of an infantry fighting vehicle target

We will assess the IFV’s vulnerability when engaged with a frontal shot whose impact point is modeled as a random variable pair (X, Y) ~ BVN(0, 0, 0.5, 0.5, 0). Using the list of pseudo random numbers (RNs) in Table 1.1 as needed, we simulate the first round to determine which type of kill, if any, occurs.


Table 1.1. Pseudo-random numbers:
0.8554 0.2287 0.6659 0.8243 0.6840 0.0430 0.8598 0.2381

We proceed by doing a Monte Carlo simulation of the impact point with origin centered on the target, then compare impact point with target profile to calculate where it hit.

Determine X coordinate of impact point (using RN 0.8554):
· Enter the Normal Table with .8554.
· Find
Z -1 = 1.06.
· Note that
Z -1 = (x - µx)/σx.
· Solve for x in 1.06 = (x - 0)/0.5 implying x = 0.53

2. Determine the Y coordinate of the impact point (using RN 0.2287):
· Normal Table goes from .5000 to .9999, but Normal Dist. is symmetric, so compute , and change sign of resulting Y coordinate.
· Interpolating between 0.75 and 0.74, gives
Z -1 = 0.74.
· Solve for y in 0.74 = (y - 0)/0.05 = -0.37.

3. Assess the impact of the round. In Figure 1-16, the round hits area 4, so no kill is assessed.

Figure 1-16. Target impact assessment

Sunday, October 3, 2010

Shooter Games and Chance

Shooter games are a type of virtual simulation. Examples include America's Army, Rainbow Six: Rouge Spear, SOCOM II: USN Seals, and Full Spetrum Warrior. All of them have some type of random process that determines health, damage, etc. Probability or chance underlies these random processes.

Point System
Many shooter games use a simple point system to determine combat outcomes. Each target has a number of health points. Each weapon delivers a number of damage points. When a target’s health point go below zero, it is dead.

There can be modifications to this. A target’s health may be supplemented by armor, first aid, or other artifacts that make it stronger. These artifacts may be accounted for separate from health. This makes it possible to limit their effectiveness to certain types of weapons or attacks. For example, a flak vest may reduce the effect of a bullet to the chest, but have no effect on a direct hit by a fragmentation grenade launched from a weapon.

The damage points of a weapon may also be degraded based on environmental factors like range to target and obstacles along the path. This makes some weapons, like a shotgun, less effective at longer distances. It also allows for variation of effects when a grenade is thrown into a group or when the frag pattern is partially blocked by walls.

Point System

Markov Pk Table

This method assigns a probability of kill (Pk) to specific weapon-target pairs. The data is generally stored in a Weapons-Target Matrix as shown in the picture. Pk values are assigned to each pair and can be adjusted as needed.

Though this method is very flexible, it contains two major weaknesses. First, the Pk values do not account for other variables such as range to target, closing speed, defensive positions, etc. Therefore, the values are often modified for each engagement before they are applied to the target.

Second, the values are all independent. It is possible to set any one value without regard for those around it. Therefore, it is difficult to insure consistency among the hundreds of numbers in the matrix. It is easy to tweak one number and unintentionally make a tank more vulnerable than a personnel carrier. This effect is compounded by the practice of applying modifiers to these numbers (for range, health, weather, etc.).

Markov Pk Table

Random Numbers

When using Probabilities in engagement and attrition algorithms, random numbers suddenly become a core piece of the solution to the problem (see blog on Random Number Generators, September 9, 2010). Strictly, a Random Number falls between 0 and 1 and is evenly (or uniformly) distributed between these. The table in this slide was generated using the RAND function in Microsoft Excel. For the most common cases, the techniques for generating good random numbers are well known. However, the mathematical approach used to create these numbers is less than perfectly uniformly distributed between 0 and 1. Therefore, all RAND functions are strictly referred to a Pseudo-random number generators.

If you need to select numbers for a distribution other than uniform, such a Normal, Poisson, Weibel, etc., you require random variates. The methods most often used to generate these variates (e.g., inverse transform) are described in many simulation textbooks, but will not be explored here.

Random Number Table

Pk's and Random Numbers

The Probability of Kill indicates the percentage of the time that the given event will result in the destruction of the object being attacked. In this slide, we show a Pk of 0.75 for a tank when attacked by some weapon. The random number selected was 0.63. This number falls between 0 and 0.75., therefore, the algorithm will decide that this vehicle is destroyed. If the random number had been greater than the Pk value, then the algorithm would have decided that the vehicle was not killed.

In this example, a single random number is used to make a kill/no-kill decision. In practice there are often many modifications to this to allow different types of kills based on the type of weapon, target, angle of engagement, and a number of other variables.

Pk's and Random Numbers
Precision Engagements

Automated crews could potentially achieve perfect weapon alignment on the target. However, these models must explicitly add errors to degrade their performance to some determined human level. Each target provides some presented area to the shooter. The shooter places an aim point on this vehicle and fires the weapon. However, the engagement is modified by a fixed bias for the type of weapon used (AMSAA or JMEMS Tables), an occasional bias for the variations caused by the positioning of two vehicles, and a random bias for the round-to-round differences found in any form of munition.

These model effects prevent automated forces from performing perfectly. The picture shows the application of three different errors. This could require three random numbers ad each factor may differ from one engagement to the next, or can be simplified into a single random draw if the three values do not change.
  • PROBLEM: Find point of impact (if any) of round on its target.
  • ASSUMPTION: The projectile impact point is a random variable with a normal probability distribution (empirically shown to be a good assumption).
Precision Engagements
Damage Categories

Once mutually exclusive values are obtained, it is a simple matter to select the kill effects using a single random number draw that is applied to the kill categories. Simplifications of this sort are often performed on empirical data that is used in simulations. The form in which the data is collected is not necessarily the form best used in the simulation.

Notice that we have attempted to stack the Pk’s from least lethal to most lethal. If this can be done, then it is easier to apply a Pk modifier directly to the Pk and continue using this equation. Examples of modifiers might ne night, rain, suppressing fire, fatigue, etc.

Damage Categories

Conclusion
All good shooter games incorporate an element of chance. Probability or chance is the basis for randomness in shooter games. If the response to this blog are positive, I'll follow it up with a more detailed explanation of probability applications, including range-error probable and circular area probable.