Yekaterina Posted June 12, 2021 Report Share Posted June 12, 2021 I am trying to create a unit which is capable of both shooting arrows and using swords to hack if the enemy gets close. How would I achieve this? It would be ideal to switch attack type by holding down control. So basically a multipurpose unit that is an archer and a swordsman at the same time. 1 1 Quote Link to comment Share on other sites More sharing options...
Yekaterina Posted June 12, 2021 Author Report Share Posted June 12, 2021 @Stan` @wraitii @Freagarach Quote Link to comment Share on other sites More sharing options...
maroder Posted June 12, 2021 Report Share Posted June 12, 2021 (edited) Look at @Grapjas mod: Edited June 12, 2021 by maroder 3 Quote Link to comment Share on other sites More sharing options...
Lion.Kanzen Posted June 12, 2021 Report Share Posted June 12, 2021 @Angen Quote Link to comment Share on other sites More sharing options...
ChronA Posted June 12, 2021 Report Share Posted June 12, 2021 (edited) 5 hours ago, Yekaterina said: It would be ideal to switch attack type by holding down control. So basically a multipurpose unit that is an archer and a swordsman at the same time. I think you are going to make life much more difficult for yourself if you insist on making this feature player controlled. You will have to have a whole discussion about key-binding conflicts, and some people are going to complain about having to do extra micro to optimize their units' combat performance. (These are irrational objections, but they will likely carry the day regardless.) However the mechanic can be supported with minimal new coding and discussion, provided the unit ai is the one deciding which weapon to use. In fact, it is actually possible for a unit to have and use multiple attacks in unmodded 0AD right now, but only in a very specific circumstance. Currently units with both melee and ranged weapons defined in their template will always use the ranged attack, unless the ranged attack is restricted against their current target's class (or apparently if the target's class is a more preferred class for melee than for ranged). In that case they will switch to their melee (provided it is not also restricted). So the mechanism for a unit to use different attacks in different circumstances is already there, we just need to add additional logic for establishing attack preferences in different situations. (And add animation variants for the melee/ranged attacks to the actor files.) Edit: and the additional logic I propose is as follows... Prefer to use weapons that are within range of the target, over those that would require moving to use. If no weapon is within range of the target, switch to the weapon that is closest to being within operational range. Edited June 12, 2021 by ChronA 1 Quote Link to comment Share on other sites More sharing options...
wraitii Posted June 12, 2021 Report Share Posted June 12, 2021 10 minutes ago, ChronA said: I think you are going to make life much more difficult for yourself if you insist on making this feature player controlled. You will have to have a whole discussion about key-binding conflicts, and some people are going to complain about having to do extra micro to optimize their units' combat performance. However the mechanic can be supported with minimal new coding and discussion, provided the unit ai is the one deciding which weapon to use. Well, letting UnitAI decide on its own is also non-trivial. Quote Link to comment Share on other sites More sharing options...
Stan` Posted June 12, 2021 Report Share Posted June 12, 2021 See: https://code.wildfiregames.com/D368 for a possible implementation. 1 Quote Link to comment Share on other sites More sharing options...
ChronA Posted June 12, 2021 Report Share Posted June 12, 2021 (edited) 2 hours ago, wraitii said: Well, letting UnitAI decide on its own is also non-trivial. Sorry but you are objectively wrong about that. There are some extremely simple algorithms that would do the job (see my edit). But I think what you are trying to say is that it would be non trivial to design an algorithm that will switch between weapons competently in every tactical situation. (Which is true.) However you are approaching the problem wrong. It is not the system designer's job to produce a ideal algorithm that will work perfectly in every situation the players and modders can put it in. It is the job of the gameplay designers to design units that play well within the capabilities of the UnitAI, and it is the players job to adapt their micromanagement decisions to the programmed behaviors of their units! And this is not a new philosophy for 0AD, even in the existing design of the UnitAI itself. Units don't optimize their attack targeting to focus down glass cannons, or to avoid overkill. They generally don't even prioritize closer enemies over more distant ones, or units that are actively attacking them over those that are not. They just single mindedly pursue the first enemy that enters their field of vision. No one complains about it because 1) they are used to it and anyone who couldn't deal has left 2) the unit design has adapted so these sub-optimal decision processes don't affect the game much. Edited June 12, 2021 by ChronA clarity 1 Quote Link to comment Share on other sites More sharing options...
PyrrhicVictoryGuy Posted June 12, 2021 Report Share Posted June 12, 2021 You are oppening a colossal can of worms with this idea. 1 1 Quote Link to comment Share on other sites More sharing options...
PyrrhicVictoryGuy Posted June 12, 2021 Report Share Posted June 12, 2021 Shooting arrows until something gets close and then switching to melee reminds a whole lot of AOE3 musketeers, and that is not a good practice. Just saying someone might get the idea to implement units like this in a future alpha. 1 Quote Link to comment Share on other sites More sharing options...
maroder Posted June 12, 2021 Report Share Posted June 12, 2021 13 minutes ago, PyrrhicVictoryGuy said: reminds a whole lot of AOE3 musketeers, and that is not a good practice. What specifically is the problem with them? I never played AOE3 so not sure what you mean Quote Link to comment Share on other sites More sharing options...
PyrrhicVictoryGuy Posted June 12, 2021 Report Share Posted June 12, 2021 Well you would think a guy with a musket would have trouble against a horseman right? Well, in their wisdom the devs decided that the british civ needed to have a jack of all trades unit, normally a simple spearman/ pikeman can do this( is good against cav and can tank a bit) but they decided to make a ranged unit that is tankier than a pikeman and can also take down cav , much like the pikeman. After this, they had to give almost every civ in the game a musketeer type unit and also make another ranged unit that countered musks other tha artilery before release. In conclusion , everyone has a musketeer which can do a lot of things( boring autopilot unit, melee units except for the generic melee cav are useless( very very situational) and units that an extensive melee roster are gimped, therefore the game gets stale very fast as only the cards system and some unique units differentiate 2/3 civs. That is why i don't like how everyone in 0 AD has a spearman. 1 Quote Link to comment Share on other sites More sharing options...
ChronA Posted June 12, 2021 Report Share Posted June 12, 2021 (edited) 50 minutes ago, maroder said: What specifically is the problem with them? I never played AOE3 so not sure what you mean I'd also like some elaboration. (Thanks for clarifying.) AOE3's gameplay was just generally a lesser son of greater sires on every level, so I'm not sure how much stock I put in its specific features as examples of what to avoid. If felt to me more like a game with interesting ideas but a very rushed development, resulting in a haphazard implementation; and no one had the courage (or pull with management) to say that the project either needed more playtesting time to polish the rough edges, or to retreat back to proven design principles from previous games. As you said, the problem with the musketeer is the lack of counter-play. They could have fixed it by leaning into the historical reality that musketeers were like Roman legionaries - heavy melee infantry with a bit of bonus (short) ranged-skirmish ability. So cut their effective ranged attack distance and DPS (or maybe sustain via some ammo or stamina system) so that they are better used as straight melee, and truly countered by dedicated ranged units. Or if they wanted to be ahistorical but perhaps more fun, they could have made ranged their primary damage dealing mode the ranged attack and made their melee mode a trap state, allowing melee cav and infantry to "tie them up." (Dawn of War 2 does a lot with that concept.) Edited June 12, 2021 by ChronA Quote Link to comment Share on other sites More sharing options...
PyrrhicVictoryGuy Posted June 12, 2021 Report Share Posted June 12, 2021 Musks could kill all but the heaviest of cavalry in melee and still in the few engagements cavalry won , it was not cost effective at all. 1 Quote Link to comment Share on other sites More sharing options...
ChronA Posted June 12, 2021 Report Share Posted June 12, 2021 27 minutes ago, PyrrhicVictoryGuy said: That is why i don't like how everyone in 0 AD has a spearman. I know what you mean. The problem (IMO) is spearmen are too efficient at their job of killing melee cavalry (before they can get in contact with the squishy ranged support units). Maybe spearmen should have bonus resistance to melee cavalry attack, instead of doing bonus damage to horses? That would allow cav to be a better counter to ranged units even with spearmen in the area. Ranged units need more counter-play. And it would probably be more accurate too. The whole point of spears against cavalry is that they make infantry masses as intimidating to the horses as the horsemen are to infantry, so they all instinctively avoided each other. The spears didn't magically make the horses die or desert the field of battle, just made them tactically ineffective. Quote Link to comment Share on other sites More sharing options...
PyrrhicVictoryGuy Posted June 12, 2021 Report Share Posted June 12, 2021 (edited) Well i would to see each spearman have different stats. Hoplites have big aspis which is way better that a whicker shield used by persian spearmen so hoplite pierce armor > sparabara pierce armor for example. So diferent civs would have to take different aproaches to the same scenario. Another example, tarantine skirm cav could also have better pierce armor than numidian or asian skirm cav that use the pelta. Edited June 12, 2021 by PyrrhicVictoryGuy 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.