Targeting logic

For code related discussions and questions
User avatar
Stratadrake
Trained
Trained
Posts: 197
Joined: 07 Sep 2008, 09:43
Location: Pacific NW
Contact:

Re: Targeting logic

Post by Stratadrake » 03 Dec 2012, 04:33

Slow-reloading weapons will wait for projectiles to impact, high-rate weapons will try to kill as much as possible.
This could be made a per-weapon setting in Weapons.txt....
Strata @dA, @FAC

User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: Targeting logic

Post by Shadow Wolf TJC » 03 Dec 2012, 14:11

While we could put one of those unused variables in weapons.txt to use for such a change, weapons.ini (which is used by master builds) would need an update.
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100

User avatar
milo christiansen
Regular
Regular
Posts: 749
Joined: 02 Jun 2009, 21:23
Location: Perrinton Michigan

Re: Targeting logic

Post by milo christiansen » 07 Jan 2013, 18:36

This is a good idea. After some more testing, iteration and tweaking this would be a good thing to add to the base game.
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual

raycast
Trained
Trained
Posts: 131
Joined: 12 Sep 2012, 19:16

Re: Targeting logic

Post by raycast » 18 Jan 2013, 19:55

milo: well, much of it is in 3.1 - because the doomedness prediction was already committed, so I did this small patch ignoring doomedness for high ROF weapons.

I'm not sure whether a flag in the weapons.txt will do the trick. If you have been following the ticket http://developer.wz2100.net/ticket/3748 then you will know that there are a lot of odd situations.

For example, a fortress is usually really slow. But when the range is also low, one might want it to "overkill" units, too!

I don't know if my updated patch made it into 3.1.0 -- it should further improve the situation by also overkilling doomed units if they get close. So the new tactic of outrunning a missile to get a free shot shouldn't work as well anymore - if you get too close, you will still be killed (and fast turrets will also kill).

I'd really love to see a logic that takes the ETA of the projectiles into account. Something like this: if my shot is likely to kill the unit before the incoming artillery, I'll try to kill anyway. Otherwise, wait to save reloading time. Combine this with ETA of other units, and we'd have a pretty nice logic.

However, it needs to be fast, fast, fast, fast. As there is a lot of action on the field.

User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Targeting logic

Post by aubergine » 18 Jan 2013, 20:28

Substitute time for simple distance check to work out ETA? Distant weapon, even with pretty fast projectiles, is generally going to take longer to hit target than local weapon.

In particular, for most players, they build longest range weapons further away from danger zones. Example: Ripples and Archangels usually built near base, pillboxes built near front lines.

Things like missile fortresses are currently under-utilised: An army could be camped in front of them and they sit and wait for long range ripples or howitzers to hit. Result is that missile fortress is firing far fewer missiles than it should. For it's cost and time to build, it should fire as soon as it can, so that it has chance to reload and get another shot.

Another factor could be health of the defence structure -- if it's low health, might as well get off some shots before it gets destroyed! Very frustrating watch a structure get blown to pieces because it was patiently waiting for distant projectiles to hit it's aggressor.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO

raycast
Trained
Trained
Posts: 131
Joined: 12 Sep 2012, 19:16

Re: Targeting logic

Post by raycast » 19 Jan 2013, 19:18

The problem is this:
the targeting logic does not have access to the incoming projectiles (and checking all of them for every target every tick is way too expensive!)

All it has is a predition of damage to the unit that is updated when a projectile was fired.

So unless we find a highly efficient way of tracking this additional data, we cannot just do such a logic.

Distance itself is already used for priorizing units for attacking. Plus, you need to realize that each unit decides on its own which enemy to attack. It's not as if the ai is spotting a new unit, then deciding which weapon to use for attacking.

raycast
Trained
Trained
Posts: 131
Joined: 12 Sep 2012, 19:16

Re: Targeting logic

Post by raycast » 06 Feb 2013, 14:08

http://developer.wz2100.net/ticket/3748

Has a new patch that actually tracks incoming projectiles with expected damage and time. This allows computing a "expected time to death", and thus a much more complex logic.

The patch works for me, although there might actually be an error in the formulas used for computing the time for indirect firing weapons. I didn't have the time and passion to double-check it.

Either way, please help testing it. Produce some scenarios for testing, so we can somewhat objectively measure whether the new logic is better than the old, or worse.

In my experiments I had the impression that high ROF but slow traveling weapons can become much more effective with the patch. For example, a pack of seraph missile tanks. Previously, they would all empty their missiles on the same target. Now they can lay devastation to multiple defenses at the same time.

But for example, I havn't tested it on the "fortresses backed by artillery" scenario yet.

Plus, we may need to add updating of the damage prediction when units moved from their original position. This can probably be done when updating the missile position. This would e.g. give a fortess an extra reason to fire at a unit if it is moving too fast for the grenades to hit.

Post Reply