1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Knight cant do damage under special circumstances

Discussion in 'Archive' started by Coroz, Feb 5, 2017.

Thread Status:
Not open for further replies.
  1. Coroz

    Coroz B R B Donator Tester Official Server Admin
    1. [AG#] - Ancient Gear

    Messages:
    140
    Category: KAG Client

    Operating system: Windows 10 x64

    Build number: 2118

    Description: a door above you can prefend you from doing damage to the enemy.

    Steps to reproduce:
    1. place a backwall and above where you stand a door.
    2. ask someone else to go knight , i didnt realy tested with archer or builder
    3. stand under the door and try to jab the enemy knight that stands next to you.
    4. in the bug we encountered you can still do damage when you hit with a low jab. mid or a jab highup wont do damage. a slash doesnt do damage either.
    Screenshots/Videos:
    screen-17-02-05-01-05-22.png screen-17-02-05-01-05-23.png screen-17-02-05-01-05-25.png screen-17-02-05-01-05-26.png

    https://www.youtube.com/watch?v=ehyXROpzBjg

    https://www.youtube.com/watch?v=E6piY1DqlAI


    https://www.youtube.com/watch?v=T56T2o27rVI&feature=youtu.be

    Kazaco: Fixed in build 2146. PM me if problems persist.

     
    Last edited: Feb 5, 2017
    platy1knight, epsilon, Magmus and 2 others like this.
  2. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Sounds like it's detecting the door as "blocking" the attack. I'll look into it next week.
     
    Biurza, Magmus and Coroz like this.
  3. Fuzzle

    Fuzzle Grand Grumbler

    Messages:
    297
    Currently, doors are tagged 'blocks sword'. When attacking, the nearest blobs / tiles are handled first. If a door is hit, it will block and return. With how it's implemented I don't see an easy fix. I do however see a fix that'd also fix a lot of related issues. The fix would require handling static blobs (maybe normal blobs too) the same way tiles are currently handled. I only briefly skimmed the related source but I'm certain that this would fix it.
     
    Last edited: Feb 6, 2017
    Biurza and Cohen like this.
  4. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    This has only become an issue due to the widening of the jab hitbox.

    I don't really see how handling them like tiles would help much, unless you mean the semantic approach instead of the current code approach. Tiles are compared to the current aim angle (needs to be <20 degrees), some logic is added to detect hidden corner tiles, there's some extra logic to handle jabbing doing fake "partial" damage to tiles, and if all that checks out then damage is done. That doesn't exactly extend to blobs in any meaningful way that I can see.
     
  5. Fuzzle

    Fuzzle Grand Grumbler

    Messages:
    297
    `dontHitMoreMap` is only set to true if a tile is within < 20 degrees aim (with some additional logic that checks if the surrounding tiles are solid). With some static blobs - such as the door - it'll set `dontHitMoreMap` if it's within the hit arc (not limited to 20 degrees). This is the reason why the hits are blocked. It's an inconsistency between actual tiles and static blobs. The damage limiter (fake damage?) isn't relevant for this issue - only `dontHitMoreMap`. In other words: Tiles won't block an attack unless it's a direct hit while static blobs will.
     
    Last edited: Feb 12, 2017
  6. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Here (uploaded) is KnightLogic as I've updated it - basically for any blob that would block damage, I've stored the angle to that blob, and then it blocks any subsequent hits that are within a 35 degree span (17.5 deg either side) of that, rather than just blocking all incoming hits.

    I might need to adjust the thresholds a little so I'd be happy for you folks to try it out and see if you can break it.

    I'm not going to limit this to 20 degrees within the aimangle as fuzzle seems to be suggesting because then hits at the edges of the arc won't be processed correctly - it's ok for the tiles because the best tile is selected to be hit, but I believe the logic I've implemented here is required to properly filter blobs while allowing multiple hits (and multiple blockers).

    Happy to discuss the fix further though.
     

    Attached Files:

    Fuzzle and Coroz like this.
  7. Fuzzle

    Fuzzle Grand Grumbler

    Messages:
    297
    First of all, I would like to note that I haven't looked much into the previous logic nor your fix. I was confused by the use of `dontHitMoreMap`: I didn't remember that `.getHitInfosFromArc` ray casts for solid tiles (therefore, forget about the 20 degrees). I like your fix, but it still isn't consistent between static blobs and tiles:
    standard.gif blob.gif
    I would like to see the same behaviour for both of these situations. Which one is debatable.

    Also, there's inconsistency (for the fix) between different angles:
    kek.gif

    I'm on vacation: It won't get more detailed than that. :)
     
    Last edited: Feb 13, 2017
  8. Fuzzle

    Fuzzle Grand Grumbler

    Messages:
    297
    @Geti, the inconsistency I mentioned in the previous post makes this possible (current build):
    better.gif
     
    Last edited: Mar 4, 2017
    Magmus, epsilon, Biurza and 3 others like this.
  9. kedram

    kedram Drill Rusher Tester

    Messages:
    449
    does it think that your opening the door? or is it just bugging through the door?
    Edit: i thought you were red fuzzle but your actually purple, so its actually just going through the door. thats pretty insane stuff there...
     
  10. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Yeah I understand why this is happening and it's quite frustrating. It's not really "the inconsistency above" so much as "the nature of how hit info is presented".

    When you're aiming directly at the knight, the first hitinfo it gets is in line with the knight. If you aim down, since it sweeps hit arcs outwards/sideways, the hitinfo for the door is on the bottom corner - in some cases this is enough to get around the hit tolerance.

    Without raycasting against every object in-script (which is crazy slow) the only way to fix this is to up the block angle or do some gnarly maths about what the actual obscurance of the door is at a given range. Since I'm not meant to be working on KAG at all next week, I'll be going with the former I'm afraid. I might swap to using object centres rather than hit positions to make it more consistent as well.

    To remove the tile inconsistency I'll consider making tiles behave in the same way (reporting their centres as a hit blocking surface). That would mean that the "attacking through a 1 tile window" case would probably no longer be possible, but I'll see how close I can get the tolerances (even though the current bug is a result of keeping the tolerance very low).

    In general this is a fiddly problem to properly solve - it might seem "insane" that it's going through the door, but keep in mind that before, at the top of this thread, having a door above you would block hits to another direction, which is similarly "insane", and has gone unnoticed for what, about a year for jabs (when the jab hit radius was increased) and longer for slashes?
     
  11. Fuzzle

    Fuzzle Grand Grumbler

    Messages:
    297
    I'd personally prefer the current solution with raycasting for tiles. It's intuitive and easy to understand, whereas the previous & current behaviour for static blobs is rather obscure. I also believe static blobs needs to have the same behaviour as tiles - for consistency. The best possible solution I can think of is to raycast for both tiles and static blobs. I would do this engine-side. Raycasting for static blobs (and tiles) can currently be done with CMap.rayCastSolid (as used in the Builder-related code) - I would draw inspiration from this method. It'd remove a ton of issues:
    • Inconsistent behaviour between tiles and static blobs.
    • Inconsistent behaviour for different angles.
    • Static blobs blocking too much.
    • Static blobs not blocking.
    • Platforms not blocking at all.
    Potential issues:
    • Lag.
     
    Last edited: Mar 5, 2017
    Orzechix likes this.
  12. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    The raycasting would have to be done in scripts, or a "script callback raycast" function added to the engine, or a special case "raycast against blobs with specific traits" function added to the engine. The first two are super slow (the 2nd is actually slower due to jumping between AS context and C++ context and marshalling values repeatedly) and the 3rd is a weird special case, that'd then need to be either ad-hoced onto the hit infos code, or handled "after the fact" like it currently is. The raycasting for tiles is done as part of collecting hitinfos, which is why it occludes objects properly.

    The reason existing raycasting isn't used is that if it is, standing inside platforms makes attacking "not work" mysteriously, and depending on where you raycast to, standing inside platforms can make you invincible. It worked that way for a few builds, but was obviously hugely problematic. Similarly, open doors block attacks with that method. It's not bulletproof.
     
    Fuzzle likes this.
  13. Fuzzle

    Fuzzle Grand Grumbler

    Messages:
    297
    I decided to build onto your fix to mimic raycast behaviour with math:
    example.gif

    In the above, I've drawn the blocked angles. There are some additional optimization possibilities I would like to look into. Also, it would be possible to use it for tiles as well (I need this to happen). The behaviour is still quite inconsistent because of the hit positions - I don't know how they're calculated engine-side (rays?).
     
    Last edited: Mar 6, 2017
  14. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    @Fuzzle I hilariously don't have access to making that approved, but in response to your question, they're indeed calculated with rays sweeping outward from the middle of the hit arc. First hit adds the object to the list and stops raycasting to it.

    I've got a similar solution that I was gonna ask you folks to test, I've uploaded it - it actually depended on an engine-side fix for the blob radius being double what it should be, so this is very slightly modified (see line 817).

    This ignores the hit position entirely at least for blocking behaviour, and uses the same thing for tiles - it converts blocking objects into an angular position and angular size and then uses that for blocking hits. There's a minimum size used, not sure if that's a sensible idea or not.

    Looks like we're going in the same direction. I'm going to leave this for now and look at how this develops tomorrow, I'd like to get a fix out soon but I don't want to keep pushing to production for "testing" :)
     

    Attached Files:

    Fuzzle likes this.
  15. Fuzzle

    Fuzzle Grand Grumbler

    Messages:
    297
    Would be nice with a fix for the radius.

    I had an almost identical approach but I see a few issues:
    • Your calculation of the angular diameter is incorrect. Either arctan or arcsin is required in the equation. That said, I would calculate the angular radius instead - that's the value we need. Then it's not necessary to divide.
      Also, I would implement a Maths::Pi constant instead of 57.29.
    • Occasionally, a static blob will block the attack on another static blob. When this happens it'll continue and the other static blob (the one that wasn't hit) won't have its angle & threshold added. The angle & threshold should always be added. As a side note, I believe that it'd be possible to merge angles & thresholds in these cases for better performance.
    • Tiles are missing the same 'blocked' check as blobs. It's possible to hit tiles through static blobs.
    • The `offset` variable for tiles is calculated incorrectly (should be `pos` instead of `blobPos`).
    • The tile radius is not 4 but sqrt(32) as with static blobs.
     
    Last edited: Mar 10, 2017
    Cohen likes this.
  16. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    They do have a radius - it should end up as something "quite big" though. That in turn should make them behave more or less the same as the old implementation - once they're encountered, they'll block all hits.

    Re: your list - definitely valid concerns. This was all done in a hurry, as should be pretty clear.
    • That's what I get for hastily copying formulae :) Could have sworn there already was a pi constant somewhere. I guess it didn't make it AS-side.
    • Makes sense. Merging the occluders is a good idea but also fiddly.
    • I don't think it is, they have a more aggressive radius check, but I'll look into it.
    • I'm not sure it should - blobpos is the knight's position, pos is the hit position. It's inconsistent with the attack code above, but I think they should use the knight pos as well (rather than the hit arc pos)
    • Tile radius is intentionally lower, as there's already a raycast in place - I don't mind people hitting stuff that's detected as a hit around corners a _little_ earlier.
    I don't have time to implement many of them at the moment though, I'm not meant to be on KAG this week :)

    If you're excited to work on your one, please go ahead - for now I'm considering fixing the major bugs you've outlined and pushing out a minor build to bandaid the issue in the meantime.
     
    Fuzzle likes this.
  17. Coroz

    Coroz B R B Donator Tester Official Server Admin
    1. [AG#] - Ancient Gear

    Messages:
    140
    I still see it happen sometimes, that you cant do any damage to a builder , i saw it twice yesterday that a trapped knight was being tortured to death with a pickaxe. it was brutal
     
  18. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Yep, this has been left since last time. If there is a door closer to the attack point than the builder is, it'll currently "block" the attack.

    @Fuzzle I'd honestly be ok with a more vague system than currently - I don't really care much about the "through-single-hole" case here, it's more the "door 90 degrees away from target blocks attack" case. The attacks aren't particularly far-reaching so there's only so much ambiguity, and I've got a feeling a fully accurate solution is going to involve a lot of debugging.
     
    Coroz likes this.
Thread Status:
Not open for further replies.