Real Ranged Attacks (Modification for 1.18.x)

Discussion and development of scenarios and campaigns for the game.

Moderator: Forum Moderators

User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Real Ranged Attacks (Modification for 1.18.x)

Post by ZombieKnight »

Atreides wrote: August 17th, 2024, 4:27 pm As Spock would say: fascinating. : )

So if I got it right it teleports next to the target does the ranged attack then ports back? Hehehe. One thing though... what happens if the target has no free hex next to it?
:D
No, wesnoth doesn't require two adjacent units to perform an attack.
User avatar
Atreides
Posts: 1243
Joined: March 30th, 2019, 10:38 pm
Location: On the 2nd story of the centre village in Merwuerdigliebe turning the lights on and off

Re: Real Ranged Attacks (Modification for 1.18.x)

Post by Atreides »

Heh, re-reading the thread I see that teleporting was just a suggestion. I've downloaded and tried it now and as the others say: wow this is neat.

I peeked inside and I see it is 100% lua (which I'm only starting to learn hehe) and that even the ai appears to have been customized to deal with it. Impressive stuff.

I've only played one quick game so far. Contrary to what one might expect melee units don't lose their value here at all. The close lock option ensures that. In fact if you can get two melee units to surround a unit with only ranged (e.g. DA) things turn around quite a bit. The tactical changes of course mirror those most old wargamers (like me) are accustomed to when using artillery. Keep it away from the front line! ; )
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Real Ranged Attacks (Modification for 1.18.x)

Post by ZombieKnight »

Glad to hear that. ^^
User avatar
Spannerbag
Posts: 759
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Real Ranged Attacks (Modification for 1.18.x)

Post by Spannerbag »

ZombieKnight wrote: August 17th, 2024, 3:20 pm
Spannerbag wrote: August 17th, 2024, 11:46 am
Heh, I came up with loads of complicated ideas...
You can do this actually using specials and formulas that count distance and -5% damage per tile, for example. Or any other function. :)
I will include an example in the next update.
Please do! :)
Could the close lock be implemented as a special too?

ZombieKnight wrote: August 17th, 2024, 3:20 pm
Spannerbag wrote: August 17th, 2024, 11:46 am IMHO, it does significantly change the game, and some mechanism might be desirable to maybe balance the added advantage enjoyed by ranged attacks...
I tried to add the close lock to make it weaker, if you have any ideas on how to balance it, I'd like to hear them ^^.
Well, off the top of my head, making longer range attacks "less attractive" in some way would seem appropriate.
I've no idea how difficult these might be to implement and I'm spouting rubbish giving thoughts that come to mind which haven't been thought through yet.
However some random thoughts:
  1. Ranged attacks against non-adjacent targets become less accurate (even magical/marksman?).
    1. Target defence increases with range, or
    2. Have a flat chance to miss, e.g. ?% per extra hex up to ??% chance of missing, if attack doesn't miss resolve as normal attack (so could still miss)?
      And/or
    3. Increasing chance of hitting nearby units other than intended target (increases with range)
      Alternatively...
    4. Attacker is paying more attention to what's happening further away so is to some extent distracted regarding adjacent attacks so they suffer the converse of the above, i.e. attacker defense/chance to hit (in retaliation) reduced if attacked by adjacent unit whilst targetting more distant opponent?
      This could be tricky because the attacker would attack on their turn then be subject to these penalties on the enemy turn(s)...maybe use unit variables to track state?
  2. Damage reduces as range increases (as mentioned previously).
  3. Non-adjacent ranged attacks not allowed if unit is zone-locked at start of turn?
    (No real in-game logic to this I guess, but it offers the player a tactic to neutralise enemy long range attacks.)
    Not sure whether skirmishers should be affected or not as they can still move normally...
  4. Cannot fire further than visual range (even if unit visible on map) - tho' this generally won't be a meaningful limtiation IMHO.
  5. Long range attacks use extra movement so an attacker cannot target an enemy 3 hexes away unless attacker has 3+ movement remaining.
    (No real in-game logic to this I guess, but it offers the player a way to estimate which units will be in enemy range on enemy turn after movement.)
  6. Cannot fire at targets if attacker does not have direct line of sight to target that is 2 hexes wide?
    In the DM screen grab the northern spearman was able to throw a spear at the wolf rider which whizzed past the Mage. :)
    Don't think this would make sense to players.

Hope these give you some ideas/starting points.
If anything else comes to mind will let you know.

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.18, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Real Ranged Attacks (Modification for 1.18.x)

Post by ZombieKnight »

Spannerbag wrote: August 17th, 2024, 9:47 pm Please do! :)
Could the close lock be implemented as a special too?
It's a special (has two parts tho, becouse Lua van't filter if special is active in pre-attack)
Well, off the top of my head, making longer range attacks "less attractive" in some way would seem appropriate.
I've no idea how difficult these might be to implement and I'm spouting rubbish giving thoughts that come to mind which haven't been thought through yet.
Yes :D.
[*]Target defence increases with range
It's an option, but becouse I plan to use it on like 2-3 hex ranges it won't be so effective (I can add it into the add-on tho :) )
[*]Have a flat chance to miss, e.g. ?% per extra hex up to ??% chance of missing, if attack doesn't miss resolve as normal attack (so could still miss)?
This feels very similar to previous idea:).
[*]Increasing chance of hitting nearby units other than intended target (increases with range)
I actually plan it, mostly for really ranged units like cannons in my campaing (20 tiles range), I can definitely add it into add-on too.
[*]Attacker is paying more attention to what's happening further away so is to some extent distracted regarding adjacent attacks so they suffer the converse of the above, i.e. attacker defense/chance to hit (in retaliation) reduced if attacked by adjacent unit whilst targetting more distant opponent?
This could be tricky because the attacker would attack on their turn then be subject to these penalties on the enemy turn(s)...maybe use unit variables to track state?[/list]
I see the point of this and I like it.
[*]Damage reduces as range increases (as mentioned previously).
I would rather go with chance to hit actually.
[*]Non-adjacent ranged attacks not allowed if unit is zone-locked at start of turn?
(No real in-game logic to this I guess, but it offers the player a tactic to neutralise enemy long range attacks.)
Not sure whether skirmishers should be affected or not as they can still move normally...
I like this one, stronger close lock, but I fear that each skirmisher could block 1-3 archers, which would be really strong, any idea how to balance this?
[*]Cannot fire further than visual range (even if unit visible on map) - tho' this generally won't be a meaningful limtiation IMHO.
IYHO you're right I guess, the max-min range has a purpose.
[*]Long range attacks use extra movement so an attacker cannot target an enemy 3 hexes away unless attacker has 3+ movement remaining.
(No real in-game logic to this I guess, but it offers the player a way to estimate which units will be in enemy range on enemy turn after movement.)
It makes archers slower... which I'm nit sure about those full three hexes (units with 4-5 moves would be messed) and current AI won't be aible to work with it :/. I maybe can add it for testing it out?
[*]Cannot fire at targets if attacker does not have direct line of sight to target that is 2 hexes wide?
In the DM screen grab the northern spearman was able to throw a spear at the wolf rider which whizzed past the Mage. :)
Don't think this would make sense to players.[/s]
I have a line of sight in progress, maybe it's what you meant.

Thanks for those ideas :D.
User avatar
Spannerbag
Posts: 759
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Real Ranged Attacks (Modification for 1.18.x)

Post by Spannerbag »

ZombieKnight wrote: August 18th, 2024, 5:18 am
Spannerbag wrote: August 17th, 2024, 9:47 pm ...Have a flat chance to miss, e.g. ?% per extra hex up to ??% chance of missing, if attack doesn't miss resolve as normal attack (so could still miss)?
This feels very similar to previous idea:).
Yeah, just thought this alternative might be easier to implement?

ZombieKnight wrote: August 18th, 2024, 5:18 am
Spannerbag wrote: August 17th, 2024, 9:47 pm ...Non-adjacent ranged attacks not allowed if unit is zone-locked at start of turn?
(No real in-game logic to this I guess, but it offers the player a tactic to neutralise enemy long range attacks.)
Not sure whether skirmishers should be affected or not as they can still move normally...
I like this one, stronger close lock, but I fear that each skirmisher could block 1-3 archers, which would be really strong, any idea how to balance this?
Not saying you're wrong, but I can't (from my admittedly quick scribblings) see how to get a 1-3 ratio of zone lockers vs locked?
Here's a quick sketch of Skirmishers and Enemies.
I think numerically, even with a favourable start (below, the skirmisher in the middle of the highlighted area was encircled at start of skirmisher turn) each skirmisher on average can block about 2 enemy units? But I could well be wrong!
Even so, close lock permitting, zone locked units can still attack adjacent enemies with ranged attacks. :)
I suspect in real life situations the skirmishers will not get near a 2-1 ratio very often but yes, you make a fair point.
Will have a think when I get chance.
ESsketch.png

ZombieKnight wrote: August 18th, 2024, 5:18 am
Spannerbag wrote: August 17th, 2024, 9:47 pm Long range attacks use extra movement..
It makes archers slower... which I'm nit sure about those full three hexes (units with 4-5 moves would be messed) and current AI won't be aible to work with it :/. I maybe can add it for testing it out?
Well, it would only make archers slower if making long range attacks, they could still make "normal" attacks on adjacent units (subject to close lock of course).
I can see this would be tricky, after each unit moves the "personal maximum range" for ranged attacks would have to be set based on remaining movement?
I.e unit max. range = min(modification maximum range, unit current moves) but after movement. Then there's "undo"...
No worries, if it doesn't work, it doesn't work. :)

ZombieKnight wrote: August 18th, 2024, 5:18 am
Spannerbag wrote: August 17th, 2024, 9:47 pm ...Cannot fire at targets if attacker does not have direct line of sight to target that is 2 hexes wide?
In the DM screen grab the northern spearman was able to throw a spear at the wolf rider which whizzed past the Mage. :)
Don't think this would make sense to players.
I have a line of sight in progress, maybe it's what you meant.
Probably: it seemed the spearman attack "swerved" round the friendly unit (Mage), but that could be a manifestation of the hex layout.
I was paying more attention to the animation issue to be fair.
It's no big deal. :)

Glad you found some of my "brain dump" ideas helpful. :D
Not had chance to consider things further (and am sadly unlikely to do so for a few days :( ).

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.18, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Real Ranged Attacks (Modification for 1.18.x)

Post by ZombieKnight »

Spannerbag wrote: August 18th, 2024, 12:02 pm Not saying you're wrong, but I can't (from my admittedly quick scribblings) see how to get a 1-3 ratio of zone lockers vs locked?
Here's a quick sketch of Skirmishers and Enemies.
I think numerically, even with a favourable start (below, the skirmisher in the middle of the highlighted area was encircled at start of skirmisher turn) each skirmisher on average can block about 2 enemy units? But I could well be wrong!
Even so, close lock permitting, zone locked units can still attack adjacent enemies with ranged attacks. :)
I suspect in real life situations the skirmishers will not get near a 2-1 ratio very often but yes, you make a fair point.
I'm not sure if you got me 100% right, I meant that sibgle melee skirmisher can keep blocking two enemy archers.
Will have a think when I get chance.
:D neat, I think the stronger close lock can be a good balance mechanic, if we come up with the skirmisher-proof mechanic.
Well, it would only make archers slower if making long range attacks, they could still make "normal" attacks on adjacent units (subject to close lock of course).
I can see this would be tricky, after each unit moves the "personal maximum range" for ranged attacks would have to be set based on remaining movement?
I.e unit max. range = min(modification maximum range, unit current moves) but after movement. Then there's "undo"...
No worries, if it doesn't work, it doesn't work. :)
I like it actually :).
But thinking about it, I would have to have a dynamic max_range, which isn't currently possible :/ (but will be if Ravanas pull request get accepted in 1.20).
Probably: it seemed the spearman attack "swerved" round the friendly unit (Mage), but that could be a manifestation of the hex layout.
I was paying more attention to the animation issue to be fair.
It's no big deal. :)
For the proper animation, it would require soneone to do the animations, and mainline support would help a lot... which isn't too realistic, and it's not a highest priority now :/.
Glad you found some of my "brain dump" ideas helpful. :D
Not had chance to consider things further (and am sadly unlikely to do so for a few days :( ).
Yeah some of you "brain dump" was rather helpful.
Get better, enjoy holidays or get over it soon ;-P .
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Real Ranged Attacks (Modification for 1.18.x)

Post by ZombieKnight »

Ravana wrote: August 16th, 2024, 10:04 pm Move+attack would be nicest to have out of these. I would try implement it as [teleport] next to target unit, while cancel the movement in exit_hex. That would not be +attack yet, but would move to max_range distance so you wouldnt have to count for move.
I'm sorry, but reading it again, I'm not sure what have you meant :/.
If you could spell it out loud for me?
User avatar
Ravana
Forum Moderator
Posts: 3313
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Real Ranged Attacks (Modification for 1.18.x)

Post by Ravana »

But thinking about it, I would have to have a dynamic max_range, which isn't currently possible :/ (but will be if Ravanas pull request get accepted in 1.20).
It will not be accepted unless someone tests that it works.

0) ranged attacker stands outside attack range, but can see target
1) user selects ranged attacker
2) user hovers target
3) attack arrow is visible
4) user clicks, gets attack selection
5) ranged attacker moves towards target
6) as soon as target is in attack range, move is interrupted
7) if possible attack target automatically, otherwise 8) user clicks like now
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Real Ranged Attacks (Modification for 1.18.x)

Post by ZombieKnight »

Ravana wrote: August 18th, 2024, 6:19 pm It will not be accepted unless someone tests that it works.
I'm unable to do that right now, but I'm working on compiling my own Wesnoth :D
0) ranged attacker stands outside attack range, but can see target
1) user selects ranged attacker
2) user hovers target
3) attack arrow is visible
4) user clicks, gets attack selection
5) ranged attacker moves towards target
6) as soon as target is in attack range, move is interrupted
7) if possible attack target automatically, otherwise 8) user clicks like now
Thanks for the clearance :) ...

0,1,2,5,6,7 - is easy/already implemented.
3 - is impossoble without change in engine.
For the same reason there is no graphic pre-showing regular real-ranged attack.
4 - possible. Any idea how to choose the attacking hex?
I would choose the closest move-vise, or should I choose a hex based on the way mouse moved onto the enemy?
What would be better?

+ 9 make it work even when the move is interupted (by event/ambush)
The 9 will be cared about once I get the move+attack working.

Ps.: should it be 8) or 8 ) ? XD
User avatar
Ravana
Forum Moderator
Posts: 3313
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Real Ranged Attacks (Modification for 1.18.x)

Post by Ravana »

I was thinking of teleport for 3), but not sure if it will work.

I was thinking of closest hex. If user is not happy with closest he can move manually.
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Real Ranged Attacks (Modification for 1.18.x)

Post by ZombieKnight »

Ravana wrote: August 18th, 2024, 6:55 pm I was thinking of teleport for 3), but not sure if it will work.
I don't know how should that work.
I was thinking of closest hex. If user is not happy with closest he can move manually.
Will be easiest probably.
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Real Ranged Attacks (Modification for 1.18.x)

Post by ZombieKnight »

1.1.0 is out, featuring move&attack UI.
(Due to the fact specials and abilities cannot be pre-evaluated in Lua now it can show not-true information in case of some custom abilities)
Ravana wrote:
Is it what you expected?
Am I missing something?
User avatar
Ravana
Forum Moderator
Posts: 3313
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Real Ranged Attacks (Modification for 1.18.x)

Post by Ravana »

I tried it out, I think it should be possible to do attack move in case unit distance is movement+range. Looks like currently it tries only within movement.
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Real Ranged Attacks (Modification for 1.18.x)

Post by ZombieKnight »

Ravana wrote: August 20th, 2024, 3:27 pm I tried it out, I think it should be possible to do attack move in case unit distance is movement+range. Looks like currently it tries only within movement.
Can You send the save-file?
Worked well on my testing.
Screenshot_20240820_180326.png
Post Reply