Question about planted spears...

正在查看此主题的用户

ID10T16

Recruit
When infantry plants their spears for defense against again cavalry, is it supposed to be 360 degree around the unit? I have tried to flank and attack from 6 o'clock, both ways gets my horse killed.

It's just kind of frustrating when a spear line is facing away from me, I try to take out a few of them, and my horse falls over from the end of the spear that should be PLANTED IN THE GROUND.

Is this intended, and can that feature be disabled?
 
I take great pleasure in deleting the contents of this post.

You would, wouldn't you? :razz:

It's not my fault you talk to yourself. Also, BAD! You stole Merc's signature color.
 
The spear has a 180 degree arc. There is a problem in that, if you start behind the unti and charge through it, the game registers you as being infront. It has no concept of direction of travel, just the speed you are moving. Thus, you will be dismounted.

I usually just wait till one or two of my Paladins have suicided into the spears, so they'll be on foot killing them all.
 
Elvin 说:
The spear has a 180 degree arc. There is a problem in that, if you start behind the unti and charge through it, the game registers you as being infront. It has no concept of direction of travel, just the speed you are moving. Thus, you will be dismounted.

Ok, that make sense. At least knowing how the code works lets you know how to work around it.

Question though...

If game has not concept of direction of travel, maybe there's another method.

For instance:

1. At point of impact, the system does 2 counts (within microseconds) and calculates distance between spear (or point of impact) and target.
2. If count 1 > count 2, apply damage. If count 1 < count 2 disregard.

This may not eliminate damage while flanking, but it should make the spearwall less impervious to all cavalry attacks.
 
That would be nice but then we would have to track the distance between every singly pair of troops on the battlefield constantly.  That would take a LOT of resources.  Tracking speed takes more time than I would like as is.  Trying to track all those differences would be nearly impossible to implement and keep framerate playable for decent sized battles.
 
That's true it could be taxing, but I'm saying just initiate the counts when determining if there is a hit. Mind you I have not gotten into the code myself to see what's going on, so I understand if my suggestions are inefficient. Working on 3 websites right now, along with classes starting back up, and maintining my full-time job. M&B is my escape from a sea of code, or from just a taxing day altogether. Perhaps some day in the future I can start modding again, but alas, life sometimes gets in the way of itself.
 
if you only start the count when there was a hit detected, you still would have had to save the moment's movement before that, which still leads to having to save every movement of every troop on the battlefield.
 
I get a feeling that it's using the same mechanic for detection as the shield, so it might not be an easy fix. However, I'm just guessing that :razz:
 
Yeah... it is not an easy task at all to make it less than 180 degrees.  I haven't yet given up on the problem of them stabbing you in the back as you run through them, though.  I just haven't found a solution to that I'm happy with yet.
 
I have idea. What if, when a spear is braced, you track the location of the point of the spear. Then when a horse crosses that point, it will be killed if its in the 180 degree range (I'm not sure the 180 degree would be possible, although, its not like shields have a "weapon reach" attribute :razz: ). And then, the spear could be inbraced once the infantry unit is hit by a horse, to allow rear and side attacks.
 
Really? I suppose it wouldn't be possible to find the coordinates of the spearman, find the direction he's facing, and use the spears weapon reach to calculate the approximate location of the point of the spear?
 
I'm guessing you're trying to fix the problem of riding from behind to in front causing the horse to get hit?  And not the shrinking the arc of attack to less than 180 degrees?

You can find the location of the spearman and the direction he is facing.  The length of the spear is already known and used to make sure the horse is in range.  However, there is no flag set for when a unit takes damage.  The only way to know this is to continually sample the hit points and compare it to the hit points previously sampled.  Easy to do for a single troop.  Possible for tons of troops, but the more troops the slower things get.  I would like a more efficient method.  Not to mention, for the very long pikes it's possible a horse could ride between a spearman and the tip of his spear without touching the tip.  What then?

I'm currently playing with the idea of comparing the direction both the horse and spearman are looking.  However, those functions return physical map positions they're looking at rather than angles of direction.  Trig functions are resource hogs, so I'm trying to create an efficient routine to do the comparison.
 
Jinnai 说:
I'm guessing you're trying to fix the problem of riding from behind to in front causing the horse to get hit?  And not the shrinking the arc of attack to less than 180 degrees?

You can find the location of the spearman and the direction he is facing.  The length of the spear is already known and used to make sure the horse is in range.  However, there is no flag set for when a unit takes damage.  The only way to know this is to continually sample the hit points and compare it to the hit points previously sampled.  Easy to do for a single troop.  Possible for tons of troops, but the more troops the slower things get.  I would like a more efficient method.  Not to mention, for the very long pikes it's possible a horse could ride between a spearman and the tip of his spear without touching the tip.  What then?

I'm currently playing with the idea of comparing the direction both the horse and spearman are looking.  However, those functions return physical map positions they're looking at rather than angles of direction.  Trig functions are resource hogs, so I'm trying to create an efficient routine to do the comparison.
Yeah, I understand shrinking the arc would be difficult, if it uses shield mechanics. Although, I was under the impression that the arc of shield defense was determined by shield size and by the characters shield skill?

Well, I have another idea. Take the same principle, but would it be possible to, when a spear is braced, have the attack "pause" (procedure-wise, not animation-wise) at the point in which the spear point is the farthest from the spearman, having it remain in that state until the spearman is interrupted or when a horse collides with the "paused" spear? That way, the damage caused by the spear could be managed by the normal combat engine of M&B. It would basically be a normal attack, although one that does not require timing. And, as far as I know, if a horse collides with the shaft of a spear between the point and the wielder (during a normal lunge, not braced), the horse is not damaged (I may be wrong about this).
 
It does not operate on "shield mechanics" whatever you mean by that.  Shield blocking is handled entirely internal to the game.  In addition to that, we cannot set the ai state for any npc, that is all also handled internally to the game, as I've mentioned several times before in other threads.  And finally, it is impossible to use "the normal combat engine" to handle any scripted event such as this.  As I just said, we can't change the ai state, so we can't make them execute a physical attack.  And the game handles the actual attacks entirely internal.  The only functions we have are the ability to manually control the hit points of every agent on the field and the ability to deliver damage from one agent to another.  Though we have seemingly no control of the actual amount of damage dealt.  For hit points that have been modified to actually update in game also requires one of those hits be called between agents.  I really appreciate your attempts to help, but I don't think you understand what can and cannot be done with how limited the Module System is.
 
You're right, I guess I don't know how limited the module system is. I was looking at it from the typical modding (modified .exe) perspective.
 
后退
顶部 底部