ant222 0 Posted August 17, 2005 Share Posted August 17, 2005 [pre]COMBAT SYSTEM FOR A REAL-TIME STRATEGY{if you have troubles with viewing this in the browser, use Notepad. I stillcan't make use of the tag.}PrefaceDon't faint away at once! I am rather sure you'll find too complicated. Butmany significant simplifications are POSSIBLE and they will be added. But inorder to understand how it works you should read this anyway.This part deals with firing at vehicles from guns (non-bullet), other types offire will be modelled by means of MINOR changes.I. Needed values.1. What characteristics a unit should have.a) The velocity vector.b)C1, C2, C3, C4, S - constants.<will be later>2. Derivation of some needed values.a) The target position relative to the firer. We'll store it as a radiusvector of the target:Rft^ = {Tx - Fx, Ty - Fy}, Where Fx, Fy, Tx and Ty are the coordinates of thefirer and the target.b) Tangential target size. It is the 'visible' target size.Lt = (Tl*cos(R^, V^) + Tw*sin(R^, V^)), whereTl and Tw are the length and width of the target; (R^, V^) is the anglebetween vectors R^ and V^.cos(R^, V^) = (R^ * V^)/(|R^| * |V^|)sin(R^, V^) = sqrt(1 - (cos(R^, V^))^2)c) Angular size of the target.alfa = Lt/|R^|, where |R^| is the absolute value of vector R^. Actually, alfa= sin(Lt/|R^|), but for low angles we can use this approximation.d) Target's velocity relative to the firer.Vtf^ = Vt^ - Vf^, where Vt^ and Vf^ are the target's and the firer'svelocities.e) Target's tangential velocity, scalar value.Vtf_tau = Proj(Vtf^, tau^), tau^: (tau^ * Rft^) = 0, (A^ * B^) = Ax*Bx +Ay*By- scalar product.Derivation of tau^.1) if Rftx <> 0 then Quote Link to post Share on other sites

Gilneas 0 Posted August 17, 2005 Share Posted August 17, 2005 Sounds pretty good, if this is implanted, will the game have a combat system equivalent to Total Annihilation? Quote Link to post Share on other sites

ant222 0 Posted August 17, 2005 Author Share Posted August 17, 2005 I have not played this game.With the current D2TM this system simply won't use its capacities at full: the AI must be able to manuever; the damage system must be more realistic... Quote Link to post Share on other sites

ant222 0 Posted August 18, 2005 Author Share Posted August 18, 2005 And now let's go down from the sky onto the earth.With the current D2TM engine many features of my system would be totally or almost useless. So, here is a simplified version.1. Dispersion is a function of only omega and Vtf_tau.2. Vtf^=Vt^. (Units shoot when motionless)3. Instead of storing Tl and Tw separately and calculating alfa depending on its orientation and Rft^, it may be assumed that Lt is always constant for the given unit.Thus:0. Calculate alfa using a preset Lt. (simplification #3)1. Canculate Vft_tau^ as described above, letting Vf^ = 0.2. Calculate omega.3. Calculate dispersion, D = S + C1*omega) + C3*Vtf_tau.4. Calculate phi: phi = sqrt(D).5. By formula (4) find the hit probability.6. Perform constant fit as described above.BUT: the requirement to fix the diagonal movement bug remains. Quote Link to post Share on other sites

MrFlibble 121 Posted August 18, 2005 Share Posted August 18, 2005 * After reading this, MrFlibble feels stupid and illiterate ** MrFlibble's very cross... * :D Quote Link to post Share on other sites

stefanhendriks 29 Posted August 18, 2005 Share Posted August 18, 2005 Even i can't barely understand this. I need to hear it in 'normal language'. ie, i understood it when you said "shooting when motionless". Heh. Sorry.Â :-[ Quote Link to post Share on other sites

ant222 0 Posted August 18, 2005 Author Share Posted August 18, 2005 Ok. Write an example of what you can't understand in order for me to get an idea. Quote Link to post Share on other sites

nemafakei 6 Posted August 18, 2005 Share Posted August 18, 2005 Stefan, I advise drawing diagrams to help visualise it first. Ant, if you explain what you're doing more (i.e. not just sentences where half the nouns are variables), it might help.e.g. "II Approximation of the Gauss distribution.We will approximate it by a triangle:"An intro paragraph of what this does and why might help. Quote Link to post Share on other sites

ant222 0 Posted August 19, 2005 Author Share Posted August 19, 2005 Oh... I thought that was due to my terrible English, while it is due to my style. I'll try to explain it, not only to give the algorithm.Do the terms 'tangential speed', 'angular size', e.t.c. need an explanation too? Quote Link to post Share on other sites

ant222 0 Posted August 19, 2005 Author Share Posted August 19, 2005 An intro paragraph of what this does and why might help......follows:[pre]If we take a variable which is affected by some random disturbance and measureit many times, we'll find out that among the measured values there are somemet often and some met rarely. If we build a graph on which along the X axisare marked the measured values and along the Y axis - the number ofmeasurements yielded this particular value, the points on it will tend todescribe a "bell" shape: high inaccuracies are met more rarely than low. Thecenter of the "bell" will have the X coordinate equal to the mean of all theperformed measurements.For this set of values the probability of each value is in direct proportionto the number of measurements which have given this result. So, downscalingthe graph along the Y axis by the total number of measurements will result ina similar-looking graph, where for each value on the X axis is set theprobability (on the Y axis) to get this value in a (any) measure of thevariable in question. Now, if you need to know the probability of the factthat the variable lies between say A and B, you just need to sum the Y valuesfor all the points on the X axis lying between A and B.N.B.: The probability for the variable to be within its maximum and minimumis, of course, equal to 1 (one). Therefore, the sum of the Y values for allthe points on the graph will necessarily yield 1. It can be simply proved. Onthe unscaled graph the same sum would be equal to the total number ofmeasurements, since we have built the graph in this way. After scaling (=dividing by the total measurements number) we'll get 1.If the number of measurements tends to infinity, the points form an exact"bell" shape. This is the Gauss distribution of the variable. The Y-values arecalled probability density. But of course, now the probability to get everycertain value as the result of a measurement is negligibly low (after we haveswitched to a limit). It is as negligible as a point of a line segment.The use of this new graph is slightly more difficult. Imagine, you want toknow the probability of the variable's being between values A and B:(x>=A)&&(x<=B). To accomplish this, you'll need to calculate the defineintegral (=summator for infinitesimal values) of the function with A and B asthe lower and the higher limits.This distribution naturally emerges in many processes. Particularly, inshooting, where the distance between hit points and the target center obeysthe Gauss distribution.Implementing something resembling this distribution (rather than fully empiricformulas) will reduce the game's abstractness and, I hope, brighten the gamefeeling.[/pre] Quote Link to post Share on other sites

ant222 0 Posted August 20, 2005 Author Share Posted August 20, 2005 [pre]EXPLANATIONS (CONTINUED)GAUSS DISTRIBUTION APPROXIMATIONAs mentioned above, the probability calculation requires integration. theexact Gauss distribution (exp(x^2)) is really CPU-expensive to integrate.Since I am not a specialist in this field, I see only two ways to solve thisproblem.1. Tabulation. We can store the function as a table with two columns: X and F(X). Or we can store the integral in the same way: X, Int(-X, X). Fortunately, the lower and the higher limits are of the same absolute value. Before finding the integral by this method, we will have to rescale the found [alfa] to maintain the ration alfa/sigma.2. Approximation by a simpler function. Replace Gauss distribution with a function whose integral can be calculated automatically. For example, we may divide the "bell" into several vertical zones (X1, ..., XN) and build a function which in every zone [XN...X(N+1)] will be a line segment. Triangle is the simplest possible approximation of this kind. This method yields an explicit formula for the integral (see formula 4).FACTORS OF HIT CHANCEIt is evident that the hit probability should depend on some firer'sproperties and some target's properties.I Firer's properties.1. Standard dispersion. When testing a gun, it is clutched in a heavy construction and fired several times in a row (no too often - the barrel may overheat and decrease the accuracy). If the target is quite far from the gun, it'll be seen that the projectiles haven't all hit the same point - there were a dispersion, which is the gun's property. This dispersion caused by the weapon properties I called S - standard dispersion. ...II Target's properties.1. Angular size. In 2d the line from the firer to the hit point may be defined via the angle this line forms with the one from the firer to the center of the target. Give the distance, angular deviation may be easily converted into linear. So, we assume that at every given moment the distance from the firer to all points of the target is constant (in reality it is almost constant). This allows to state that angular deviation obeys Gauss distribution. Now, to calculate the hit probability, we need to know the target's angular size and the distribution of angular deviation, the integral being calculated with -alfa/2 and +alfa/2 as the lower and the higher limits, where alfa is angular size.2. Angular velocity Shooting at moving targets is harder than at motionless. This and the two following factors are to take it into account. Actually I don't know how it effects accuracy, I just assume that it causes an additional dispersion proportional to the Angular velocity: F1(omega) = C1*omega (see (6))3. Linear tangential velocity. When firing at a distant moving target lead have to be determined. Angular lead is proportional to the distance to the target and to the target's omega. And the inaccuracy in the lead calculation is proportional to the lead value. Thus, the need to determine lead introduces an additional dispersion proportional to the product omega*|Rft^| which is equal to |Vtf_tau|: F3(Vtf_tau) = C3*|Vtf_tau|. It was a mistake that I hadn't placed Vtf_tau in |...| above.4. The intensity of the target's maneuvers. Obviously, a maneuvering target is harder to hit. To take it into account I invented (?) the Maneuvering Degree (MD). Its derivation have been described above. Unlike the other listed factors, MD depends not only on the target properties, but also on the Aiming time of the firer. Notes on the latter value will be added soon. And I assumed that additional dispersion is in direct proportion to MD: F2(MD) = C2*MD. I am not sure this is true. I'll try to find corresponding info.[/pre] Quote Link to post Share on other sites

ant222 0 Posted August 21, 2005 Author Share Posted August 21, 2005 [pre]III AIMING TIMEIt is the time which passes since the firer begins aiming till it takes ashot.Aiming time has three parts:1. Reload time The time needed to reload the weapon (if it hasn't been done yet)2. Rough aiming. I'd characterize this stage by its main factor: the speed at which the weapon can chance its direction. For example, the angular speed of a tank's turret. For infantry it'll be very fast, especially for light weapons.3. Fine-tuning. Once, the first two stages have been accomplished, the firer needs to precisely point its weapon at the target. Major factors: weapon size/mass, aiming skill, some of the target's properties: it should take more time to aim at a maneuvering trike than at a huge motionless harvester.The first constituent is constant for the given unit. The second constituentis calculated, assuming a constant angular speed for the given unit. Angulardistance between the current weapon direction and the direction to the targetshould be divided by the angular speed of weapon rotation.The third constituent is the hardest to calculate. It should be a function ofthe target's angular size, tangential speed, angular speed and, maybe, MD.And, of course, it should be a function of angular weapon speed (see roughaiming) of the given unit. A linear combination of these won't be ok. I'llthink on the formula.Thus, difficult targets will be fired at at a lower ROF.[/pre] Quote Link to post Share on other sites

Gilneas 0 Posted August 21, 2005 Share Posted August 21, 2005 What does MD stand for? Quote Link to post Share on other sites

ant222 0 Posted August 21, 2005 Author Share Posted August 21, 2005 MD stands for Maneuverability Degree. It is needed to take into accont the target's maneuvers performed to avoid hits. Its calculation is described in section Quote Link to post Share on other sites

ant222 0 Posted August 22, 2005 Author Share Posted August 22, 2005 [pre]Hello everybody.Two major bugs found! I really don't know how I couldn't have noticed thembefore.The first bug is connected with the aiming time. Rough Aiming time (RAT) cannot be calculated in the way indicated above. It should emerge mechanically inone of two possible ways:1. Quote Link to post Share on other sites

Winter Dragon 0 Posted September 29, 2005 Share Posted September 29, 2005 Are you talking small tweaks with this stuff or radical changes? Also could you use examples of what a unit does with the current combat system, and then what it would do with the ideas you're posting.Ie. Currently a rocket launcher will fire two fairly accurate rockets at a vehicle. With this formula and that anomaly the rockets will land somewhere slightly different each time. Examples like this would help me understand what you're talking about. Quote Link to post Share on other sites

ant222 0 Posted September 30, 2005 Author Share Posted September 30, 2005 First of all, I'd like to say that these ideas have a low chance to be implemented in D2TM. This game has a real-time global mode and simultaneous battles are possible in it (two battles in two different regions). Thus, tactical level has become not as important as it was in Dune-2. The developers want to keep the tactical mode quite simple in order for the player to be able to control the whole empire in real-time. But my ideas were intended to make the tactical mode more interesting and diverse, assuming that the player is not distracted by another parallel (simultaneous) battle or the need to do something in the global mode.If global mode sessions and tactical battles were not parallel, e.g you play a tactical battle, then give some orders in the global mode, then play another battle (like in Xcom), then my system could work as well. But in D2TM the player will simply have no time to enjoy the interesting and comlex tactical gameplay which my system offers.Are you talking [about - ?] small tweaks with this stuff or radical changes?Of course, I mean radical changes.Also could you use examples of what a unit does with the current combat system, and then what it would do with the ideas you're posting.I posted several such examples in the thread Quote Link to post Share on other sites

## Recommended Posts

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Note:Your post will require moderator approval before it will be visible.