UFO:Alien Invasion

Development => Design => Topic started by: Anton on June 25, 2006, 12:51:03 pm

Title: A better reaction fire system
Post by: Anton on June 25, 2006, 12:51:03 pm
Hi all, you may find the following of interest...
Questions are welcome, though I am not sure someone ever reads this huge post...
//And sorry for my English

A System of a Tactical Turn-Based Game

Well, it's well known that turn-based games are great. The division of the in-game process into alternating turns, cyclically performed by the players, gave, first of all, the ability to play games requiring the player to control a complex system of interacting objects without hurry, allowing him to carefully analyze the situation before making any actions.

Second, the turn based system naturally  allows for comfortable play of more than 1 players on the same machine, which is not used by many modern turn-based games for some reason.  

And the main drawback is called turn-based-ness. When one player is active the other is waiting for his turn. In turn based tactics it yields unnaturally uneven gameplay, where the same situation can lead to totally different results if occurred in different turns, and even at different moments of a turn.

To partially compensate for this effect was developed the so called reaction fire. The units could act (often only make a limited number of shots) in the opponent's turn in reaction to certain events, mostly - spotting an enemy. In spite of the high non-symmetry of such system, in some games (X-COM 1,2) reaction fire occurred not every time it could happen, only part of possible reactions were realized. The chance for a given reaction (or opportunity) fire to happen was hard-coded or depended on the unit's reaction. This was an additional non-symmetry because in active phase units surely made a shot if
they'd been ordered to.

Also, reaction fire often used action points reserved from the active turn, so if someone was moving at his maximum speed, he couldn't react at all, which's ridiculous too.

So I decided to propose a better reaction fire system, which, being within the general frame of XCOM-like system, would be less prone to the indicated (and maybe some other) drawbacks.

First notes

Here I am based entirely on the following statement. Since turns are just a logical division of time, ideally, the outcome of any situation mustn't depend on in which turn it occurred and at what moment since the beginning of the turn.

First, my system has one global distinction from the XCOM-like RF-system: it doesn't feature saving time units for reaction. The reason's quite evident.

Let's consider the following situation from viewpoint of the XCOM-system. Unit A has taken position in a shed, taken aim at the entrance and saved say 24 time units for a snapshot. Then, an unwary unit B from the other team tries to enter through the door and... gets spotted by A.

In XCOM A will be given a chance to react, depending on A's reaction. The chance may also depend on the type of shot, B's reaction... - I don't know exactly. Anyway, once the chance is calculated, computer generates a random number and decides whether A can conduct reaction fire or not. If A is lucky, he'll make shot and kill B. Suppose, his snapshot costs 22 TUs, so A can't shot during the opponent's turn anymore. Thus, if enemy C sneaks along the wall and then rushes into the shed, A won't do anything. A has spent his TUs and now he can only stay motionless and watch C killing him.

Now, let's imagine the same situation with the only difference: at the beginning of his turn, A was closer to the shed, so when he entered it and turned around to face the entrance, there were 44 TUs at his disposal. Again, if he's quite lucky, he will kill B and still keep one reaction shot on hand. Now, C won't kill A so easy, because A will try to react for a second time (22+22=44)

But wait, the above two situations are different only within the XCOM turn-based system. In reality they'd be identical: A hides in the shed, B and C pursuit him, entering the shed one after another. And since our purpose is to make a more realistic turn-based system, here goes the first distinction:

In my system time units will not be saved for reaction. A unit will be able to react throughout all the opponent's turn irregardless of how many TU's he's spent in his preceding turn. And this is based on mere evidence: in real battle nobody stays quietly under fire because he's run out of his time units.

Thus, in my system units receive the same amount of TUs in the beginning of each turn, irregardless of whether it is their or the opponent's turn.

Another problem with that feature of XCOM system: the faster you move during your turn, the less TUs you have to react in the opponent's turn, and vice versa. Thus, if you run as fast as you can, you may be sure that if an enemy spots you in his turn, you won't be able to walk a couple steps or make a shot, how realistic! As you see, in XCOM the outcome highly depends on the way time is divided into turns and on the location of the moment on the time axis relative to the boundaries of the current turn.

Note, that the above proposal reduces this dependence: whenever reaction occurs, the unit will react the same way. Ok, we are moving in the right direction.

Now, another connected problem: in XCOM any action (a shot, for example) was located within one turn. You weren't able to start shooting in your turn and end in the next opponent's turn. This led to a ridiculous situation: if you had 23 TUs and your snapshot costed 24 TUs, you couldn't make a shot. 1 TU significantly effected the outcome, which, of course, is incorrect. So, the second rule reads:

New turn doesn't cancel actions started in the previous turn. Thus, however few TUs you have, you may spent them on anything you want. In this case your orders will be complete in the enemy's turn, and vice versa: unfinished reaction fire (or other reactions) will be accomplished in your next turn, if you don't cancel them.

All actions are performed at the expense of TUs the unit's been given for the current turn, so this "interturn" action spend the last TUs of one turn and the first TU's of the next one.

For example, you have 8 TUs and give a snap shot order, costing 20 TUs. In this case 8 TU's will be spent in your current turn, and, in the opponents turn, your unit'll spent the resting 12 TUs and take the shot.

This will make interturn transitions smoother and more realistic, because in reality there are no turns and no interturn boundaries.

But the opponent (in his turn) may escape your unit's LOS before he shoots. Yes, and in this case your unit shouldn't shoot. But TUs spent on aiming won't be reset. Your unit'll just stop aiming.

For example, in the opponent's turn you spent 10 TUs before you lost the enemy. But you needed 2 TUs more to shoot. In this case you don't shoot and your total TUs (for this turn) are decremented by 10.

Now you should have understood that in my system both your and the enemy's units can act simultaneously. Yes, it is true. And the turn defines only who can control his units (active turn) and can't (passive turn). The units of the latter player are controlled by their reaction instructions or they are finishing interturn actions.

N.B.: Reaction instructions are ones that define a unit's behavior during the opponent's turn. They are defined by players in their active turns. In case of interturn actions there are two choices:
1. Reaction first - when the interturn action is interrupted if reaction condition occurs.
2. Interturn action first - when the unit finishes his interturn action and only after that becomes ready to react.

Now, it's time to discuss the structure of the in-game time. We have simultaneous actions performed by both the sides (In XCOM the inactive side could perform only momentary action - reaction fire, which wasn't considered as having length), so there should be common time counter for the units of both teams.

Current time in my system is defined as the maximum number of TUs spent by the units of the active team.

Thus, all interturn actions of the passive team are synchronized with this parameter. Such structure allows for real simultaneity: for any given moment both teams have been acting for the same period of time.

Reactions will use a similar synchronization as well, but with a little modification. When a reaction begins (reaction condition's just been met), a snapshot of the active team is made: for each of the active team units their spent TUs are remembered S1,...Sn. T-parameter, time spent by the active team from the reacting unit's viewpoint, will now equal to the maximum of times spent by the active units since the "moment" of the snapshot (as the active units continue to act after the beginning of the reaction):
T=max{S'1-S1,...S'n-Sn}, where
S'i denotes TUs currently spent by the i-th unit of the active team (changes with time), while Si is the same value measured at the moment of the snapshot (it is constant for the given reaction).

EXAMPLE OF REACTION FIRE

Active team - A, it's units are A1, A2 and A3
Passive team - B, the units being B1 and B2

A2 goes into a shed (spends 24TUs), A1 turns round the corner and (spends 36 TUs) gets spotted by B1. (A3 hasn't moved) It takes B1 16 TUs to shoot. Now reaction will happen when:
[The snapshot in this situation is {36, 24, 0}]
1. The reacting unit is alive and has kept A1 in view since he saw him.
2. Unit A1 spends 36+16=52 TUs or A2 spends 24+16=40 TUs or A3 spends 0+16=16 TUs.

Once these conditions are met, the reaction is performed immediately.

Thus, not only A1, but also any his teammate will cause reaction by spending  more than 16 TUs since the snapshot moment.

Also it may happen that B1 loses sight of the target before he can shoot. In this case the reaction doesn't occur.

Irregardless of whether the reaction took place or not, the unit stays able to react over the whole enemy's turn. But, of course, that doesn't imply he will fire at any incoming enemy. First, his reaction time may be too high (and the enemy will shoot him first). Second, he may be attacked by several units simultaneously (and, of course, he won't have time to make a shot at each of them). note, that in UFO the were no way to use simultaneity this way.

In my system it makes difference: whether a unit was attacked by several enemies at once or sequentially, which is also a serious improvement to realism compared to the XCOM-like RF-system.

How it looks in active turn:

Suppose you've encountered an enemy unit that is executing an interturn action - running to behind a tree. You give a snaphot order to your unit. In X-COM you unit would take a shot immediately on reception of the oreder. In my system nothing happens except the order is attached to the unit. That is, your unit has just starting to aim at the running enemy.

Now you can switch to other units. As the time spent by your team increases, the unit will take aim and shoot, unless the target kills him or escapes his viewfield before he has time to perform the shoot order.

... to be continued.
Title: Re: A better reaction fire system
Post by: Bandobras on June 25, 2006, 10:04:36 pm
Quote from: "Anton"
Questions are welcome, though I am not sure someone ever reads this huge post...


I did. :) Nice reading.

First comment --- I think turn-based is great, because the fact that I cannot react (apart of reaction fire) in my opponent's turn nicely models the effect of initiative and of surprise. In reality I do just that --- I leapfrog, I perform order after order to move somewhere and then shoot, etc. I move and decide in phases and I cannot change the plan immediately if I see somewhat unexpected. The opponents turn, during which I'm unable to move, models the time it takes for me to prepare for the next leapfrog, to change my plans (perhaps consulting my superiors, too). The unreliable reaction fire models my unreliable instinctive reactions, before I made a proper plan-change (in my next turn).

Quote
First, my system has one global distinction from the XCOM-like RF-system: it doesn't feature saving time units for reaction.


Saving turns is realistic. If I choose a proper spot, stand still, aim my gun, scan sourroundings, I'm more likely to react, but it all takes time...

Quote
In XCOM A will be given a chance to react, depending on A's reaction. The chance may also depend on the type of shot, B's reaction... - I don't know exactly.


IIRC in XCOM it also depended on the movement points left (after the shot, IIRC) both for A and B.

Quote
But wait, the above two situations are different only within the XCOM turn-based system. In reality they'd be identical: A hides in the shed, B and C pursuit him, entering the shed one after another.


I'm not sure. If A is caught in the middle of the shed, with his back to one of the windows, with his gun down and not even a clear idea if there are other exits and where to aim if a noise is heard from behind, he will be killed by C. On the other had if he is well-prepared for the reaction shot he will kill C.

Quote
In my system time units will not be saved for reaction. A unit will be able to react throughout all the opponent's turn irregardless of how many TU's he's spent in his preceding turn.


Regardless of what I said, this sounds interesting, though I'm not sure if this does not encourage camping (normal reaction fire mechanism somewhat encourages it, too, BTW, so I'm not that fond of it). Once you reach a nice camping spot you can defend it with all power. In XCOM your opponent could at least attack you for free during the first turn. This encouraged slower tactical progress instead of a race to the best camping spot. However, all tactical implications of your proposal may be more complex and perhaps even generally good --- I don't know.

Quote
And this is based on mere evidence: in real battle nobody stays quietly under fire because he's run out of his time units.


If somebody is not prepared he will take more time for his shots, possibly even stumble or duck and indeed stay quietly until he analyzes his situation (until his next turn).

Quote
Thus, if you run as fast as you can, you may be sure that if an enemy spots you in his turn, you won't be able to walk a couple steps or make a shot, how realistic! As you see, in XCOM the outcome highly depends on the way time is divided into turns and on the location of the moment on the time axis relative to the boundaries of the current turn.


Yes, this is the model, and I think it works OK. Just imagine that every turn you perform an order, a plan of action. Then, during the opponent's turn you syncronize through radio with your buddies, receive/plan next orders, etc. With this view, if you have wrong plans/orders that leave you exposed and exhausted in the middle of the field, while you are briefed for the next step, this is entirely your (or your superior's) fault and a very realistic fault, too. Professionals do not run continuosly ahead, shouting and firing. They leapfrog, stand still, and leapfrom again...

Quote
This will make interturn transitions smoother and more realistic, because in reality there are no turns and no interturn boundaries.


Just think about half of your movement points as belonging to the opponent's turn. Then the current system is very close to waht you describe. :) Once you have the habit of reserving points for the reaction shots, it really plays more smoothly and most of you reported problems are solved (e.g. you suddenly end up close to an opponent --- just sacrifise some of the reaction fire points to flee or to kill him outright).

Quote
First, his reaction time may be too high (and the enemy will shoot him first).


A nice idea. It is, to an extent, modeled by the impact of remaining TU's of both units for reaction shots in XCOM.

Quote
As the time spent by your team increases, the unit will take aim and shoot, unless the target kills him or escapes his viewfield before he has time to perform the shoot order.


This does not sound very realistic. This is a duel and your soldier is handicapped by the rest of his team. Do I get it right?
Title: A better reaction fire system
Post by: Anton on June 28, 2006, 10:58:09 pm
Sorry for misprints and English, I passed an exam today and have another one the day after tomorrow — not enough time.

Quote
First comment --- I think turn-based is great, because the fact that I cannot react (apart of reaction fire) in my opponent's turn nicely models the effect of initiative and of surprise.


I think turn-based is greate because it allows for hot-seat multiplayer...

Quote
In reality I do just that --- I leapfrog, I perform order after order to move somewhere and then shoot, etc. I move and decide in phases and I cannot change the plan immediately if I see somewhat unexpected. The opponents turn, during which I'm unable to move, models the time it takes for me to prepare for the next leapfrog, to change my plans (perhaps consulting my superiors, too). The unreliable reaction fire models my unreliable instinctive reactions, before I made a proper plan-change (in my next turn).


Huh. Ok, in reality that leapfrog tactics is used in areas with dense relief, where you have a lot of covers like cars, buildings, and so on, and inside buildings, of course.

But I see some problems:

First, while in reality this leapfrog technique emerges naturally, in your interpretation of the XCOM system it is fixed. The players are forced to use this technique.

Second, in the XCOM system these rushes are made by the two teams in turns: first, one team makes a rush, then the second and so on. That is, while one team is making a rush, the units of the second stand still, and vice versa. But in reality leapfrogs are not made in this way: every unit makes rushes more or less asynchroniously with his teammates, at least with the ones located quite far from him. And of course, the leapfrogs of the two teams are in no way turn-by-turn: the enemy will rarely wait for you to make your umpteenth leapfrog before making his.

Quote
Saving turns is realistic. If I choose a proper spot, stand still, aim my gun, scan sourroundings, I'm more likely to react, but it all takes time...


If you are sneaking along a wall and know that round the corner has lain doggo an enemy, you are very well prepared to react, maybe faster than the enemy, not aware of your approaching. And it in no way depends of the TUs you will have when turning round the corner.

Quote
IIRC in XCOM it also depended on the movement points left (after the shot, IIRC) both for A and B.


Yeah, that's pretty strange. If you meet an enemy in the end of your turn, in the middle of it, or in the beginning — why should you have different chances of shooting first? The situation is the same except the moment it occured. Or do you think if you leave 40 TU's for reaction, you will spend them all to "prepare to the shot", though you don't see an enemy and even don't know if one appears. Reaction starts at the moment you spot the enemy!

Quote
I'm not sure. If A is caught in the middle of the shed, with his back to one of the windows, with his gun down and not even a clear idea if there are other exits and where to aim if a noise is heard from behind, he will be killed by C. On the other had if he is well-prepared for the reaction shot he will kill C.


But the difference in the two situations was only one: in the TUs reserved by A, the other conditions the same (position of A at the end of his turn, and positions of B and C at the beginning of theirs). So, what you wrote is true but has nothing to do with my example.

Quote
Regardless of what I said, this sounds interesting, though I'm not sure if this does not encourage camping (normal reaction fire mechanism somewhat encourages it, too, BTW, so I'm not that fond of it). Once you reach a nice camping spot you can defend it with all power. In XCOM your opponent could at least attack you for free during the first turn. This encouraged slower tactical progress instead of a race to the best camping spot. However, all tactical implications of your proposal may be more complex and perhaps even generally good --- I don't know.


No one-sided attacks in my system: it's not chess. Since in XCOM reaction fire is much ehhh... weaker (happens much more rarely, I'd say reaction/action shots count about 1/3 or less), it does make passive tactics less effective.

In reality it is passive tactics that gives the defender certain advantages. That's well-known that on average the defender suffer less losses than the attacker. So, my system is more realistic from this viewpoint.

You may say it'll spoil the gameplay. I think that's not true. In every real combat there is a defender and an attacker. If you shoot a small UFO down and send a Ranger to the site, the aliens will probably prefer defence rather than attack, unless they plan to break through your forces and run away and hide...

Quote
If somebody is not prepared he will take more time for his shots, possibly even stumble or duck and indeed stay quietly until he analyzes his situation (until his next turn).


A unit's ability to react/act depends only on his abilities and the real situation, but in no way on whose turn it is. Turns are just logical and artifial division of time: like splitting text into several books doesn't change the text.

Quote
Yes, this is the model, and I think it works OK. Just imagine that every turn you perform an order, a plan of action. Then, during the opponent's turn you syncronize through radio with your buddies, receive/plan next orders, etc. With this view, if you have wrong plans/orders that leave you exposed and exhausted in the middle of the field, while you are briefed for the next step, this is entirely your (or your superior's) fault and a very realistic fault, too. Professionals do not run continuosly ahead, shouting and firing. They leapfrog, stand still, and leapfrom again...


Maybe it works OK, but I am sure a more realistic combat simulation will be much more interesting (or at least another good game system) than this half-chess system.

Email XCOM has a really poor reaction fire system as concerns realism, but it is this system that makes an interesting game allowing for PBEM, one game taking 15-25 turns. But I think it's really strange that so far no turn-based multiplayer (not Aftermath!) games without chess-ness have been created. Synchronious move hadling (like in freeware General 4.5e) is not useble in the XCOM genre.

Quote
Just think about half of your movement points as belonging to the opponent's turn. Then the current system is very close to waht you describe.


No, reread the examples. The X-COM system is extremely unrelistic.

Quote
A nice idea. It is, to an extent, modeled by the impact of remaining TU's of both units for reaction shots in XCOM.


Remaining TUs, depending on the division of time, can in no way be used for this purpose. If you don't move in you turn, why will you have better reaction chances than in the case you walk five steps forward and backward? This doesn't change the actual situation, but affects your TUs... Anyway, reaction starts after spotting an enemy, not at the beginning of your turn. So, the spent TUs can not be cosidered as stolen time to prepare.

Quote
This does not sound very realistic. This is a duel and your soldier is handicapped by the rest of his team. Do I get it right?


Yeah, since the enemy's actions are sychronized with the time as well, they (the duelants) are acting (aiming and shooting) really simultaneously — quite realistic.
Title: A better reaction fire system
Post by: Bandobras on June 28, 2006, 11:44:45 pm
Oh, well, at least you know I've read your post, even if I have not understood. :)

About turn-based again, of course the crucial thing for me is that I don't have to be in a hurry (even RTS with time-pausing induce a sense of a hurry and prevent slow perfectionist play-style). The rest of my view-point is that turn-based can be seen as realistic, with certain, more or less rigid, assumptions about squad tactics and combat psychology. Perhaps in some combat scenarios such assumptions are realistic themselves, perhaps not...

Good luck with your next exam! :)
Title: Re: A better reaction fire system
Post by: Anton on July 02, 2016, 10:32:34 pm
Been a long time gone, and now my proposal seems partially implemented (https://www.ufopaedia.org/index.php/Reaction_Fire_(UFOAI)), is it not?
Title: Re: A better reaction fire system
Post by: DarkRain on July 03, 2016, 06:20:29 am
Well, current rules for triggering reaction fire seems similar to the rules you proposed, but of course we don't have simultaneity of any kind.
Title: Re: A better reaction fire system
Post by: Anton on July 03, 2016, 01:35:29 pm
Glad to hear that. My rules were overcomplicated and insufficiently detailed with respect to difficult cases, but their main point was exactly what you did: reaction fire occurs when the target has spent as much time in the firer's field of view as is required to aim and shoot. I returned here because I have come up with a simpler system.

I have downloaded UFO:AI and will try it if it works on my old Windows XP machine without a video card.
Title: Re: A better reaction fire system
Post by: Rodmar on August 01, 2016, 10:13:36 am
Hello,
Here are some thoughts about Reaction Fire (RF)

1 Are all actions accounted for ?
reaction fire occurs when the target has spent as much time in the firer's field of view as is required to aim and shoot.
I'm not sure if inventory management is counted as spent time. I mean that moving and firing do count, but opening the inventory window and spending several TUs to exchange weapons, etc., doesn't seem to count. Also, I'm not sure about reloading.
Imo, any TU spent in the opponent field of view should count. That would mean that a reaction fire could happen right upon closing the inventory window (that is, once TUs are spend for good).

2 (Semi-)Simultaneousness in turn based games
Quote from: Anton
But I think it's really strange that so far no turn-based multiplayer (not Aftermath!) games without chess-ness have been created. Synchronous move handling (like in freeware General 4.5e) is not usable in the XCOM genre.
Actually, such turn-based game as Age of Wonders may have simultaneous turns because the movement phase is dissociated from the combat phase (it's a game option). This allows for last minute reinforcement or a surprise attack while the enemy has ordered his move already (thus depleting a town from some defenders for instance), and it prevents such tactics as scouting ahead, spotting the enemy and then withdrawing to a safe location (there is no reaction fire during movement phases). Also, being able to move in the middle of your opponent's move (even a human player) may wreak havoc in his plan because one part of its armies has already moved according to the plan, and now, the situation has changed. Now, I can't see how simultaneity could be improved inside a turn-based X-COM game.
2.1 One solution would be perhaps to pause the game each time an enemy enters a unit's field of view, the same way it's paused each time a unit spots on a new alien during its own movement "phase". The "defender" (spotting) unit would then be allowed to spend whatever spared TU it has left. This pause would warn a player that its unit was just spotted by an enemy, however.

3 Simultaneity inside a same turn is not assumed by the engine, well not always. Arbitrarily dividing the time frame into turns does not imply that those turns are small records of simultaneous actions. Its only a convenient matter to differentiate between actions and reactions. Reactions and actions are sequential if the time records are small enough (and we don't consider a dynamic process).
All of your real actions aren't simultaneous inside your own turn. Of course this can't be the case for any given soldier (and the game manages to emulate this), and this is not always the case as regards to different soldiers' actions (this being a slight concern). Not only do you leapfrog from turns to turns (between the enemy's turns), but also inside a same turn (yours). I mean that soldier A would spend some to TUs to assess a location is clear, and then soldier B would move a little before soldier A acts again, etc. In another words, if your team's action would be clearly partly sequential inside your own turn, such as during a coordinated move, the game always treat them as being sequential, queued orders and actions.
The exception is precisely reaction fire. RF may be triggered at any time provided enough TUs were left and not yet used in RF.
The point is that we may find (I do) that it's not really realistic that several soldiers may act in sequence in the same general direction inside the enemy's field of view and no reaction fire is triggered because each one of your team managed to use less TUs than needed, even if the actions were partly sequential, and could have be seen globally as reaching the threshold TUs to trigger a reaction fire. This would be OK if all of these moves/actions are really synchronous (like having three guys popping out of cover at the same time), but what if some of these actions depends on some previous actions ? E.g. Soldier A: "Let's pop out altogether at 3. 1... 2... 3... Wait! Hostile ahead" (returning back to cover) - Soldier B: "I have time enough to show off, kneel and aim at him" (killing the hostile) - Soldier C: "Now he's killed, I go this direction instead".
Indeed, the (risked) trick, as for now, is to draw enemy reaction fire with a heavy armored soldier, provided the direction of the reaction fire is known, and then to move the less armored soldiers, once reaction fire was triggered. This "tactrick" works very well as regard to heavy weapons such as heavy needler.
Solutions (?):
3.1 Reaction fire could be handled separately and reseted for each couple of attacker/defender; that is, reserved RF TUs would be reseted, and eventually used to fire, each time a new enemy unit starts using TUs inside this unit's field of view (the reset is effective only as the new enemy unit is concerned). However, this could result in a unit having more firing opportunities that it could have during its own turn! (especially with low TU, light weapons).
3.2 Scheduling the moves and actions before actually playing them would be far much of management for the player, notwithstanding the concern of crossing soldier path, and late actions made obsolete by early actions (such as aiming at the same enemy with several soldiers could result in wasted shots (btw, isn't this like irl if the turns were shorter?)). Still the idea is to prepare all of your turn without actually doing anything, and then to hit a key and see how the turn unfolds and resolves.
The benefice of spotting an enemy during your turn would only be used on the next turn, except if some active reaction fire is implemented (a RF opportunity during your scheduled move). Also, I believe it would lessen the immersion feeling because you can't see and analyze in real time all that happens during your turn.
3.3 Any already TUs spent that are eligible for triggering reaction fire would count when a new unit acts inside an enemy field of view. Once the new unit starts acting (moving, firing, etc.), it wouldn't start at 0 TU but at a fraction of all the already TUs that have been spent before the enemy's eyes (e.g. 10% to 25% ?). This would somewhat address the concern of several units showing and acting in turn, as the last ones would be more prone to reaction fire than the first ones, because surprise effect would have been partly canceled. E.g. unit A enters field of view and acts without triggering RF because it only used 10 TUs; when unit B begins to act, it is considered as having already used say 1-3 TUs, and thus a 10 TUs real action would count as a 11-13 TUs virtual action. Of course, this "time compression" would occur only for the others' spent TUs, not yours. If a unit moves in two stages, his actual TUs (as regards to RF) would be computed as follows: actualTUs = 0.2*otherSpentTUs + 1.*firstStageTUs + 1.*currentSecondStageTUs.
This way, the order in which you move your soldiers would matter but not in the same way as it currently matters. Currently, main purposes of an ordered, queued move is to spot an enemy on (with a fast, forward unit) and/or to trigger a reaction fire (with an armored, forward one). Now, surprise would play a different role depending on whether you are the first unit to draw attention, or the last one in the queue. That means also that frolicking through the trees, where exposure to RF is reseted each time a tree screens the runner, would be a less viable option.
Title: Re: A better reaction fire system
Post by: Anton on August 03, 2016, 05:57:27 pm
Your are good questions, Rodmar, and I have pondered them (intermittently) since 2006.  I am currently busy (http://www.vogons.org/viewtopic.php?f=32&t=49160) and will answer them as soon as time permits. Thank you for your interest.
Title: Re: A better reaction fire system
Post by: Rodmar on August 04, 2016, 07:00:39 pm
Btw, please then have a look at this post (http://ufoai.org/forum/index.php/topic,6929.msg64851.html#msg64851).
It tells about how a fixed TU amount could be necessary before entering the current RF sequence (to emulate the reflex capability of the soldier?), and how the fire mode could be chosen by the AI depending on the distance and direction of the spotted enemy.
Title: Re: A better reaction fire system
Post by: Anton on August 31, 2016, 05:19:09 pm
I shall begin with Rodmar's post because it is the easiest to comment:
Btw, please then have a look at this post (http://ufoai.org/forum/index.php/topic,6929.msg64851.html#msg64851).
It tells about how a fixed TU amount could be necessary before entering the current RF sequence (to emulate the reflex capability of the soldier?),
That's right. Reaction delay is a personal characteristic, depends on one's current physical and mental states, and is part of the time required to make a shot once an enemy has appeared in a unit's field of view. I can't say has been spotted because that takes reaction time!

I disagree, however, with your proposition to use reaction time for reaction fire only, for—as I have written in the (overloaded) initial post ten years ago—the difference between an acting and reacting units is only virtual, i.e. is a feature of the game's turn-based model and does not exist in the real situation being modeled, where, if two opposing units appear in each other's fields of view simultaneously (which I assume for simplicity), each of them continues as if nothing happened until his reaction time has elapsed, and then starts to react, i.e.: to take cover, aim the weapon, &c. This is a symmetrical situation where one cannot tell who acts and who reacts, let alone whose turn it is. I think that the game should approximate this symmetry as well as possible without compromising playability and the major advantages of turn-based gameplay. If this reaction time you speak about is to be taken into account, it should be done for both the acting and the reacting units, possible with different modifiers, for reaction to an enemy's entering the door one is holding at aim is quite different from that to discovering an enemy in the room after one has rushed through a door thus guarded. This asymmetry should not be modeled by the concept of action and reaction, but by parametric differences in a more symmetrical model.

What is more important is that using or not using reaction time in the game is not detrimental to the very mechanism of simulating simultaneity in a turn-based system. Once such a mechanism is devised, adding features such as reaction time, reaction to the sound of steps and shots, focuses of attention (e.g. holding at aim a specific door, window, or passage), reaction scripts (e.g. duck back instead of shooting upon discovering a heavily armored target) will be wholly different matter, which is why I would rather not discuss them here.
and how the fire mode could be chosen by the AI depending on the distance and direction of the spotted enemy.
Good idea as well.
This also depends on the parameter being optimised: time until the first hit, average damage rate, the desired mean and standard deviation of these parameters, &c. But again, the turn-based mechanism is largely inidifferent to these details.

To Seerorin's original post:
Reaction fire should work entirely differently from normal shooting in my opinion. You should need a basic amount of TU's to reserve for it but it's a fix amount. Wich is not for the exact shooting but for the getting ready to shoot.
He does not seem to say how exactly this additional value should be accounted for in the game. If it will delay reaction shorts then with respect to those from the active team, then I should say it is a bad idea because it only aggravates the asymmetry which is not there in the real combat situation.
If an alien walks in range and is far your soldiers should instantly fire [...] at him, and repeat it every time the alien uses the amount of TUs needed for the snapshot from that gun.
This is part of my proposal also and, as I understand, is already implemented.
Bear in mind that subsequent shots at the same target generally take less time than the first, but this is lateral detail again.
Even in real life you could never walk up to an assault rifle wielding person and kill him with a blade. Especially not if he/she is standing ready to take anything down.
This is exactly what will happen in the current version if the firer has not saved enough TUs for reaction. This outcome cannot be reasonably interpreted in terms of a real situation. Was the poor blighter standing and waiting for the Reaper to tear him apart?

Again, the optimal firing mode depends on several variables and can be determined using probability and statistics.
Title: Re: A better reaction fire system
Post by: Anton on August 31, 2016, 09:57:24 pm
1 Are all actions accounted for ?I'm not sure if inventory management is counted as spent time. I mean that moving and firing do count, but opening the inventory window and spending several TUs to exchange weapons, etc., doesn't seem to count. Also, I'm not sure about reloading.
A crucial part of game mechanics, reaction fire should be scrupulously documented. I know it is easier said than done, but that is why the Wiki is there—so that experienced players could write the brunt of the description to be revised and corrected to perfection by the actual designers and programmers, who rarely have time for the docs.
Imo, any TU spent in the opponent field of view should count. That would mean that a reaction fire could happen right upon closing the inventory window (that is, once TUs are spend for good).
Correct. Ideally, the inventory window should disappear automatically as soon as you have spent enough TUs fumbling with your posessions for an enemy to fire a reaction shot. Time should be accounted uniformly for all actions.
Actually, such turn-based game as Age of Wonders may have simultaneous turns because the movement phase is dissociated from the combat phase (it's a game option). This allows for last minute reinforcement or a surprise attack while the enemy has ordered his move already (thus depleting a town from some defenders for instance), and it prevents such tactics as scouting ahead, spotting the enemy and then withdrawing to a safe location (there is no reaction fire during movement phases). Also, being able to move in the middle of your opponent's move (even a human player) may wreak havoc in his plan because one part of its armies has already moved according to the plan, and now, the situation has changed.
In essense, it is the increased granularity due to the subdivition of turns into move and combat phases that reduces chess-ness in AoW, but, as Wikipedia confirms, this is not possible in pure turn-based modes, i.e. in PBEM and hot-seat, and I am not intereseted in semi-simultaneous modes with frequent interrupts and player-switches. I believe it is for the same reason that hot-seat is inherently impossible in Jagged Alliance, where reaction fire is handled by switching manual control to the reacting unit.
One solution would be perhaps to pause the game each time an enemy enters a unit's field of view, the same way it's paused each time a unit spots on a new alien during its own movement "phase". The "defender" (spotting) unit would then be allowed to spend whatever spared TU it has left. This pause would warn a player that its unit was just spotted by an enemy, however.
The major drawback that I see is that it will destroy the comfort of pure turn-based gameplay by introducing too many player-switches instead of one per turn. Futhermore, we can't let the defender spend all its TUs at once because it will rule out fire exchanges. And what to do if more than two units are involved in a firefight?
3 Simultaneity inside a same turn is not assumed by the engine, well not always. Arbitrarily dividing the time frame into turns does not imply that those turns are small records of simultaneous actions. Its only a convenient matter to differentiate between actions and reactions.[...]
Agreed. In reality units A and B may pop up from around a corner together or one after the other, whereas in X-COM-like games you will always more one and then the other, or you may change your mind and leave the second unit covered because of what the first one have seen. I have proposals on how to handle this but now I will comment on yours:
3.1 Reaction fire could be handled separately and reseted for each couple of attacker/defender; that is, reserved RF TUs would be reseted, and eventually used to fire, each time a new enemy unit starts using TUs inside this unit's field of view (the reset is effective only as the new enemy unit is concerned). However, this could result in a unit having more firing opportunities that it could have during its own turn! (especially with low TU, light weapons).
Not only in that, but also in the virtual neutralization of such important tactical feature as numerical superiority, because a single reacting unit will be able to respond to the fire from any number of enemy units as if they attacked one by one instead of all together!

The problem of the reacting unit's having too much time is not so serious, because if two units of the active team have spent 60 TUs one after the other, the whole team will have spent 120 TUs. It is more important to handle actions, and especially fire exchanges, as sequential or simultaneous according to the situation, which is the purpose of my proposal.
3.2 Scheduling the moves and actions before actually playing them would be far much of management for the player, notwithstanding the concern of crossing soldier path, and late actions made obsolete by early actions (such as aiming at the same enemy with several soldiers could result in wasted shots (btw, isn't this like irl if the turns were shorter?)). Still the idea is to prepare all of your turn without actually doing anything, and then to hit a key and see how the turn unfolds and resolves.[...]
I agree with your attitude toward this system. It results (UFO Aftermath, Combat mission, Total war) in a very intensive and nervous gameplay full of interceptions or pauses and of scrolling around the entire map, which is totally alien to the spirit of X-COM with its comfortable, hustle-free pace. You can't play those games with a cup of tea.
3.3 Any already TUs spent that are eligible for triggering reaction fire would count when a new unit acts inside an enemy field of view. Once the new unit starts acting (moving, firing, etc.), it wouldn't start at 0 TU but at a fraction of all the already TUs that have been spent before the enemy's eyes (e.g. 10% to 25% ?).[...]
I strongly object to this approach because with it reaction fire depends on the average parameter instead of on the specific tactical situation at hand. The introduction of the arbitrary percentage is bad practice as well.

Thanks for the comments. I will post my revised proposal as soon as time permits. I hope to make it shorter, clearer, and more to the point than the original.
Title: Re: A better reaction fire system
Post by: Rodmar on September 01, 2016, 01:15:27 pm
I strongly object to this approach because with it reaction fire depends on the average parameter instead of on the specific tactical situation at hand. The introduction of the arbitrary percentage is bad practice as well.
And yet, this should simulate the fact that:
- a warned and ready shooter is able to foresee the next location of a constant speed running enemy, even if running between trees, whereas current UFO:AI resets RF each time LOS is lost, even if during only one single map square worth of movement.
- once said shooter is alarmed in a general direction (with LOS), such as next to a corner, by a door, etc, he could have his weapon ready and pull the trigger more rapidly than if he had to be alerted again by peripheral vision, turn his head and upper torso, etc. In current UFO:AI, you can have a full squad pass in front of a wide door (3 squares for 6 TUs worth of movement), without triggering a 8 TUs RF. You might say that a slow shooter wouldn't be able to shoot at quick passing-by targets, anyways, even if warned by some signal (cf. clay-pigeon shooting). But if 8 TUs account for all the RF process, shouldn't it take a little less after one or two soldiers have already passed by the door, and the RF process has already been initiated? Perhaps a fixed number instead of a fixed percentage?

Note however that I write without any irl fighting experience.
I hope that your proposals may address those cases as well, somewhat, somehow.
Title: Re: A better reaction fire system
Post by: Anton on September 03, 2016, 12:49:16 pm
And yet, this should simulate the fact that:
- a warned and ready shooter is able to foresee the next location of a constant speed running enemy, even if running between trees, whereas current UFO:AI resets RF each time LOS is lost, even if during only one single map square worth of movement.
- once said shooter is alarmed in a general direction (with LOS), such as next to a corner, by a door, etc, he could have his weapon ready and pull the trigger more rapidly than if he had to be alerted again by peripheral vision, turn his head and upper torso, etc. In current UFO:AI, you can have a full squad pass in front of a wide door (3 squares for 6 TUs worth of movement), without triggering a 8 TUs RF. You might say that a slow shooter wouldn't be able to shoot at quick passing-by targets, anyways, even if warned by some signal (cf. clay-pigeon shooting). But if 8 TUs account for all the RF process, shouldn't it take a little less after one or two soldiers have already passed by the door, and the RF process has already been initiated?
You have shown important drawbacks in the existing system, and now that I have pondered it, your idea is quite good as well, and it is only the specific implementation that you propose that I find fault with.

The arbitrary percentage should be replaced with 100%, because the defender has all this time to a) notice motion at a specific location, b) look thither more intently and spot the enemy c) take aim, and d) shoot.

Now, you might object that the cumulatime time may very quickly exceed that needed for a shot so that every next enemy will be shot at immediately without a slightest chance to do anything, which paradox is resolved by a more detailed aiming model:

1. Drawing the weapon (if not already)
2. Pointing the weapon in the general direction of the target
3. Finer alignment of the weapon with the target or its predicted position by means of the sights. This stage may be executed with more or less care depending on the desired accuracy, or omitted altogether when at close enough range. The exect dependecly of accuracy of time is a matter of debate but must be a functon whose rate of growth is higt at the begining and slows down as it approaches the saturation plateau of the maximum accuracy. It is specific for each shooter-weapon combination. A friend of mine has implemented such a model in an actional game, so I might publish it if need be.
4. Holding breath, if high accuracy is required (long range).
5. If the target is moving in an irregular manner (so as to dodge fire), wait for it to "cross" the sights or the predicted (lead-corrected) "lead" positon.
6. Pull the trigger.

For simplicity's sake, we may safely compress this into three stages defininable in the game's terms:

1. Turn in the direction of the target
2. Take aim.
3. Shoot (pull the trigger).

Now, you are talking about a situation when the defender has time to take aim in the direction in which he expects an enemy to appear, but when that happens, he cannot shoot immediately but only with a reaction delay, which you have mentioned above and which makes momentary shots are impossible.

Another question that needs consideration is when exactly to reset the accumulated time. End-of-turn is clearly not enough: what if a distraction comes from another quarter from a different target? or from the same target from a slightly different position, e.g. left of a tree, then right of the same tree? And where is the exact boundary between a slightly and significantly different locations? You must provide specific details. Only complete, scrupulously thought-out, and metitiously described proposals have a ghost of a chance of being implemented by others.

The player may also want to "cover" a specific door or window without having his unit first "see" several enemies walk through the latter or past the former. For this I have suggested "focuses of attention", a means to specify a small area that a defender should guard instead of spreading his attention across the whole field of view, so as to react quicker to an enemy appearing within that area at the expense of a somewhat slower reaction to everything without it.
Note however that I write without any irl fighting experience.
And so do I, save little paintball experice.
I hope that your proposals may address those cases as well, somewhat, somehow.
My proposal is concerned with the general accounting of time in tactical turn-based games for the resolution of fire exchanges between acting and reacting units. It is based on a small set of rules for deciding which actions (most importantly shots) are to be treated as parallel and which as sequential, depending on the tactical situation in the game.

The main purpose of my system is to eliminate the most absurd situations possible with the current mechanics, such as a unit without reserved TUs standing like a dummy until an active unit casually walks to an adjacent tile and kills it at point-blank range without hurry, or several active units with heavy weapons killed by quick reaction fire from a single target, while in fact they attacked all at once and the defender would not have time to take them down as if one by one. To explain—suppose a defender D has reserved all his TUs for snapshots, which take 12 TUs each, and two heavy-weaponed units A1 and A2 fire at it with their 22-TU shots. The correct sequence of shots should be:
Code: [Select]
Shot: D     A1&2   D     D     A1&2  D
Time: 12    22     24    36    44    48
Your idea is largely orthogonal to my system and may be implemented within it as well as, I think, within the current one.
Title: Re: A better reaction fire system
Post by: Anton on September 04, 2016, 08:59:22 pm
The arbitrary percentage should be replaced with 100%, because the defender has all this time to a) notice motion at a specific location, b) look thither more intently and spot the enemy c) take aim, and d) shoot.
A necessary correction. Accumulating the time spent by units of the active team within the LOS of the reacting unit seems wrong because an event of an arbitrarily small duration is enough to alert the latter and cause him to aim in the direction in which he saw motion. The he can be aiming continuously until the same or another enemy unit appears in exactly the same direction.

Imagine that from your concealed position in a bush you notice, from the corner of your eye, someone flit quickly across an open doorway in a building across the street, but he is gone before you even take a second look. Expecting to see further movement in that building, you begin to aim at the empty doorway, and a couple of seconds later you see a Sectoid cross the hall. But this time you are well prepared and pull the trigger.

I believe this is a reasonably realistic scenario, where reaction is triggered by two very short events. It is during the two seconds that separate them that the reaction short was performed.
Title: Re: A better reaction fire system
Post by: Rodmar on September 06, 2016, 06:50:17 pm
3.3 Any already TUs spent that are eligible for triggering reaction fire would count when a new unit acts inside an enemy field of view. Once the new unit starts acting (moving, firing, etc.), it wouldn't start at 0 TU but at a fraction of all the already TUs that have been spent before the enemy's eyes (e.g. 10% to 25% ?). This would somewhat address the concern of several units showing and acting in turn, as the last ones would be more prone to reaction fire than the first ones, because surprise effect would have been partly canceled. E.g. unit A enters field of view and acts without triggering RF because it only used 10 TUs; when unit B begins to act, it is considered as having already used say 1-3 TUs, and thus a 10 TUs real action would count as a 11-13 TUs virtual action. [...]
Quote from: Anton
The arbitrary percentage should be replaced with 100%, because the defender has all this time to a) notice motion at a specific location, b) look thither more intently and spot the enemy c) take aim, and d) shoot.
A necessary correction. Accumulating the time spent by units of the active team within the LOS of the reacting unit seems wrong because an event of an arbitrarily small duration is enough to alert the latter and cause him to aim in the direction in which he saw motion.
Now that I think again about this, it seems more evident to me that current model should be improved, even if this makes the game departing more from traditional TBS action games. While I'm not sure about, and I'm not committed with the above idea of mine, I want to elaborate better, in case it would be of some interest for this topic.

Currently:
1/ As long as no RF has triggered, the attacker's (moving player's) turn "looks" like simultaneous for a defender (not moving player) with reserved TUs. His RF capital is not spent at all. When RF triggers, some reserved TUs are spent and this is of sequential nature as far as next RF opportunity is considered. But thereafter, we return to a "simultaneous" phase until next RF triggers (during the same enemy move turn). I mean that obviously, as long as no RF occurs, the moving player do what he wants with his soldiers, and this is the model of such turn based action games.
2/ As for the attacker's point of view, time flows sequentially because next move order depends on what just happened during previous moves: spotted enemy, RF experienced, canceled move, ...).
3/ Hence, the idea is/was to introduce a kind of sequence from the defender's point of view, on top of the current RF spent TUs account.

Accounting for all the previous actions performed in LOS with a 100% weight may be too much, as you say, and 10%-25% is certainly not enough.

A 100 % weight probably would:
- leave few chances to the next to move soldier (as he would trigger certain RF);
- offer the same cheat option as currently, when a player may draw RF to a purposely heavily armored soldier (he would learn to know that with a new RF model without reseted TU each time LOS is lost, the second moving soldier would trigger RF, as accumulated TUs in LOS would grow steadily).

If we take a "4 TUs wide"-window as an example, and a "8 TUs RF mode"-weapon ready:
In this example, it looks like a 25% weight is too small. Or not? Granted, a "4 TUs wide"-window is a small opportunity to pull the trigger of an assault rifle. Perhaps it's correct (or acceptable) that four soldiers may pass by unharmed. If you take a "6 TUs wide"-passage on the other hand, 3rd soldier would trigger RF from an assault rifle (2x6x0.25 + 6 = 9).

As we see, it needs some tweaking and balancing between realism and  playability.
Title: Re: A better reaction fire system
Post by: Anton on September 18, 2016, 01:26:18 am
Quote
1/ As long as no RF has triggered, the attacker's (moving player's) turn "looks" like simultaneous for a defender (not moving player) with reserved TUs. His RF capital is not spent at all. When RF triggers, some reserved TUs are spent and this is of sequential nature as far as next RF opportunity is considered. But thereafter, we return to a "simultaneous" phase until next RF triggers (during the same enemy move turn). I mean that obviously, as long as no RF occurs, the moving player do what he wants with his soldiers, and this is the model of such turn based action games.
2/ As for the attacker's point of view, time flows sequentially because next move order depends on what just happened during previous moves: spotted enemy, RF experienced, canceled move, ...).
3/Hence, the idea is/was to introduce a kind of sequence from the defender's point of view, on top of the current RF spent TUs account.
Well-observed.  This may serve as a basis for a mathematical model of time-accounting in turn-based games.
Quote
Accounting for all the previous actions performed in LOS with a 100% weight may be too much, as you say, and 10%-25% is certainly not enough.
I have read and understood your exposition of this system for 25% and 100%, but
note that in my previous post I had changed my mind about it and proposed an improvement of your idea which needs no such constant and emulates some situations with better realism, e.g.:

Have you decided on the specific detail that I asked of you two posts ago:
Quote
Another question that needs consideration is when exactly to reset the accumulated time. End-of-turn is clearly not enough: what if a distraction comes from another quarter from a different target? or from the same target from a slightly different position, e.g. left of a tree, then right of the same tree? And where is the exact boundary between a slightly and significantly different locations?
The devil dwells in details.

P.S. I feel this thread has drifted from my proposal to the discussion of yours. Would it be possible for you to create a specific thread for it and ask an administrator to move thither all the replies form this thread starting from, I think, reply #7? We shall continue our dialog in that new thread, while in this one I will post my revised system.
Title: Re: A better reaction fire system
Post by: TBeholder on January 19, 2017, 09:37:40 am
And the main drawback is called turn-based-ness. When one player is active the other is waiting for his turn. [...] To partially compensate for this effect was developed the so called reaction fire. [...] Also, reaction fire often used action points reserved from the active turn, so if someone was moving at his maximum speed, he couldn't react at all, which's ridiculous too.
It's a less-crude model of simultaneous actions. I.e. an actor who has no TU left at the end of turn already moved by, and will have time to "react" on that team's next turn. Someone with TU left waits in ambush, etc.

  • when several the soldiers of the active player player line up before this "window" that the defender has covered (is aiming at) and all at once rush past it, no time should be accumulated, while in your system it is.
  • [...]
    The devil dwells in details.
Generally if you need to track enemies separately, i.e. for the reacting side to "know" the individual enemies, something in the approach is already wrong.
But let's consider two situations that need to be fixed:
How  to resolve these situations without tracking too many parameters?
Easy: do not just use a whole load of TU counters, aim - as an extension of half turn toward the target.
The result is that spent TU indeed add up:
A defending soldier sees an enemy moving, starts aiming there; when the enemy walks behind a single crate, stops aiming (or continues to "last seen", this could be variable too). The enemy walks from behind the crate in either direction - the defending soldier starts from where he stopped, not from the very start.
Obviously, not foolproof, but better.
But then you could cover specific areas and have variable reaction times:
A defending soldier already aims at the specific window where an enemy is expected to appear: reaction time is minimal, one step to walk in, another step- BANG, won't walk away. The same soldier covers the whole field of vision: reaction time is large, crossing a window or even a double doorway without being shot is quite possible.
This means breaking the shot TUs to components: weapon manoeuvrability rate * angle + minimum shot time + recovery / reload (i.e. a pump shotgun can be shot once fast, but the second shot isn't so fast).
A first approximation for this usually could be derived by conversion fromSnap shot time and  differences with Burst and Aim, if a weapon has all 3, and indeed may replace them as basic weapon properties (so that TU values as seen in the game are derived from them).
Title: Re: A better reaction fire system
Post by: Anton on February 04, 2017, 04:02:54 pm
It's a less-crude model of simultaneous actions.
I.e. an actor who has no TU left at the end of turn already moved by, and will have time to "react" on that team's next turn. Someone with TU left waits in ambush, etc.
You were too brief, I didn't understand you :-)
  • when several the soldiers of the active player player line up before this "window" that the defender has covered (is aiming at) and all at once rush past it, no time should be accumulated, while in your system it is.
Generally if you need to track enemies separately, i.e. for the reacting side to "know" the individual enemies, something in the approach is already wrong.
But let's consider two situations that need to be fixed:
  • An enemy moves behind a thin column, then continues to move. The moment enemy was out of sight, the counter was reset, so moving past anything thicker than a lamp post makes the defender "forget" about the almost-shot-at enemy. Derp.
  • An enemy walks past a window, then another, then they go back, but the defender fails to do anything, because each individual enemy appears only for a moment. Derp.
The latter situation (of the window) is easier to handle because the location of the enemy, and the aiming direction for the reacting unit, is constant. It is already solved in my approach, wherein after a certain aiming time the reacting unit need only pull the trigger to make a shot. The exact time is then determined by the speed of the firer's reflexes, which in reality is about 225 ms (http://www.humanbenchmark.com/tests/reactiontime/) on the average. If running past a window takes longer, one risks begin shot.

To summarize—in my system the first one or two units may go past the window unharmed, but the rest will be in danger. For more interesting gameplay, the game's parameters should be adjusted so that only fast gunslingers shall be able to shoot at an enemy running past a window. Slower ones shall only notice the enemy units, whereof the player should be notified when the previous half-turn is replayed for him.

About the first situation I have written as well:
what if a distraction comes from another quarter from a different target? or from the same target from a slightly different position, e.g. left of a tree, then right of the same tree? And where is the exact boundary between a slightly and significantly different locations?
But I have not yet solved it satisfactorily because of the said difficulties.  Let us look at your solutions:
How to resolve these situations without tracking too many parameters?
Easy: do not just use a whole load of TU counters, aim - as an extension of half turn toward the target.
The result is that spent TU indeed add up:
A defending soldier sees an enemy moving, starts aiming there; when the enemy walks behind a single crate, stops aiming (or continues to "last seen", this could be variable too). The enemy walks from behind the crate in either direction - the defending soldier starts from where he stopped, not from the very start.
Obviously, not foolproof, but better.
Indeed, but the firer must still react to the enemy's sudden appearance at one or the other side of the crate, so the shooting time may never decrease beyond a certain minimal duration, the mere reflex to pull the trigger upon sighting.

What if the enemy pauses behind the crate? The firer knows not either where or when to expect his reappearance, which increases the reaction time, but how to model that? A possible answer might be a special mode for "covering" a certain locaton, of which you wrote below. If one is aiming at the crate, shooting to the left or right of it should be faster than while aiming somewhere else or not aiming at all.

But then you could cover specific areas and have variable reaction times:
A defending soldier already aims at the specific window where an enemy is expected to appear: reaction time is minimal, one step to walk in, another step- BANG, won't walk away. The same soldier covers the whole field of vision: reaction time is large, crossing a window or even a double doorway without being shot is quite possible.
Exactly! This is how my system handles it:
The player may also want to "cover" a specific door or window without having his unit first "see" several enemies walk through the latter or past the former. For this I have suggested "focuses of attention", a means to specify a small area that a defender should guard instead of spreading his attention across the whole field of view, so as quicker to react to an enemy appearing within that area at the expense of a somewhat slower reaction to everything without it
This means breaking the shot TUs to components: weapon manoeuvrability rate * angle + minimum shot time + recovery / reload (i.e. a pump shotgun can be shot once fast, but the second shot isn't so fast).
Again, this is my view exactly, although I forgot about recovery in my model. See my post from the 3rd of September, 2016.

The first term need not be precisely proportional to the angle, but may be so approximated. The second term, your minimum shot time, I call precise aiming and consider it physically different from the first stage. The first is largely determined by the weapon's size and mass and the second by the skill of the shooter.

Note also that since recovery has only a limited effect on the weapon's alignment, subsequent shots may be made somewhat faster than the first one.

A first approximation for this usually could be derived by conversion fromSnap shot time and differences with Burst and Aim, if a weapon has all 3, and indeed may replace them as basic weapon properties (so that TU values as seen in the game are derived from them).
I doubt it, for you can't model the aiming process as having several stages based on a single TU value.

Also bear in mind the the TU's as used in the majority of TBSes including UFOAI are incompatible with any sensible model of reaction fire because one TU does not represent a constant duration but is specific for each unit. We cannot measure time or compare durations using this idiosynchratic unit and must replace it with a standard time unit. The same amount of TUs shall be given to each unit, but fast ones shall run the same distance or shoot the same weapons in less time, i.e. spending fewer TUs. This will require either a much-smaller duration of the standard TU (e.g. 1000 per turn) or fractional TUs.
Title: Re: A better reaction fire system
Post by: nick87720z on July 07, 2017, 12:05:39 am
Hello, i have ideas, which you might treat crazy, as they might need long work, but this might be just my opinion, so would be happy to see it discussed. The format below is somewhat machine/computer-like... hope, that doesn't make it less readable :)
Something might change during discussion... anyway...

More complex reaction, depending on mind:
    - Various differentiating levels, requiring proper mind level.
     Example levels (from lowes to highest):
        - humanoids and sheevar | spider | hovernet
        - taman | ortnok | sheevar
        - armored | unarmored kinds for taman and ortnok
        - light | heavy armor for taman and ortnok (or whoever yet)
        - standard | battle mods of hovernet and spider
        - The highest level 1: interactive reaction fire
         Possible order:
            - Each mode of each usable weapon, unit holds, must be enabled for reaction fire;
            - During enemy's turn - when unit appears in sight of soldier - time as usually is accumulated for reaction
             (accumulated time is displayed in unit's time bar), stopping for reaction requests in these cases:
                - Reacting player just accumulated enough time for next enabled reaction fire mode
                 Example: if player wields pistol and knife, reaction requests will happen on following time positions:
                    4 (knife stub) -> 6 (pistol quick shot) -> 8 (knife throw) -> 10 (pistol aimed shot or burst)
                Following cases - last warning, working if reaction time was not utilized when it could:
                - When reaction target is going to open fire (if it wants to shot plasma pisol burst,
                 its time will be added to reaction fire time reserve)
                - When target is moving towards cover and has remaining 1 tail to pass before it is in cover;
                 (in addition to marking RF iterrupted, it can also game mechanics may check alien's path
                 for such warning position and trigger warning reaction request when enemy is at it)
                Some examples:
                - sniper skipped snap shot, waiting for aimed, but enemy opens fire or about to hide too early - in shis case it can still do quick shot.
                - heavy MG-man, waiting for long burst, but forced to fire 5-round
                 (before taman will overkill him with long plasma burst)
        - Highest level 2: custom reaction
         Almost same, as level 1, but in critical situations (active unit is about to fire) passive unit may be allowed
         to do some limited set of other actions, guided by player or AI, spending accumulated time as it/he/she likes:
            - hide / unhide / grab / drop / reload weapon
             (if enemy has melee weapon, than there is enough time to even reload weapon,
             or e.g. at least take a knife to end it, if it is too impudent to still try to rush passive player)
            - some on-place movement actions - seat, stand, turn
             (e.g. soldier behind firebird wing, trying to shoot enemy on other side of wing,
             must seat, or bullet will be stoped by wing)
             (unsure about runing, as it may break some statics, thus becoming unacceptable)
Title: Re: A better reaction fire system
Post by: EvelynWilson on January 09, 2023, 10:50:19 pm
Hello, i have ideas, which you might treat crazy, as they might need long work, but this might be just my opinion, so would be happy to see it discussed. The format below is what are moobs (https://www.outlookindia.com/outlook-spotlight/how-to-get-rid-of-gyno-aka-moobs-best-otc-supplements-for-gynecomastia-news-238274) somewhat machine/computer-like... hope, that doesn't make it less readable :)
Something might change during discussion... anyway...

More complex reaction, depending on mind:
    - Various differentiating levels, requiring proper mind level.
     Example levels (from lowes to highest):
        - humanoids and sheevar | spider | hovernet
        - taman | ortnok | sheevar
        - armored | unarmored kinds for taman and ortnok
        - light | heavy armor for taman and ortnok (or whoever yet)
        - standard | battle mods of hovernet and spider
        - The highest level 1: interactive reaction fire
         Possible order:
            - Each mode of each usable weapon, unit holds, must be enabled for reaction fire;
            - During enemy's turn - when unit appears in sight of soldier - time as usually is accumulated for reaction
             (accumulated time is displayed in unit's time bar), stopping for reaction requests in these cases:
                - Reacting player just accumulated enough time for next enabled reaction fire mode
                 Example: if player wields pistol and knife, reaction requests will happen on following time positions:
                    4 (knife stub) -> 6 (pistol quick shot) -> 8 (knife throw) -> 10 (pistol aimed shot or burst)
                Following cases - last warning, working if reaction time was not utilized when it could:
                - When reaction target is going to open fire (if it wants to shot plasma pisol burst,
                 its time will be added to reaction fire time reserve)
                - When target is moving towards cover and has remaining 1 tail to pass before it is in cover;
                 (in addition to marking RF iterrupted, it can also game mechanics may check alien's path
                 for such warning position and trigger warning reaction request when enemy is at it)
                Some examples:
                - sniper skipped snap shot, waiting for aimed, but enemy opens fire or about to hide too early - in shis case it can still do quick shot.
                - heavy MG-man, waiting for long burst, but forced to fire 5-round
                 (before taman will overkill him with long plasma burst)
        - Highest level 2: custom reaction
         Almost same, as level 1, but in critical situations (active unit is about to fire) passive unit may be allowed
         to do some limited set of other actions, guided by player or AI, spending accumulated time as it/he/she likes:
            - hide / unhide / grab / drop / reload weapon
             (if enemy has melee weapon, than there is enough time to even reload weapon,
             or e.g. at least take a knife to end it, if it is too impudent to still try to rush passive player)
            - some on-place movement actions - seat, stand, turn
             (e.g. soldier behind firebird wing, trying to shoot enemy on other side of wing,
             must seat, or bullet will be stoped by wing)
             (unsure about runing, as it may break some statics, thus becoming unacceptable)

You are suggesting great ideas and what about your experience when you applied any one of these ideas in your practice?