Home » MODDING HQ 1.13 » v1.13 Idea Incubation Lab  » New CTH system - Presentation
New CTH system - Presentation[message #249910] Thu, 22 April 2010 17:39 Go to next message
Headrock

 
Messages:1775
Registered:March 2006
Location: Jerusalem
As some of you already know, I have spent the past month trying to rethink JA2's Chance-to-Hit system. This feature, which will be released as the basis for HAM 4, is going to be the most major gameplay change yet. In theory, the new CTH will increase realism and moddability for weapons, while crushing some glaringly obvious combat exploits with the old system.

This article is going to try and explain several points:
  • How the old CTH system works (You'll be surprised!!)
  • What's wrong with the old CTH system
  • How the new CTH system works
  • Additional benefits of the new CTH system

The article will be accompanied by several images. Please remember that the images are not to scale, and should be taken as an abstract representation of the system.

Please feel free to give feedback. If you have any questions, please raise them.

Also please note that this article will be published in sections, as I finish writing them. Please DO NOT REPLY before the last section is posted, to avoid breaking the order of my postings!!! Thank you.


How the old CTH system works

Before we can explain how the new system is going to work, it's essential to understand how the old (current) system operates.

I've written an article (posted in the 1.13 Guides Section) explaining how CTH is calculated, based on a wide variety of factors. If you've read that article, you know that the formula is ridiculously complex and very hard to make sense of. But the real problem isn't with how CTH is calculated, but rather how the final result is used by the game to determine where bullets go.

One of the greatest misconceptions about CTH is that people believe it actually means "Chance to hit the target". In fact, that is only part of the equation. If you fire a bullet with 100% CTH (not possible with the default INI settings) then yet, you would hit the target every time. However, if CTH is less than 100%, then a more accurate description would be very different.

Here's a bit of pseudo-code to explain the logic behind CTH:

CTH = a complex calculating taking a large number of factors into consideration. Its value is anywhere between 0 and 100.
RandomNum1 = A random number between 0 and 100.
If RandomNum is smaller than CTH, then
   Shot is a hit. The bullet is fired directly at the center of the target.
Else
   Shot is a miss.
   Radius = RandomNum1 - CTH
   RandomNum2 = A random number between 0 and Radius
   The bullet is fired anywhere within RadnomNum2 points away from the target's center


The first part ("Hit" bullets) are easy to understand: If the CTH roll succeeds, the bullet flies straight at the center of the target. Assuming no obstacles are present, this bullet will strike the target at whatever bodypart we selected. Therefore, with 50% CTH, 50% of the bullets are going to fly directly at the center.

The second part is the one most players are blissfully unaware of, and deals with bullets that failed the CTH check. Depending on how badly we've failed the check, the bullet can fly within a certain radius of the center of the target. Assuming that radius is large enough (low CTH), or the distance is long enough, the bullet may miss its target completely. However, there's always the chance that the bullet will still fly within such proximity to the center of the target that it will hit the target anyway, despite having been flagged as a "miss"! In fact, given the randomal factor used in the formula, it's quite possible for a "missed" bullet to fly directly at the center target just like a "hit" bullet would.

Here is a diagram illustrating this mechanism:

http://www.bookgallery.co.il/JA2PublicPosts/CTH/anim-oldCTH.gif
Click to enlarge

You can clearly see that even with 0% CTH, some bullets will hit the target anyway, especially at very close distance. Of course, CTH tends to be high at close distance to begin with, but you get the idea.


What's wrong with the Old CTH system?

Since the original JA2, CTH has been a great mystery even to those who had an idea about how it works. Some tools were available to calculate CTH, but most players shot their weapons by "feel", as there was no in-game indicator to let us know how much CTH we have for a shot. This was satisfactory to most players, especially because the range of weapons and attachments available to us was relatively minimal, and together with the original simplified formula these weapons performed just about as well as expected within the game environment.

The real problem with the old CTH system was only revealed once JA2 1.13 began showcasing a wider selection of weapons and attachments. We now had weapons capable of full-auto fire, and more importantly we had weapons that were capable of shooting beyond sight range, and sniper rifles that could hit a target far across the map with the aid of a spotter. These blessed additions, which served to prolong JA2's life by many years, coupled with the fact that CTH was now visible as a bar over the target, revealed a serious flaw in the old system: Weapons were simply becoming way too accurate for this sort of CTH mechanic. A weapon achieving 99% CTH is pretty much guaranteed to hit, and this makes life much easier for players, who can micromanage their CTH to reach such high levels. This is what's been known derisively as the "Headshot Game" - taking out enemies at long distances with powerful scopes, before said enemies can even engage you. It has almost singlehandedly kept day-time burst fire and autofire useless for several years (until HAM Suppression came along) and at night-time turns silent sniper rifles and burst/auto into an easy exploit.

You might say "well why don't we make weapons less accurate"? Well, it's not that simple. For one, weapons already cover most of the possible spectrum. If we make sniper rifles or scopes less accurate, they'll be less useful than rifles. If we make the whole thing less accurate, pistols would be rubbish even at close range.

The other option of course is to turn off CTH bars, like it was in JA2. However, again, the plethora of weapons and ability to fire beyond sight-range with many of them means that everything would turn into a puddle of guesswork. It would achieve the exact opposite of the above, giving us no indication about our shots, where it's obvious that at least some feedback from our mercs is pretty much essential. Also, whether we do or do not see our CTH, weapons with scopes (and sometimes without) remain ridiculously accurate anyway.

The solution to rebuild the CTH system therefore seems inevitable. A new system that can match the capabilities of JA2 1.13 is essential.

Continued in my next post


Re: New CTH system - Presentation[message #249911] Thu, 22 April 2010 17:43 Go to previous messageGo to next message
Headrock

 
Messages:1775
Registered:March 2006
Location: Jerusalem
New CTH: Main Guidelines

The new CTH system is therefore created with one major goal in mind: To crush exploits without making weapons or attachments less diverse, and maintaining a reasonable level of feedback from our mercs without letting us know exactly how likely we are to hit the target.

Surprisingly, the solution to this problem actually lies within the old CTH system. In fact, it lies in the part of the system that most players didn't even realize existed: the way the program handles "missed" bullets.

Let's recap that point: When a bullet is considered "missed", it is shot along a randomal angle. It can "veer off" the center of the target by up to a certain radius, which is dictated by how much CTH the shot had. Bullets with higher CTH are likely to go near the center of the target even when "missed", while bullets with low CTH can veer off quite far, and are likely to miss the target altogether.

The new CTH system takes this very idea and restructures everything else around it. In the process, it completely dumps the part where "hit" bullets are always fired at the center of the target - which was the reason why CTH used to produce such accurate results, and why players could micromanage their shots so efficiently.

So instead of the old system where CTH primarily indicates how likely you are to hit the target, imagine that CTH would simply indicate how far your bullets can stray off the target's center. The higher your CTH, the more concentrated your hits will be. The lower your CTH, the more spread out your bullets will be. When this idea is further expanded (as will shortly be explained), we can work out a system where CTH indicates how well our gun is aimed at the target.

The result is twofold: One is that with proper limits and range considerations, it's going to be very hard to guarantee a hit on the target, even with a scope. The second is that the amount of feedback from our mercs means we will know how well they are aiming their gun, but not what our chance to hit the target will be. To figure that out, we need to take range and scope into consideration, both values which are known to us players but not factored into CTH for us.

The bottom line is removal of one of the most problematic exploits in the past few years, and as a bonus makes the entire shooting system more realistic.


New CTH: Splitting it apart

As mentioned in the previous chapter, the new system is going to hinge on splitting apart the old system. One component - the "Miss Radius", is going to be the basis for the new system. The other component, the "center hit", is going to be removed completely.

However, the new CTH is also going to split apart something which has, for a long time, been completely solid: The difference between how well the gun is aimed, and how well the gun shoots.

With the old CTH system, the gun's various accuracy-related values are factored directly into CTH. It is used as a marginal flat bonus to CTH, and most guns have a very low accuracy value (best guns go up to 15%). This makes very little difference overall, and doesn't stand up to reality either. In reality, no matter how well you aim a pistol, at beyond a certain range the bullets will spread out over a target. The further away you get, the more spread out the bullets will go. This is due to an almost infinite number of factors acting on the bullet, like wind speed or dust in the barrel, which can alter its trajectory. Longer barrels and heavier bullets are designed to add stability to flight, ensuring that even at a great range the bullet will go where the gun is aimed.

To simulate this in the game, the new CTH system completely separates Aiming and Gun Handling from the gun's shooting properties. In other words, when preparing the gun to shoot we only take into consideration the factors that affect our aim. Once the trigger is pressed, it is up to the gun to deliver the bullet straight ahead. Even when firing with perfect aim, a short-barreled weapon will produce a spread pattern over the target rather than repeated hits at the same spot. A longer-barreled weapon will of course produce such a spread pattern only at a great distance, but beyond a certain distance no gun can maintain perfect accuracy.

In game terms these are called "Muzzle Sway" and "Bullet Deviation". Muzzle Sway represents the direction in which our muzzle is being pointed. If the gun is properly aimed and steadied, then the muzzle sway is limited to the center of the target (or very close to it). Aiming and Attachments can help decrease Muzzle Sway. The "Bullet Deviation", however, cannot be changed. It is tied to the properties of the gun, and does not benefit from aiming at all. If the gun is accurate enough for the shooting distance, we should feel no effect. At a greater range, the bullet may end up lodged far from where we were aiming. There is nothing the player can do to reduce Bullet Deviation, aside from modifying the gun... or pulling out a different one.

Another important "split" for CTH is the way that we calculate how well the gun is aimed. Instead of pooling all the factors together and using whatever comes out the other side, we now have two steps: "Base CTH", which represents how well the gun is aimed during a snap shot (no aiming involved), and "Aiming CTH" which is added when extra aiming APs are spent. The two behave almost separately, and are only pooled together once both have been calculated. As you will shortly see, this method is going to make a huge difference between aimed shots and unaimed shots. They will be useful in completely different circumstances, and complement each other when necessary.

At this point you might be very confused. Don't be. As you'll soon see, this system is quite intuitive, and will even look neat inside the code itself. Of course, part of the point is to confuse players so that they won't be able to "min-max" their shooting accuracy, but as this article goes on you'll hopefully begin to understand why the new system is superior to the old one, in both gameplay and realism.


New CTH: Glossary

Although this article is going to be accompanied by pictures, it may be necessary to understand a few key concepts that will be referred to. Don't worry if you don't understand these straight away - they're here to help you while reading.

Base CTH
A number of CTH points given freely for any shot, representing how well the muzzle is aimed at the target when the gun is not being properly aimed. Base CTH can be anywhere between 0 and 30, and is based primarily on the shooter's stats and condition. The average merc has about 20 CTH.

CTH cap
The maximum CTH achieveable by a shooter. It is based primarily on his stats. CTH can never be higher than this much, with ANY shot, no matter how much extra aiming is involved. The average merc has a cap of about 75%.

Aiming CTH
The total amount of CTH that extra aiming can provide. Each aiming level adds a part of this, with each level adding less than the previous one. Negative or Positive factors such as injury or morale can increase or decrease this.

Muzzle Sway
This is the simulation of the gun's muzzle moving back and forth over the target. The maximum radius of the sway is directly dependent on CTH - the more CTH you have, the smaller the radius will be, making your shots more accurate.

Muzzle Point
This is the point where the muzzle happened to be pointed at when the trigger was pressed. It is determined randomly once the bullet is fired, and is always inside the Muzzle Sway radius.

Bullet Deviation
A maximum radius to which a bullet can stray off the muzzle point. It is calculated after the bullet has been fired. Gun accuracy and bullet properties play an extremely important role here. There is nothing the player can do to decrease deviation, other than modifying the gun itself.

"normal" Shooting Range
This is an important factor in the whole system, and determines the range at which combat will be done. In practical terms, it is the furthest point where a gun's iron sights are 100% effetive. They begin losing effectiveness beyond that point.

Scope Magnification
Scopes now make the Muzzle Sway radius smaller by a certain factor, the scope's Magnification Factor. A 2x scope, for instance, makes muzzle sway half as large as it normally would be. However, this only occurs at a certain distance - the scope's "Best" range, which is based on the Normal Shooting Range. Beyond or before that distance, the scope is less effective (up to the point of being OBSTRUCTIVE).

Projection Factor
Similar to scopes, projection devices like lasers and reflex sights also have a magnification factor to reduce Muzzle Sway. However, these are effective all the way up to their "best" range, and lose effectiveness only beyond that range.

Recoil
Weapons no longer have an "Auto Penalty" or "Burst Penalty" value that directly affects CTH. Instead, they "pull" the muzzle in a certain distance and direction with every bullet in the volley.

New CTH: Advanced Glossary

These are concepts that refer to the inner workings of the new system. They are a little more difficult to understand, and are mainly important only if you want to know how this system works. Players will not need to understand these to play normally.

Gun Handling
A value calculated using the gun's AP to Ready Cost. It gives penalties to CTH, effectively making larger guns harder to aim properly at any distance. Bipods help reduce gun handling, and large weapons need either heavy autofire or accurate aiming to negate this penalty.

Recoil Counter-Force
Shooters using Autofire or Burstfire can now apply "counter-force" on the gun to stabilize it during a volley. This works directly against the gun's recoil. By applying counter-force correctly, a shooter can actually bring the gun's muzzle on top of the target during a long autofire volley, even if the first bullet was widely off-target. Tracer bullets help greatly in this.

Recoil Counter-Force Frequency
This is how often a shooter can adjust the amount of counter-force he is applying to the gun, during an autofire or burst volley. The lower this number, the more often the shooter can adjust, overall making his volley more accurate.

Recoil Counter-Force Accuracy
The shooter's ability to correctly apply counter-force against recoil. If counter-force is applied accurately, the gun will move back towards the center of the target. Otherwise, it will move away from the target's center.

Maximum Counter-Force
The maximum amount of force that can be applied to reduce recoil from the gun. If a character does not have enough Max Counter-Force for the weapon they are using, long autofire volleys will end up firing far away from the target.

Target Tracking
Moving targets are now considerably harder to hit. The shooter needs to "lead" the target correctly, compensating for movement by pointing the gun's muzzle ahead of it. This becomes easier if the target moves across a large distance. Targets making short, quick movements of a few tiles every turn can be exceptionally difficult to hit. The direction of movement relative to the shooting angle is also very important.

Bullet Drop Compensation
Shooting targets beyond the range of the gun is now possible. To do this, the shooter raises his muzzle to make the bullets take an "arc" instead of a straight line. This is very difficult to do properly, but skilled shooters can effectively increase their gun's range by up to 15% this way!

(More concepts will be added here if necessary)

That concludes the first part of this article. The second part will discuss the actual CTH system, how it works, and how it's going to affect the game.

(Continued in my next post)


Re: New CTH system - Presentation[message #249912] Thu, 22 April 2010 17:43 Go to previous messageGo to next message
Headrock

 
Messages:1775
Registered:March 2006
Location: Jerusalem
New CTH: Overview

Before I start the main example part of this article, I'd like to go over the basis of the system in theory.

The following is a pseudo-code representation of how this system is going to work, with the more complicated parts simplified for easier reading.

Base CTH = a value based primarily on the shooter's stats and various other factors. It is anywhere between 0 and 30.
Aiming CTH = a value based primarily on the shooter's stats and various other factors. It increases as more Extra Aiming Levels are added.
CTH Cap = a value based primarily on the shooter's Marksmanship. It can be anywhere between 0 and 100.

Muzzle Sway = Base CTH + Aiming CTH, both depending on the shooter's stats and all the conditional modifiers.
   Muzzle Sway is limited to between 0 and CTH Cap.
Bullet Deviation = A value derived from the gun's properties only.

RandomMuzzleSway = a random number between 0 and (100-Muzzle Sway)
RandomBulletDev = a random number between 0 and Bullet Deviation

Muzzle Point = a random point within RandomMuzzleSway distance from the target's center
Impact Point = a random point within RandomBulletDev distance from the Muzzle Point.

Fire a bullet directly towards Impact Point


This is obviously very simplified as you can see, but the point should be clear. We are determining how far the muzzle can sway from the target's center, then choose a random muzzle point within that radius. Then we determine how far the bullet can deviate off that muzzle point, and choose a random impact point within that radius. The shot is then fired towards that impact point.

It would be rather silly to continue explaining this without an actual visual example, which is why the next section dives right into it.

Brace thyselves!


New CTH explained

In this section we'll go step by step, showing various situations and how the game calculates where the bullet can or will go.

Maximum Sway

Let's start with this fairly enigmatic image:

http://img.photobucket.com/albums/v726/Headrock/Jagged%20Alliance%202/HAM/HAM%204/CTH/1-MaxDevLines.gif

Based on the limitations of JA2, bullets cannot veer more than 22.5 degrees to either side of the target. If we did more than that, the shot would look very strange, flying off to the side or something weird like that.

These yellow lines are going to be used for pretty much this entire chapter as a guideline.

Note that the target in this example is placed at a point called the "Normal Shooting Distance". This is an extremely important distance - it's the furthest point where a gun's iron sights are 100% effective. As you'll soon see, targets closer than this distance are easier to hit, and targets further away are harder to hit. The "Normal" distance is also used as the basis for multiplication when scopes are installed.

Ok, I'm getting a little ahead of myself, so let's just look at our CTH when shooting at this target.

Base CTH

http://img.photobucket.com/albums/v726/Headrock/Jagged%20Alliance%202/HAM/HAM%204/CTH/2-BaseCTH.gif

Look at the arches drawn around the target.
The red arch shows us the maximum possible deviation of the bullet at the target's current distance. If we were to have 0% CTH, then any bullet fired from the gun could end up anywhere within this red arch.

The purple arch here shows how much our base CTH (given to us for free for any shot) reduces the size of the shooting radius. The average JA2 merc should get about 20% Base CTH given no outstanding penalties. The shooting radius is decreased by 20%. This is actually quite a lot - the surface area of this arch is almost 40% smaller than that of the red arch - a significant increase in accuracy.

An injured soldier would have far less base CTH. Low morale, fatigue, inhaling gas, and various other factors can also reduce Base CTH, increasing the size of the arch proportionally. Note again that at 0% CTH, the Red Arch is used - the absolute limit.

Since bullets are randomly distributed anywhere within the arch, at this distance you can see that the chance to hit the target is pretty minimal, about 1 in 10 shots will hit this target. Of course, this is just Base CTH, meaning a shot without any extra aiming.

Extra Aiming

Let's see what happens if extra aiming is added:

http://img.photobucket.com/albums/v726/Headrock/Jagged%20Alliance%202/HAM/HAM%204/CTH/3-IronSightAiming.gif

Extra aiming can increase our CTH considerably. In fact, given no negative modifiers, you can increase CTH to 100% with any gun, with or without a scope. However, the character's skills, primarily marksmanship, put an absolute limit on how high CTH can go. The average merc will have a cap of 75%. Even with 8 extra aiming levels, this merc cannot possibly reach more than 75% CTH at any time.

The blue circle shows how well the gun is aimed once the CTH cap has been reached. As you can see, there's about a 90% chance to hit the target now. This is considerably better than a snap shot, and yet does not ensure a hit on the target. Keep that in mind for later.

Targets closer than "Normal" distance

http://img.photobucket.com/albums/v726/Headrock/Jagged%20Alliance%202/HAM/HAM%204/CTH/4-IronSightAiming-CloseRange.gif

This target is standing closer to us. Being below the Normal Distance, you can see that the "maximum" spread is much smaller. It has shrunk so much that the shooter can probably hit the target repeatedly even without any aiming. A pistol or SMG at this range can do some massive damage of course. Note that we STILL are not guaranteed a 100% hit despite the short distance - but one aiming level will easily shrink the arch to a size small enough to hit the target's head.

Here's an even CLOSER target, just to illustrate the point:

http://img.photobucket.com/albums/v726/Headrock/Jagged%20Alliance%202/HAM/HAM%204/CTH/5-IronSightAiming-VeryCloseRange.gif

Targets beyond "Normal" distance

Now let's see what happens if the target is standing further away.

http://img.photobucket.com/albums/v726/Headrock/Jagged%20Alliance%202/HAM/HAM%204/CTH/6-IronSightAiming-DoubleDistance.gif

Sway and Deviation are both calculated at the "Normal" distance if possible (shown in the first three images up there). Therefore, when the target moves further away, they increase at the same ratio. The CTH with the blue circle is 75%, the maximum this character can achieve. It's the same 75% CTH we had in image #3, but now the target is twice as distant, and the circle is proportionally 4 times larger! So despite achieving the same amount of CTH, it's now MUCH LESS likely to hit the target.

Naturally, this effect increases as the target is moved further back. The only way to hit that target reliably at that distance is, of course, to use a scope.

Scopes

Without extra aiming, a scope doesn't come into play. The gun is only being given a "rudimentary" aim at the target, no time is actually being spent to make sure it is pointed correctly. If you squeeze off a shot at this stage, it is considered to be fired without any scope. Therefore:

http://img.photobucket.com/albums/v726/Headrock/Jagged%20Alliance%202/HAM/HAM%204/CTH/7-ScopeNoAiming-DoubleDistance.gif

As you can see, we've gained no benefit from the scope installed on our gun, because we're not actually using it yet. At this distance, a "snapshot" is extremely unlikely to hit the target, and it gets much worse as the distance grows. Even if our character can get 30% Base CTH, that does very little to offset the massively wide Maximum Radius (red arch).

To make use of our scope, we add at least 1 extra aiming level. This is where magic happens:

http://img.photobucket.com/albums/v726/Headrock/Jagged%20Alliance%202/HAM/HAM%204/CTH/8-ScopeAiming-DoubleDistance.gif

By using a 2x Scope at its optimal range (2x the "Normal" distance) our shooting radius has been decreased back to its normal size. In essence, we are shooting at 2x distance with a 2x scope the same as we would at 1x distance with no scope.

This can be applied to any scope magnification level. A 4x Scope can achieve the same results at 4 times the "Normal" distance, a 10x scope at 10 times the "Normal" distance, etcetera.

Functionally, this means that the current XML value used for scopes, known as "MinRangeForAimBonus", will be replaced with a simple "ScopeMagnification" value. It determines the range at which the scope allows us to have a "normal-sized" shooting radius.

Scopes used beyond their "optimal" range

(sorry, no image for this one...)

If we want to see how the scope would behave at a range GREATER than optimal, just look at image #6, where a target is standing beyond "iron-sights" range. The shooting radius (red arch) is determined at the scope's optimal distance, so hitting a target that's further away is harder in direct proportion to the extra distance. In other words, if the target is at OptimalRange*1.5, it is 1.5 times harder to hit than a target standing at exactly the optimal range.

Scopes used BELOW their "optimal" range

This is perhaps the more interesting case, because it is directly meant to counter one of the more glaring problems with the JA2 combat system. In JA2, if a scoped weapon is used below the scope's "MinRangeForAimingBonus", the game simply pretends that the scope isn't there. In other words, the weapon is being fired with iron sights.

The new CTH system, however, imposes formidable penalties for using a scoped weapon below its optimal distance.

http://img.photobucket.com/albums/v726/Headrock/Jagged%20Alliance%202/HAM/HAM%204/CTH/10-ScopeAiming-NormalDistance.gif

The Shooting Radius in this case is determined by the location of the target, rather than the scope. In other words, in the example above, our 2x scope is behaving the same as a 1x scope. It does not "push" the red arch further back as it did before, even when aimed to full extent. It could be summed up like this:

Distance at which the shooting arch is placed = Scope's Optimal Distance OR Target's Distance, whichever is LOWER.


In addition, as explained in the image, any CTH we get from extra aiming levels is HALVED due to the decrease from 2x to 1x. This scope is actually functioning HALF AS WELL as iron sights, at the same distance of effectiveness. It would in fact be better to REMOVE the scope to shoot at this distance!

The exact penalty that aiming CTH suffers is again directly proportional to distance:

Penalty = "Optimal" distance for the scope / Actual distance to the target
Aiming CTH is divided by Penalty


Obviously, trying to shoot with a 10x sniper scope at this distance would be extremely innacurate - it could easily mean that extra aiming does not increase CTH at all!! In other words, any shot would be taken within the Purple Arch, representing only the Base CTH for the shot.

In addition, not mentioned in the image above, is the fact that Base CTH is derived from the gun's Handling value - a value heavily dependent on the gun's Ready AP Cost. This means that even the Base CTH circle (purple) would in fact be much larger for long weapons like sniper rifles and HBARs, possibly even reaching as large as the maximum shooting radius (red arch, or "0% CTH"), making any shot wildly inaccurate.

This goes to eliminate a serious problem that exists in JA2 currently. Sniper rifles (or other long-barrel weapons) which should be hard to use at close distance are so accurate that there's no penalty for their use in close-quarters combat. The new CTH system makes sure that such weapons are far less reliable in close range, especially if a large magnifying scope is mounted on top.


THE MUZZLE POINT

All those fancy graphics above are just one way to represent what goes on in the program without using mathematics to explain it. At the end of it all, the program is left with one circle which indicates how far the muzzle MIGHT sway from the center of the target. That is the Muzzle Sway value.

Once muzzle sway has been established for the shot, the program picks a completely RANDOMAL point within that circle. That is the muzzle point. To explain it in simple terms, that is the point where the muzzle of the gun is aimed at the exact moment that the trigger is pulled.

Therefore, aiming is essentially making sure that the muzzle will be aimed at least close to the center of the target when the trigger is pulled. The better your CTH when you pulled the trigger, your muzzle is statistically more likely to be pointing at or at least close to the center of your target.

Once the muzzle point has been selected, the shooter's part in this formula is essentially over. From here on, it's the gun itself that determines whether the bullet is going to strike or miss that Muzzle Point.


Bullet Deviation

After doing all the calculation above, it's the gun's turn to shine. Depending on various factors that are all outside the player's control, the bullet can hit the muzzle point or deviate from it up to a certain distance.

http://www.bookgallery.co.il/JA2PublicPosts/CTH/9-BulletDev.gif

Bullet deviation is always calculated at the "normal" shooting distance. If the target is further away, the bullet deviation is more pronounced. Optical attachments, which decrease Muzzle Sway by pushing the shooting radius further away, do not have any effect on Bullet Deviation. In fact, the only attachment that can assist bullet deviation would be a barrel extender or some sort of better ammo or barrel replacement. Other than that, your best bet would be to use a more accurate gun.

Bullet deviation is primarily affected by the gun's barrel length. In game terms that would be the gun's "Accuracy" value, which currently has little effect.

A pistol, for instance, would have a low accuracy value of perhaps 10-15. This means that its bullets can deviate quite a large distance off the Muzzle Point. At short distances suitable for a pistol, this has little effect. However, regardless of how good the shooter is, at a certain point the bullet deviation becomes so severe that it effectively lowers your chance to hit the target to practically nothing.

Conversely, a sniper rifle is ridiculously accurate, reaching values of up to 90 or 95. Again, because bullet deviation becomes worse with range, this is pretty much essential for a sniper rifle to hit its intended target.

Additionally, due to this interplay between Muzzle Sway and Bullet Deviation, it means that accurate rifles need to be well-aimed if they are to stand any chance of hitting their targets. A sniper rifle will put the bullet where it was aimed, so if the gun is badly aimed, the bullet isn't likely to hit the target at all. In contrast, an inaccurate weapon can actually compensate for bad aim by sending its bullets away from the muzzle point, potentially hitting the target despite the weapon being aimed far off-center.

One thing that's important to know is that bullet deviation cannot send a bullet outside the 45 degree cone (shown by the yellow lines and red arches). Again, this is due to program constraints and to avoid bullets doing weird acrobatics like flying sideways.


Summary

The old CTH system, which was well-suited for 1998's JA2, has outlived its usefulness. Built as a solid monolith with little regard to realism, it broke down once more detailed and varied weapons became available in 1.13, and allowed for some serious exploits that have degraded gameplay for years.

The new CTH system breaks the monolith apart, using each of its aspects as a separate calculation, giving each aspect its own place in the shooting mechanism, and by doing so eliminates some glaring exploits while enhancing realism across the board.

It is my belief that this system would serve to make gameplay behave more reasonably, and give modders a much better environment to model weapons and attachments to work as they do in real life.

And if that's not enough, this new system is going to pave the way for several "peripheral" improvements to other systems related to CTH which were not covered in the article so far. These improvements, as well as various other benefits given by the new CTH, will be covered in the fourth and final chapter of this article.

(Continued in my next post)


Re: New CTH system - Presentation[message #249913] Thu, 22 April 2010 17:43 Go to previous messageGo to next message
Headrock

 
Messages:1775
Registered:March 2006
Location: Jerusalem
Ramifications and additional features

The new CTH system is based on 3D mathematics, mimicking the real-life behavior of guns more closely than the old system. Due to having gotten rid of the tricks and illusions used by the old system to maintain gameplay, the new CTH system opens up several benefits that we can capitalize on.

This final chapter lists the various improvements that will accompany the new CTH system, either thanks to the inherent characteristics of the new system, or by using its components to provide better results in existing features. It also raises questions about things like modding and AI, which will need to be answered when the project gets into its advanced stages.

Playing with bullets

The removal of "center hit" mechanics from CTH gives us the opportunity to tweak bullet impact points for all sorts of purposes. This allows at least two possible features that have been only theorized so far:

  • A) Bullet drop
    • Guns have a certain range at which the bullets they fire remain stable in the air, after which range they lose aerodynamic properties and begin to tumble, causing them to slow down. To the human eye, it looks like the bullet "drops" fast towards the ground.
  • B) Muzzle Climb
    • Different guns respond differently to recoil produced by the bullets they fire. In burst/autofire modes, this is most pronounced, as it pulls the muzzle away from the target and fires subsequent bullets in a different angle. With the new CTH system, this can be modeled rather realistically.

BULLET DROP

The old CTH system relied heavily on the weapon's Range value ever since JA2. It had two major effects:
1) If the weapon is fired just one tile further than its maximum range, CTH gets cut in half (or possibly more).
2) Guns with longer range are more accurate up to that range, with CTH being proportional to the ratio between maximum and target distances.

The biggest problem with the above was the fact that both effects are derived from the same value. If you want a gun that shoots steady bullets over a certain distance, it will always be more accurate up to that distance than any other gun. This is what causes long rifles and sniper rifles to be uber-powerful at short distances. If the range is cut, it would be impossible to aim at distant targets. If the range is extended, the gun becomes more accurate at short distances. So obviously, the two effects need to be separated from one another.

In addition, that "up to a certain range and not a tile more" mentality gives very goofy gun behavior - one tile can make the difference between 80% CTH and 40%, which is ridiculous. Also, due to the completely randomal nature of "missed" shots, the result was that bullets fired from beyond distance do not simply hit the ground, they just fly off at a random angle.

The new CTH system will handle things very differently. First of all, the gun's Range property will only be used to determine a point where bullets begin to drop sharply towards the ground. Accuracy over the entire distance is largely unrelated to that value - as we saw above, it's more to do with the character's skills and condition, the optics used, and the Accuracy value of the gun. Therefore, the Range value will become MUCH less significant to the gun's shooting behavior, replaced largely by the Accuracy value.

As to bullet drop itself, it will be a gradual geometric rate of descent applied once the bullet reaches its maximum distance. Therefore, if shooting at a target beyond range, your bullets will most likely hit the ground just shy of their target. If they were fired slightly higher than the target (by way of the randomal distribution of bullets inside the shooting arch), they may reach the target itself, but this is again just luck. A target one tile beyond maximum range is therefore much more likely to be hit in the new system than it was in the old system, although properly aiming the gun is crucial anyway.

http://www.bookgallery.co.il/JA2PublicPosts/CTH/12-BulletDrop.gif

Bullets with better flight properties will therefore still give the gun a Range Bonus, but now that range is separated from CTH, it will no longer make the gun more accurate, simply capable of shooting at a greater distance. In addition, scopes with drop compensators can also give the gun a +Range bonus, making it capable of reaching further-away targets, without making the gun directly more accurate. This should provide modders with lots of fun things to do, modeling such optics more realistically.

MUZZLE CLIMB

As we know, most weapons have a recoil that pulls the muzzle upwards and slightly to the right. Some weapons only pull upwards, and others pull strongly rightwards. Other weapons have a very small recoil, and place bullets very close to one another in a burst or auto volley.

With the new CTH system, modders will be able to input specific recoil properties that tell the program how far in each direction the gun is pulling. Therefore, after firing the first bullet, the Muzzle Point will be automatically moved a specified (and slightly randomal) distance in the specified direction, at which point the gun fires again. Repeat for how many bullets there are in a burst or auto volley.

Here's a quick example of how this would work:

http://www.bookgallery.co.il/JA2PublicPosts/CTH/11-MuzzleClimb1.gif

This weapon has a mediocre recoil that pulls upwards and to the right. The white dot shows the Muzzle Point for the first bullet in the volley, as calculated by the new CTH formula within the shooting arch. At that point, the shooter's part ends, and it's the gun that determines where the next muzzle point will be, using the gun's internal recoil X/Y values. Once the next muzzle point's been calculated, the next bullet is fired in that direction, and repeat until the volley is over.

In addition, you can see that bullet deviation still takes a randomal effect for each bullet, as can be seen by the green circles around each dot. This gives some basic randomality to bursts, making sure that they aren't always fired in exactly the same deviation from one another.

The image above is rather basic however, and doesn't show some more ideas that I'm currently working on:

Firstly, the shooter should be able to compensate somewhat for recoil. In other words, instead of aiming the first bullet at the center of the target, an experienced shooter would've aimed downwards and to the left. Recoil would then pull the muzzle over the target, meaning that subsequent bullets in the volley would land on the target rather than flying away. This actually increases the chance of hitting the target with more than one bullet. To do this, the shooter takes into account both the gun's recoil values as well as the number of bullets that are going to be fired, adjusting his initial muzzle point accordingly.

I'm also working on shooters compensating for recoil by pulling the muzzle in the opposite direction while the gun is firing. Strength and Auto-Weapons skill will both assist this, accompanied by considerable randomality. Warmsteel has proposed a way to calculate this, which may be suitable for this purpose. The end result is that guns won't end up firing at the sky after a long volley, because the shooter struggles to bring the gun back to its initial point. Bipods, naturally, would assist greatly in this.

This would also allow us to model tracers even more realistically than in HAM - they would add to the shooter's ability to pull the gun back to the correct angle. The end result should be that shots by a more experienced shooter would be more concentrated than the ones shown in the image above, allowing for more deadly autofire over a distance.

MOVING TARGET

As with many other problems with the old CTH system, shooting at moving targets has never been a very difficult prospect. The game gives -1.5 CTH for each tile the target has moved since its last turn, which meant that a target that moved during its entire turn only gives -30 CTH, which can be easily compensated for by any reasonably good scope. This stands in the fact of logic as well, given that a scope would make a harder time tracking the target at non-optimal distance.

While I haven't worked out the finer details in this yet, I've come up with an interesting way to simulate target tracking using the shooting arch system.

One important change would be to track the target's point of origin - the tile it was standing on at the beginning of its latest turn. Comparing this to the tile it's CURRENTLY standing on, we get a vector of movement, so that we can calculate the angle in relation to the shooter, as such:

http://www.bookgallery.co.il/JA2PublicPosts/CTH/13-MovementVectors.gif

Obviously, a target moving straight towards us or away from us would cause no (or very little) change in our CTH. A target moving perpendicular to the shooting vector would give the most movement penalty.

Target movement penalty is applied by moving the shooting arch in the opposite direction of the movement vector. In other words, if a target is moving from right to left, we are more likely to shoot towards the right (behind it). Here's an illustration:

http://www.bookgallery.co.il/JA2PublicPosts/CTH/14-MovingTarget.gif

In this illustration, the target is moving from the right to the left at a 90 degree angle. The shaded character image shows the target's original location.

Each shooting circle (RED, PURPLE, BLUE) is moved a certain distance behind the target, based on how far the target has moved. This takes into account the target's angle of movement, as well as the shooter's skill. This movement is done simply by moving the "center point", the point where the muzzle would be aimed at 100% CTH. Everything else in the system will compensate automatically, making this very simply to calculate.

Each shooting circle is moved a distance proportional to its radius. That means that the "full-aim" circle (blue) doesn't move as much as the "Base CTH" circle (purple) which doesn't move as much as the "No-CTH" circle (red). This is to ensure that extra aiming and skill still helps, which would not have been the case if all circles moved together.

Short bursts of movement are more useful than prolonged movement in throwing off a shooter's aim. In other words, if the target has been running a long-enough distance, it should be easier to determine its heading and speed and thus easier to shoot it by "leading" it slightly. That's when the arches begin to move back towards their original positions, although they will not actually fully return there.

Naturally, the shooter's skill determines how far the circles will move off the target, and how quickly they begin returning to the original position.

The effect of scopes and range on this are yet to be decided. In theory, I believe that moving the shooting circle off to the side would suffice, although it may turn out eventually to require moving the shooting circles back towards the shooter (similar to shooting at a target that's too close). I'm pretty sure that won't be required though.

Finally, please remember that even though the shooting circles have moved considerably, bullets still cannot fly outside the yellow lines. Just a friendly reminder, because as I said early in this article, they never ever will.


SIMPLIFIED FORMULA

As I've mentioned repeatedly throughout this article, another problem related to the old CTH system is the way it looks in the source code. If you've read the "How does it Work" guide about CTH you probably already know that it's mind-bogglingly complex and virtually impossible to figure out how much effect each factor would have.

This is one of the advantages of the new CTH system, which is written in a fairly linear and standardized method. While a lot of factors take play determining the size of each shooting arch, they are organized in a way that each factor has a known and measurable effect on each component of the system.

I won't print out the entire code here, but that's the whole point - I don't need to. A simple outline will show exactly how this system works:

CombinedSkill = Average between several skills (EXP, MRK, DEX, WIS) with EXP getting 3 times more emphasis than others.
BaseModifier = Simple sum of all factors that affect Base CTH. Each factor has a known and measurable effect.
BaseCTH = (CombinedSkill * BaseModifier) / 100

CombinedSkill = Average between several skills (EXP, MRK, DEX, WIS) with MRK getting 3 times more emphasis than others.
CTH Cap = CombinedSkill

AimingModifier = Simple sum of all factors that affect Aiming CTH. Each factor has a known and measurable effect.
TotalAimingCTH = ((CTH Cap - Base CTH) * AimingModifier) / 100

AimingCTH = A part of TotalAimingCTH. How large that part is depends on how many extra aiming we use.

FinalCTH = BaseCTH + AimingCTH


This is quite a simplified formula of course, but given that it took me several posts just to explain the old CTH system's formula, you can see the benefit here. The "complex" part is where the factors are added up, but this is simple addition/subtraction, and the effect of each factor should be known and measurable (and... MODDABLE!).

We then figure out how much our CTH has reduced the size of the shooting radius:

If Target Distance >= Normal Distance then
   RedRadius = Maximum radius possible at Normal distance given a 45 degree angle (basic trigonometry).
Else
   RedRadius = Maximum radius possible at target's distance, given a 45 degree angle.

ActualRadius = (RedRadius * FinalCTH) / 100


From that point on, all that's left is 3D mathematics: picking a random point inside the shooting arch, and directing the bullet towards that point. All of the complex parts of the formula, like scope magnification, bullet drop and muzzle climb are relegated to this part. It calculates where the center point for the shot would be, randomizes a muzzle point, then randomizes an impact point, and shoots the bullet.

If burst/autofire is involved, the program moves the center point for the next bullet a certain distance away, dictated mainly by gun properties compared with shooter strength+skills+bipod.


EXTERNALIZED PARAMETERS

From the get go, I'm building the system so that it would be as externalized as possible. The idea is that testers who found that CTH was being calculated badly could change the importance of any of the factors that are involved in it.

This is done by the use of a copious amount of coefficients, each one influencing a factor in the formula. These coefficients are externalized to a separate INI file that's only used for the CTH system. By altering the numbers, you can for instance change how detrimental it is to be injured when aiming, or how experience level affects Base CTH. Since it's all done with rather simple maths, the results should be readily apparent inside the game, and having all this in an INI file means you (and I) don't have to recompile the code if any of the factors has too much (or too little) effect on the formula.

The amount of coefficients is quite large at the moment, and could potentially go above 100. However, I'm sure that most of them won't need to be touched at all - just the ones we find faulty. Once properly balanced values are found, it should be possible to hardcode these values, or possibly just leave the INI as it is so that players can experiment if they so desire.

Some of the coefficients are of course quite important. For instance, "Normal" distance is adjustable, and would subsequently change the range at which all scopes and sights work. It's even possible to use a smaller angle than 45 degrees as the spread limit, if one desires a game where weapons are overall more accurate. Close to the end of the project, there should be some sort of discussion about whether or not some of these more important coefficients should be "migrated" into the JA2_Options.INI file so that players would be able to control CTH with a handwave.


XML CHANGES

One of the most difficult and possibly most daunting task would be to decide how (or if!) to change the XML files to suit the new system. As you've read above, this formula uses the values of Range, Accuracy, and various CTH-related bonuses in a completely different way. Eventually, the weapons would need to be altered quite radically to suit it.

For instance, the Accuracy value would need to be adapted to a 0-to-100 range, where the most accurate guns occupy the top spots. That is because accuracy is no longer a minor value, and now determines bullet deviation. Burst/Auto penalty values for all weapons would need to be switched to an X/Y pair which determines how powerfully the weapon pulls up and right (or down and left when negatives are used). There are probably other changes that will crop up as the project continues.

Changes aren't only to Weapons.XML of course. Items.XML would need to be altered so that scopes and other attachments can now give bonuses and penalties that befit the system. Scopes would need a Magnification value that determines how much they decrease the shooting circle. Bipods would need to be set up on a scale of 0-to-100 as well, using that value to determine how effective they are in stabilizing the gun for aiming and auto-shooting, which are both not going to work the same as they did before.

Also it's been remarked that since this system may reduce actual chance-to-hit drastically, weapon damage values may need to be upped considerably. That is, coming closer to realistic "one/two bullets will kill you". The need for this would only be known once the system is actually tested, of course.

OPTIONALIZING THE SYSTEM

Aside from the massive undertaking this would require, there's also the question of optionalization. This is a hard nut to crack, mainly due to the changes to the XMLs. Having two copies of Weapons and Items XMLs, one used by the old system and the other used by the new system, would be a nightmare for modders.

One way to go about this would be to have separate tags for the new system which simply won't be used by the old one. However, this could end up being confusing for modders.

I am still looking for more ideas on this issue. Of course, do remember that it will be quite a while before this system is ready and fully tested, so integration with anything is not to be expected in the foreseeable future. But it's still good to think ahead on such things. Feedback will be greatly appreciated.

(To be continued)


Re: New CTH system - Presentation[message #249925] Thu, 22 April 2010 18:23 Go to previous messageGo to next message
Kaerar

 
Messages:2050
Registered:January 2003
Location: Australia :D
Woot first post Razz

Looking good mate and I'm sure most can understand your essay, though didn't Bob make a simple version of all that writing Wink


Re: New CTH system - Presentation[message #249938] Thu, 22 April 2010 21:04 Go to previous messageGo to next message
CptMoore

 
Messages:210
Registered:March 2009
So I like the idea of having a two stage CTH (guy and then gun) and including missing CTH much better so you don't have to have 100% hit to actually do damage.

Btw, one of the main problems I have is that sight range is not properly combined with CTH (probably my bad).

Some of the cover display features actually add to the sight range of someone (a moving or standing target can be seen better), however the CTH somehow cuts off at the normal sight range, allowing you to see farther away targets but makes it impossible to aim at them. Needs some fixing either in sight range calculations or in CTH.
Re: New CTH system - Presentation[message #249941] Thu, 22 April 2010 21:50 Go to previous messageGo to next message
Frog

 
Messages:24
Registered:January 2010
Location: the country of frog eater
just a small sugestion:

tracking : follow a target at long range is extremely difficult (because just made a small mouvement with your arm and you miss your shot), shooting an enemis who run and change stance or jump (from a windows or anithing else) is more difficult at great range than at small range

but at small range with a scope but without a reflex scope or normal iron sight this thing is completely different, it's very difficult to track someone with a scope at small range

-> in this two type of situation shooting a target is more difficult and result to some modificator whichi descrease cth


Re: New CTH system - Presentation[message #249943] Thu, 22 April 2010 22:12 Go to previous messageGo to next message
Anonymous
Things just got more complicated
Re: New CTH system - Presentation[message #249944] Thu, 22 April 2010 22:42 Go to previous messageGo to next message
Headrock

 
Messages:1775
Registered:March 2006
Location: Jerusalem
Please, all of your questions should wait until I'm finished with this article. You'll find that I have already come up with solutions to what you're saying. I do appreciate the feedback, but you're feeding back on an incomplete work Wink


Re: New CTH system - Presentation[message #249948] Thu, 22 April 2010 23:55 Go to previous messageGo to next message
Tango

 
Messages:106
Registered:July 2006
Waiting for you to finish before passing judgement Very Happy

Between this and the NAS changes that allow penalties for attachments to be done in much greater detail we might really start to see a real amount of diversity in weapon and attachment choices. Which can only be a good thing for the gameplay mechanics Razz.
Re: New CTH system - Presentation[message #249950] Fri, 23 April 2010 00:16 Go to previous messageGo to next message
Mauser

 
Messages:780
Registered:August 2006
Location: Bavaria - Germany
Wow Headrock, that looks like you

☆★GL★☆
Re: New CTH system - Presentation[message #249951] Fri, 23 April 2010 00:17 Go to previous messageGo to next message
Faithless

 
Messages:442
Registered:October 2009
Location: The safe end of the barre...
Quote:
Between this and the NAS changes that allow penalties for attachments

What would those penalties be?

To be honest NAS right now only makes guns "Swiss army knives of doom" and all balancing will be done by adjusting the existing attachments bonuses and penalties.

[Updated on: Fri, 23 April 2010 00:21] by Moderator

Re: New CTH system - Presentation[message #249958] Fri, 23 April 2010 01:39 Go to previous messageGo to next message
CptMoore

 
Messages:210
Registered:March 2009
Headrock you could probably misuse the display cover for displaying also the CTH for each tile in a colored fashion, so someone can see his CTH flattened cone.
Re: New CTH system - Presentation[message #249959] Fri, 23 April 2010 02:46 Go to previous messageGo to next message
Headrock

 
Messages:1775
Registered:March 2006
Location: Jerusalem
CptMoore
So I like the idea of having a two stage CTH (guy and then gun) and including missing CTH much better so you don't have to have 100% hit to actually do damage.


Well, you won't be able to reach 100% CTH anyway (nor can you with the current system, unless you modify the INI file). And only the most experienced and skilled characters will go above 90% CTH. Still, this system puts a great deal on choosing the proper weapon for your characters. Those with long rifles will not be able to engage targets at short range effectively (unlike the current system, where long rifles are killers at all ranges), and those with short weapons will need to close in with their targets, or spray a lot of lead, to ensure hits.

CptMoore
Btw, one of the main problems I have is that sight range is not properly combined with CTH (probably my bad).


Yes, and we're all patiently waiting for that to be fixed you know. Hint hint.

taoteching
Things just got more complicated


If you read my "How does it work: Chance to Hit" article, you'll know that the current CTH system is anything but simple. The calculation is ridiculously complex, and it's hard to tell how each factor affects... anything. And as I said in the first chapter, most people don't even understand how CTH is used after it is calculated. As far as I see it, I'm replacing a system that virtually nobody understands with one that at least works better (hopefully). I don't really expect players to understand how it works - they don't really need to. The only things players should know is that 75% CTH with a scope is far better than without one, or that 75% CTH with a pistol is hardly the same as 75% CTH with a rifle. Other than that, players will learn from experience. I'm pretty sure this thing is going to be surprisingly intuitive once we actually get to try it out.

Also, with the new system, even the CTH formula itself is extremely easy to read and understand. I'll publish an article once I'm finished writing it - you'll be surprised at how much sleeker it is. The calculation is really pretty basic for each of the three parts. It's just hard to explain visually because we're not used to thinking this way.

But the real clincher is the fact that if you think about it carefully, this CTH system is almost exactly the same as what you get in modern FPS tactical shooters (at least the more serious ones like Rainbow Six) where all of this stuff is simply shown as an expanding and contracting reticule around your shooting point. It's just that in a 3D environment, when looking from the perspective of the shooter himself, this would seem more natural. I'm simply applying the same principles to a game that doesn't have first-person view, so the visuals are naturally more confusing (and harder to make... my Photoshop is blowing smoke out the ears by now).

Mauser
you sure you


Re: New CTH system - Presentation[message #250016] Fri, 23 April 2010 14:52 Go to previous messageGo to next message
CptMoore

 
Messages:210
Registered:March 2009
Headrock
CptMoore
Btw, one of the main problems I have is that sight range is not properly combined with CTH (probably my bad).
[...]the CTH value is largely unaffected by range to target.

Hope the problem solves itself once the new CTH system is in place. :whoknows:

Aiming at invisible spots might be an interessting feature which could be introduced in the new CTH system (especially in night time). Spray tactics would be really effective when attacking people behind a tree.

Which goes into another topic, what about cover? There is visual cover lowering the guys CTH (what I redid mostly) while the material cover lowers the CTH based on the passed materials (this is not calculated into the CTH but is done while the bullet is flying).

Headrock
Base CTH remains constant no matter what tile you're shooting at, and Aiming CTH is also unaffected by range. It's the distance at which the shooting circle is placed that's important, and that cannot easily be shown in the same way as cover.

Display the ratio between shooting circle radius and normal human target size at the specific range? I also faced the problem that depending on other variables, the cover display just isn't correct.. so it just works for a standard situation which should give rough estimates for players.

Btw are big body types now easier to hit? Very Happy
Re: New CTH system - Presentation[message #250026] Fri, 23 April 2010 15:49 Go to previous messageGo to next message
Mauser

 
Messages:780
Registered:August 2006
Location: Bavaria - Germany
Headrock
The article's been updated with that bit - Bullet Deviation.


Well, now THAT sounds sophisticated to me!

you know what i like the most about your whole projects and work? the intricate and sophisticated way, you present and explain the mechanics and ideas behind what you

☆★GL★☆
Re: New CTH system - Presentation[message #250057] Fri, 23 April 2010 20:54 Go to previous messageGo to next message
Mauser

 
Messages:780
Registered:August 2006
Location: Bavaria - Germany
say Headrock, another point i

☆★GL★☆
Re: New CTH system - Presentation[message #250060] Fri, 23 April 2010 21:12 Go to previous messageGo to next message
CptMoore

 
Messages:210
Registered:March 2009
Mauser
how in you current system concerning scopes would you simulate a variable or multi-magnification scope?


Opon using the "L" key you can reset the current range of a scope to the point you aim while using L (should also take AP as modifying the scopes range should take some time). Currently happens automatically but why not make it manually?
Re: New CTH system - Presentation[message #250117] Sat, 24 April 2010 02:03 Go to previous messageGo to next message
Kaerar

 
Messages:2050
Registered:January 2003
Location: Australia :D
Good point Mauser, though I'd extend it further by altering the way scopes work. Currently they are a flat bonus to range which isn't necessarily what they do. There needs to be differentiation between the different types of scope so they function closer to their roles.


Re: New CTH system - Presentation[message #250152] Sat, 24 April 2010 03:15 Go to previous messageGo to next message
Headrock

 
Messages:1775
Registered:March 2006
Location: Jerusalem
Quote:
Hope the problem solves itself once the new CTH system is in place.


If characters behind bamboo continue to get 0 visibility, my system will be effected as well. As far as I can tell, the problem must originate from the SightRange formula, so until that is fixed any change to the CTH formula would not yield results on this specific matter.

Quote:
Aiming at invisible spots might be an interessting feature which could be introduced in the new CTH system (especially in night time). Spray tactics would be really effective when attacking people behind a tree.


Well, I'm not sure how that's going to function under the New CTH system, although I do want to enable aiming at invisible enemies.

There are two ways I can think of to apply visibility:

One way would work is by reducing the CTH Cap, which is otherwise based solely on skills. In other words, if you can't see the target, you can only reach about say 25-50% precent of your normal CTH limit. That means aiming still works as normal, but can't make you as accurate.

The other way is to reduce the Aiming CTH you get from each aiming level. This means that you CAN reach the same amount of accuracy, but only if you have a good scope and spend a lot of time aiming.

I don't yet know which way would behave better.

Quote:
material cover lowers the CTH based on the passed materials


The New CTH system completely ignores anything that happens after the bullet is fired. In fact, AFAIK so did the old system, actually. I believe you're referring to CTGT (Chance to Get Through), but I don't think it was ever used as part of the CTH system...

Quote:
Display the ratio between shooting circle radius and normal human target size at the specific range?


That's an interesting take, as long as it doesn't reveal too much information to the player. The whole idea is to stop players from min-maxing their shots due to having too much info.

Quote:
Btw are big body types now easier to hit?


Not as far as I know. I think only stance has any effect on target size.

Quote:
how in you current system concerning scopes would you simulate a variable or multi-magnification scope?


Since such a thing doesn't yet exist, I haven't spent much time thinking about it. It's unlikely that HAM 4 and NAS would coexist for at least a few months, so I'm not in a hurry to come up with a solution. However, for separate scopes mounted on the same weapon that should be easy - automatically pick the one with the smallest outer arch given the target's distance, and use that one. Mathematically this should provide the best results, and is not cpu-intensive. Perhaps in the future someone could come up with a sleek and "light" algorithm that picks out the best scope.

A single attachment with various magnification levels, however, would be more complicated. This is due to the way scopes are defined in Items.XML. Perhaps in the future we'll have some sort of XML for defining scope types, and then have an easier time creating multi-mag scopes, but at the moment this is impossible.

Quote:
Opon using the "L" key you can reset the current range of a scope to the point you aim while using L (should also take AP as modifying the scopes range should take some time). Currently happens automatically but why not make it manually?


Not sure it's as simple as that. It would obviously require some interface rework. Again, I don't think it would be required, at least not with the way JA2 works at the moment.

Quote:
Currently they are a flat bonus to range which isn't necessarily what they do.


Errr they are not. They add some sight range, but for shooting they work completely differently - increasing the amount of CTH you get per aiming click.


Re: New CTH system - Presentation[message #250153] Sat, 24 April 2010 03:23 Go to previous messageGo to next message
Kaerar

 
Messages:2050
Registered:January 2003
Location: Australia :D
Headrock
Kaerar
Currently they are a flat bonus to range which isn't necessarily what they do.


Errr they are not. They add some sight range, but for shooting they work completely differently - increasing the amount of CTH you get per aiming click.

My bad been messing with Vanilla a lot Wink


Re: New CTH system - Presentation[message #250158] Sat, 24 April 2010 05:03 Go to previous messageGo to next message
CptMoore

 
Messages:210
Registered:March 2009
Headrock
If characters behind bamboo continue to get 0 visibility, my system will be effected as well. As far as I can tell, the problem must originate from the SightRange formula, so until that is fixed any change to the CTH formula would not yield results on this specific matter.

Well bamboo SHOULD give you 0 visibility when you give it lots of sight range reduction in the ini (currently lots of cover is default).

The bug I'm talking about is actually sight range additions (not reductions) being applied incorrectly to CTH, as CTH will cut off preemptivly any calclations when the normal sight range max is overstepped. Not sure where the cut off happens though.. in LOS or CTH. It shouldn't be in LOS because you do see the enemy beyond your normal visual range (you get interrupts), but the CTH just doesn't work. By disabling all sight range adjustments which can be positive you can disable the CTH bug from happening.

Headrock
The New CTH system completely ignores anything that happens after the bullet is fired. In fact, AFAIK so did the old system, actually. I believe you're referring to CTGT (Chance to Get Through), but I don't think it was ever used as part of the CTH system...

Yes I meant CTGT. Would be cool to see the chance to hit based on the obstacles in between, or at least detect if an obstacle is in between and show an indicator that the current CTH is not the final hit chance. Unfortunatly I don't know any easy way to check for existing obstacles (there is some integrated stuff in LOS but I wouldnt touch that).
Re: New CTH system - Presentation[message #250160] Sat, 24 April 2010 05:50 Go to previous messageGo to next message
Headrock

 
Messages:1775
Registered:March 2006
Location: Jerusalem
Quote:
The bug I'm talking about is actually sight range additions (not reductions) being applied incorrectly to CTH, as CTH will cut off preemptivly any calclations when the normal sight range max is overstepped. Not sure where the cut off happens though.. in LOS or CTH. It shouldn't be in LOS because you do see the enemy beyond your normal visual range (you get interrupts), but the CTH just doesn't work. By disabling all sight range adjustments which can be positive you can disable the CTH bug from happening.


I know that the current CTH runs the Soldier-to-Soldier LOS test, which apparently returns a "relative distance". If things make the target less visible, the value returned is proportionally larger than the actual range to the target. This is used to determine CTH, which currently relies heavily on distance. What you're referring to might be related to how scopes currently work: they play with the relative distance, making the shot easier. Since I'm basically rewriting from scratch, I don't even remember how it currently works at all. Might have to re-read my own guide to figure that out. But if it IS the CTH system that's screwing things up, then rest assured that the new system would have no such issues. However, I do not believe that is the case - there might be differences between the CTH system's LOS tests and the ones used by the cover display. This is a very tricky one.

Quote:
Yes I meant CTGT. Would be cool to see the chance to hit based on the obstacles in between, or at least detect if an obstacle is in between and show an indicator that the current CTH is not the final hit chance. Unfortunatly I don't know any easy way to check for existing obstacles (there is some integrated stuff in LOS but I wouldnt touch that).


Remember that the system outlined above does not represent any sort of "Chance to Hit" per se. I only use the word because it's ingrained already. In other words, it doesn't care about obstacles, it just cares about where to fire the bullet. Everything that happens after the trigger's been pulled is completely irrelevant.


Re: New CTH system - Presentation[message #250161] Sat, 24 April 2010 06:14 Go to previous messageGo to next message
steelfallenangel

 
Messages:28
Registered:May 2007
[quote=Headrock]CptMoore


CptMoore
Headrock you could probably misuse the display cover for displaying also the CTH for each tile in a colored fashion, so someone can see his CTH flattened cone.


I don't think that would be a good idea. This system takes CTH completely differently from the old one - the CTH value is largely unaffected by range to target, and does depend heavily on aiming. Base CTH remains constant no matter what tile you're shooting at, and Aiming CTH is also unaffected by range. It's the distance at which the shooting circle is placed that's important, and that cannot easily be shown in the same way as cover.

So I'm going to stick with the CTH bars for this system. However, I'm probably going to add a second bar below the CTH bar which shows bullet deviation. That should allow players to have an at-a-glance assessment of bullet deviation for the gun they are holding. I'm not sure about this part though, it's left for later in the development process.


So the current display indicating giving a approximation for potential accuracy for a target will still be ingame but rather the system for how that is calcucated is changing.

Thats fine. I don't mind the guns acting more realistically I was just worried that with your system without some form of ingame approximation I would have to bust out the caclulator and notebook each time to find out my shot accuracy. Or even worse with the original game having it be nearly a complete guessing game.
Re: New CTH system - Presentation[message #250173] Sat, 24 April 2010 14:44 Go to previous messageGo to next message
CptMoore

 
Messages:210
Registered:March 2009
Headrock
I know that the current CTH runs the Soldier-to-Soldier LOS test, which apparently returns a "relative distance". If things make the target less visible, the value returned is proportionally larger than the actual range to the target. This is used to determine CTH, which currently relies heavily on distance.

I just read the code and yea the Soldier to Soldier LOS Test (and then Line Of Sight test) is directly used by CTH. In Weapons.cpp the CTH is using iSightRange like 30 times or so for various things. Though the LOS end of the functionality works correctly, well almost.

After rereading the code the cutoff bug got introduced by trying to patch some CTH bug reports, I thought back then I should exclude the sight adjustments in weapons LOS and now it seems that I actually should include it again because it was standard behavior to include cover for weapon LOS.




Ok now what is needed for a successful hit?
A1. Muzzle Sway (for first shot and subsequent)
A2. Bullet Deviation (Gun accuracy)
A3. Bullet Penetration (through obstacles, each obstacle might deviate the bullet and lower its power)

What influences Muzzle Sway?
B1. Shooter ability to stay steady.
B2. Shooter ability to center muzzle.
B3. Sight clearness for the ability of seeing the center.

What influences Sight clearness?
C1. Range to target (needs scopes when you have bad eyes or target is really far)
C2. Visual cover of target (cover=environment and clothes/camouflage)
C3. Target movement(relates to how well a target is tracked by the shooter, shooter needs wisdom?))

C1 & C2 can be read out by using the soldier to soldier test and using some ratio of "current max sight range" to "reduced sight range".
Re: New CTH system - Presentation[message #250174] Sat, 24 April 2010 14:59 Go to previous messageGo to next message
Headrock

 
Messages:1775
Registered:March 2006
Location: Jerusalem
Yes, you got it right. Point A3 is irrelevant to me, as I said after the bullet is fired I am no longer interested in it. Wink

C3 will be explained in the fourth chapter - It's going to be pretty devious.

As to whatever the problems were in the LOS system, I don't know much about that. But target visibility is now going to be used solely for the purpose you outlined above - increasing muzzle sway somehow for less-than-visible targets. However scopes won't figure into it that way - that's part of the point of using variable-sized Shooting Arches - the scope makes the arch smaller proportionally to its magnification, effectively countering line-of-sight issues due to range. This saves me a lot of headaches and keeps the formula simple.


Re: New CTH system - Presentation[message #250178] Sat, 24 April 2010 15:49 Go to previous messageGo to next message
Forral

 
Messages:75
Registered:May 2009
Location: Sweden
I just wanted to say that you write some excellent articles, Headrock. I'm usually not the sharpest tool in the shed but you do a brilliant job of conveying quite complicated information in a way that even I can easily ingest and understand. I thoroughly enjoy reading your articles regardless of what subject they may be concerning simply due to how well you structure your work. Smile
Re: New CTH system - Presentation[message #250224] Sun, 25 April 2010 03:38 Go to previous messageGo to next message
Biernath_J

 
Messages:181
Registered:August 2003
Location: Poland
Wow, that looks pretty serious.
I wonder how, according to this theory, whould buckshot/flechettes work?
Re: New CTH system - Presentation[message #250241] Sun, 25 April 2010 06:32 Go to previous messageGo to next message
Headrock

 
Messages:1775
Registered:March 2006
Location: Jerusalem
Exactly the same as all other bullets. I don't see a reason why they should behave otherwise.


Re: New CTH system - Presentation[message #250243] Sun, 25 April 2010 06:34 Go to previous messageGo to next message
Kaerar

 
Messages:2050
Registered:January 2003
Location: Australia :D
What about dispersal patterns? Duckbills tend to make a horizontal line Wink

Also are all the different shot in a shotgun blast considered as their own bullet?


Re: New CTH system - Presentation[message #250249] Sun, 25 April 2010 07:35 Go to previous messageGo to next message
usrbid

 
Messages:1552
Registered:December 2008
Hi Headrock, We talked over IRC about CTH in detail however I didn't read all of the above CTH posts you made as it appeard most of the details were discussed over IRC, as a result I may have missed new details.

I was wondering if the new CTH system will allow for the first bullet in a burst or auto fire period to be aimed (extra aim clicks spent)?

I would be fine with bullet 2..N to *not* benefit from extra aim clicks. An even more detailed system could cover a burst / auto penalty degredation.

If you really want to get fancy about it some existing weapon systems (e.g. AN-94) are capable of firing the first X rounds (where X is generally <= 3) on a higher fire rate (e.g. 1,800 rounds/min) and reduce the fire rate for all following rounds (e.g. 600 rounds/min).


Re: New CTH system - Presentation[message #250263] Sun, 25 April 2010 12:49 Go to previous messageGo to next message
DepressivesBrot

 
Messages:3804
Registered:July 2009
I'd also like to have aimed burst/auto. It keeps weapons with smaller calibers (and less recoil) useful when they would normally lack the ability to down an enemy with one or two aimed shots at a range that's just a bit to far for unaimed burst fire.

If I understand your presentation correctly, aiming would in any case just narrow the arch for the first shot and all consecutive shots would spread along a vector determined by all the influences you mentioned for burst fire.
So there is no need for degrading CTH under this system.



Re: New CTH system - Presentation[message #250269] Sun, 25 April 2010 14:15 Go to previous messageGo to next message
usrbid

 
Messages:1552
Registered:December 2008
DepressivesBrot
So there is no need for degrading CTH under this system.


Unless you want to be able to simulate recoil buffering or rate of fire reduction for some weapon systems. Smile

Edit: Ok, maybe I didn't explain what I meant really all that well. Some weapon systems have the ability to shoot more than one bullet without the operator feeling the effects of recoil. This means that the first couple bullets will all be aimed and effected by gun accuracy only, I believe this is the green circle in Headrock's ani GIFs.

[Updated on: Sun, 25 April 2010 14:19] by Moderator



Re: New CTH system - Presentation[message #250277] Sun, 25 April 2010 14:41 Go to previous messageGo to next message
Headrock

 
Messages:1775
Registered:March 2006
Location: Jerusalem
Quote:
What about dispersal patterns? Duckbills tend to make a horizontal line


The game treats shotgun pellets as several bullets, each with a fraction of the power of the group. But their vector of flight is determines only for the first pellet, and all other pellets spread out according to the pattern chosen. It should work exactly the same as everything else in the new CTH system, just as it works like everything else with the old system.

Do you think there will be some problem I haven't spotted?

Quote:

I was wondering if the new CTH system will allow for the first bullet in a burst or auto fire period to be aimed (extra aim clicks spent)?


Zilpin made Aimed Bursts, but the final version of his code messes up the targeting cursor a little. I'd have to figure out how to fix the cursor (possibly make a set of frames, like the ones used for single shots), which is a little out of my league, but might be doable. Autofire is more problematic because it would require two separate steps (aiming, and then selecting how many bullets to fire). I'm not entirely sure how to go about that. In theory, of course, I would like both of them.

Quote:
I would be fine with bullet 2..N to *not* benefit from extra aim clicks. An even more detailed system could cover a burst / auto penalty degredation.


As Disciple Brot has mentioned ( Wink ):
Quote:
If I understand your presentation correctly, aiming would in any case just narrow the arch for the first shot and all consecutive shots would spread along a vector determined by all the influences you mentioned for burst fire.
So there is no need for degrading CTH under this system.


Correct. The first bullet dictates a starting point for the burst, and from that point it is no longer "aiming" but just trying to redirect bullets towards the target by fighting against recoil, which is pulling shots in a very specific direction (dictated by BurstX/BurstY or AutoX/AutoY). It would take a strong and skilled merc to do so, but in theory a long enough burst would stand a good chance of hitting the target at least once, even when poorly aimed, assuming the distance isn't too great.


Re: New CTH system - Presentation[message #250305] Sun, 25 April 2010 21:36 Go to previous messageGo to next message
Faithless

 
Messages:442
Registered:October 2009
Location: The safe end of the barre...
As for shooting moving targets, your picture illustrates the blue (aimed) circle not being on the target at some point.
As this circle would be bigger if we hadn't aimed too much, we could have possibly still hit the guy, but once we start aiming more the circle would not be on the target at all making a hit (nearly) impossible.
Is there something that would prevent this from happening or is there something I'm overlooking?

P.S.
My people would call me an "ant fucker".
Re: New CTH system - Presentation[message #250342] Mon, 26 April 2010 00:09 Go to previous messageGo to next message
Headrock

 
Messages:1775
Registered:March 2006
Location: Jerusalem
Quote:
As for shooting moving targets, your picture illustrates the blue (aimed) circle not being on the target at some point.

That's my bad with the image, it's not intentional. The idea is that you always have some of the circle on the target, otherwise aiming would be detrimental, when it shouldn't.


Re: New CTH system - Presentation[message #250347] Mon, 26 April 2010 00:31 Go to previous messageGo to next message
Faithless

 
Messages:442
Registered:October 2009
Location: The safe end of the barre...
Looks good then Smile
Re: New CTH system - Presentation[message #250526] Wed, 28 April 2010 04:51 Go to previous messageGo to next message
Headrock

 
Messages:1775
Registered:March 2006
Location: Jerusalem
One thing I'd like to hear some ideas about would be how to handle the new system when the shooter is a robot, tank or crepitus.

In the old system, these units have very few special effects. Here's what I could find that's actually relevant:

  • ROBOT
    • Marksmanship skill is derived from the person controlling the robot.
  • TANK
    • -2 CTH per tile below 12
    • -13 CTH per tile below 12 when shooting at a crouched target
    • -25 CTH per tile below 12 when shooting at a prone target
    • -25 CTH per tile below 12 when shooting at the ground

The new system obviously allows being a bit more interesting than that. Also, you see that crepitus doesn't have any special effects in the old system, maybe some could be introduced.

Keep and open mind, and try to stick to the New System when making suggestions. This means suggesting modifiers for factors influencing Base CTH, Aiming CTH, bullet deviation, and so forth. Moving the shooting circle around or playing with its size is obviously part of the point.

Just hoping for some brainstorming, so don't worry if you suggest something that doesn't sound like it fits - it might be possible to adapt it somehow.


Re: New CTH system - Presentation[message #250527] Wed, 28 April 2010 05:47 Go to previous messageGo to next message
Frog

 
Messages:24
Registered:January 2010
Location: the country of frog eater
hum something from UFO type game:

-in reaction (interup in JA2) don't allow lots of aim clic, it's a fast reaction to something, you don't have the time to aim if an enemy just run and pass in the window in front of you, the same when he begin to be see just after a house corner ect -> caracters have just the time to fast move his gun and shot

-> made aim clic cost lots more
-> made clic to add shot in auto fire cost more
or
->made the first clic cost a lot (made in fact auto fire react with less shot than in your turn and aim shot without lots of aim clic)

or radicaly:

-> aim clic is not allowed and just few shot in auto mod is possible in interuption (ufo like game: reaction fire is always instant no aim shot)


(and don't allow to switch the gun or the thing you have in your hand, don't think it is doable (oh!! an enemy, hum go to my bagpak schearch the handgun, aim during long time this enemy, shot him, reaim reshot, he is dead good (and made all of this in less than 1/32 second Very Happy ) )

[Updated on: Wed, 28 April 2010 05:53] by Moderator

Re: New CTH system - Presentation[message #250535] Wed, 28 April 2010 11:00 Go to previous messageGo to previous message
DepressivesBrot

 
Messages:3804
Registered:July 2009
Some intuitive thoughts about the robot:
1. It should have quite low muzzle sway, seeing as it doesn't suffer from those small, random muscle movements or breathing. (It can't use scopes, so it won't become a super accurate sniping platform)

2. But on the other hand it should probably suffer more from muzzle climb as it doesn't look like a very sturdy platform. In fact, it will probably be rocked pretty hard by the recoil of heavier rounds.
(could be wrong, should do some research on SWORDS and the like)

3. Could we restrict bolt-action rifles/pump-guns so they can't be used by the robot? Never figured how it would cycle the action.

Basically I envision two major roles for the robot:
a) Breeching doors, so you don't have to risk a merc.
b) Support platform, probably with MGL
(can the robot use laws?, it shouldn't be able to use mortars however, for the same reason stated with bolt-actions)

I'm not entirely sure about 2, seeing as real robots are used with light and medium MGs and the platform could be heavier and more stable than it looks, could probably stay nevertheless for balancing purposes.


Previous Topic: Alternative Music Pack??
Next Topic: Instead of keep moding v1.13 why not create a WHOLE NEW GAME?
Goto Forum:
  


Current Time: Mon Aug 19 23:50:12 EEST 2019

Total time taken to generate the page: 0.03116 seconds