suriyun-production / mmorpg-kit-docs

This is document for MMORPG KIT project (https://www.assetstore.unity3d.com/#!/content/110188?aid=1100lGeN)
https://suriyun-production.github.io/mmorpg-kit-docs
49 stars 11 forks source link

Missile Entity often do not apply damage (Version 1.85c3) #2300

Closed Eniotnacram closed 8 months ago

Eniotnacram commented 8 months ago

After the new Hit register workflows my missile entity rarely hit (does damage) to the enemy. The Entity is getting destroyed on the enemy but do not apply damage.

It looks like this problem occur when the enemy is getting closer to the player.

Callepo commented 8 months ago

The issue is they have it for high speeds like 100+ Missile Works flawlessly at normal speeds, But at 100 image

This literally returns false everytime

Callepo commented 8 months ago

image Lowering the 0.8 to 0.2 it works fine even at Speed = 100.. but idk how it would effect speed hack detection.. the time is an issue if u have a too high speed, to avoid this, missile should limit speeds that can be calculated by the calculations..

Or just lower it and be like fuck it.. idk lol P.S, 0.2 is just a random number i picked that was low to test it, to see if was low enough if it was gonna work.. and it did. This was original

https://github.com/suriyun-production/mmorpg-kit-docs/assets/7702658/6086eff5-6907-40ad-9ff8-1bbcadbf601c

Callepo commented 8 months ago

PLS DO NOT CHANGE HOW HIT VALIDATION IS WORKING ETC, This is literally best ive seen it work in 3 years.. The only issue is the 0.8 time frame is not low enough for high velocity, it should be lower or have a better formula that is all!

Eniotnacram commented 8 months ago

@Callepo glad you came and help us figure it out. So yea, I would say that the kit has never been THAT good for the missile, raycast and stuff. The only problem was it wasnt doing damage, but we figured out why. Now we have some options, either lowering the timer of the speed hack, or clamping the speed for the missile entity to a max (not over ~60).

insthync commented 8 months ago

PLS DO NOT CHANGE HOW HIT VALIDATION IS WORKING ETC, This is literally best ive seen it work in 3 years.. The only issue is the 0.8 time frame is not low enough for high velocity, it should be lower or have a better formula that is all!

Yes that is exactly what I am going to do, but the situation is one said it works perfectly if speed detection disabled but another one siad it is not, so I want to make sure that what is the cause of problem.

moepi2k commented 8 months ago

i tested also both in 185c3 and as calle said, its best we have since ever. only the IsHitValid formula need to be better for high velocity projectiels. 0.8 works with slow one. but not with higher velocity. i tested 0.2 with velocity 200 and it works but i dont know that an effect it has when changing that number.

moepi2k commented 8 months ago

so this works pretty well, tested with speed of 200 and all hits registered

`public override bool IsHitValid(HitValidateData hitValidateData, HitRegisterData hitData, DamageableHitBox hitBox) { float dist = Vector3.Distance(hitData.Origin, hitData.Destination); float maxExtents = Mathf.Max(hitBox.Bounds.extents.x, hitBox.Bounds.extents.y, hitBox.Bounds.extents.z);

        // Too far
        if (dist > missileDistance + maxExtents)
            return false;

        float duration = (hitData.HitTimestamp - hitData.LaunchTimestamp) * 0.001f;

        // Duration must be greater than zero to avoid division by zero
        if (duration <= 0)
            return false;

        // Calculate the relative speed (as a ratio of expected missile speed)
        float relativeSpeed = (dist / duration) / missileSpeed;

        // Define the acceptable lower and upper bounds for relative speed
        float lowerBound = 0.8f; // or some other threshold that makes sense for your scenario
        float upperBound = 1.5f; // assuming 150% of missileSpeed is the upper limit for high velocity

        // Check that the relative speed is within the acceptable bounds
        if (relativeSpeed < lowerBound || relativeSpeed > upperBound)
            return false;

        return true;
    }`

i think noone will ever use higher speed of 200 so u maybe can clamp the inspector value to max 200 for missiledamageentity

Eniotnacram commented 8 months ago

Thanks y'all for your participation in this. @insthync so yes, @Callepo @moepi2k are right, the only thing to modify is the isHitValid to make it work with higher velocity missiles.

Callepo commented 8 months ago

if his doesnt work with it disabled, than his shit is messed up, and not related to the missiles. he should figure out what he broke

Callepo commented 8 months ago

so this works pretty well, tested with speed of 200 and all hits registered

`public override bool IsHitValid(HitValidateData hitValidateData, HitRegisterData hitData, DamageableHitBox hitBox) { float dist = Vector3.Distance(hitData.Origin, hitData.Destination); float maxExtents = Mathf.Max(hitBox.Bounds.extents.x, hitBox.Bounds.extents.y, hitBox.Bounds.extents.z);

        // Too far
        if (dist > missileDistance + maxExtents)
            return false;

        float duration = (hitData.HitTimestamp - hitData.LaunchTimestamp) * 0.001f;

        // Duration must be greater than zero to avoid division by zero
        if (duration <= 0)
            return false;

        // Calculate the relative speed (as a ratio of expected missile speed)
        float relativeSpeed = (dist / duration) / missileSpeed;

        // Define the acceptable lower and upper bounds for relative speed
        float lowerBound = 0.8f; // or some other threshold that makes sense for your scenario
        float upperBound = 1.5f; // assuming 150% of missileSpeed is the upper limit for high velocity

        // Check that the relative speed is within the acceptable bounds
        if (relativeSpeed < lowerBound || relativeSpeed > upperBound)
            return false;

        return true;
    }`

i think noone will ever use higher speed of 200 so u maybe can clamp the inspector value to max 200 for missiledamageentity

tried this, it still misses alot, and only used 120 speed, the 0.8 lower bound needs to be lower for high speeds

Callepo commented 8 months ago

@insthync image

i did this, it changes the static variable, based on missile speed, which goes up and down Tried 150 speed and works fine.. And it still checks for speed hack, becuase if the speed is not same as server it will not match and return false.

Eniotnacram commented 8 months ago

float duration = (hitData.HitTimestamp - hitData.LaunchTimestamp) * 0.001f;

    // Duration must be greater than zero to avoid division by zero
    if (duration <= 0)
        return false;

    // Calculate the relative speed (as a ratio of expected missile speed)
    float relativeSpeed = (dist / duration) / missileSpeed;

    // Define the acceptable lower and upper bounds for relative speed
    float lowerBound = 0.8f; // or some other threshold that makes sense for your scenario
    float upperBound = 1.5f; // assuming 150% of missileSpeed is the upper limit for high velocity

    // Check that the relative speed is within the acceptable bounds
    if (relativeSpeed < lowerBound || relativeSpeed > upperBound)
        return false;

if his doesnt work with it disabled, than his shit is messed up, and not related to the missiles. he should figure out what he broke

I agree, missiles works extremely well except the IsHitValid. Nothing needs to be modified except this.

darkkriteus commented 8 months ago

Good afternoon, I also did the tests on 185c3, I was having this problem, in addition to disabling hack detection, there is another problem that must be the case with the xnitro1

the other problem is in the detection configuration, if you use MissisleDamageEntity and use HitDetectionMode as sphere or other than raycast, then it doesn't hit targets very far away, only up close, the solution I had was to set HitDetectionMode as raycast, and use a collider component such as a sphereCollider or another, how Firebolt is configured. This way it will always collide correctly, I hope I helped :)

insthync commented 8 months ago

@darkkriteus Do you saw it hit and disappeared at client?

Eniotnacram commented 8 months ago

@darkkriteus Do you saw it hit and disappeared at client?

The hit and disappearance is due to the speed hack. Will be fixed next update

darkkriteus commented 8 months ago

@darkkriteus Do you saw it hit and disappeared at client? The hit and disappearance is due to the speed hack. Will be fixed next update

the HitDetectionMode problem is different from the SpeedHack problem

@darkkriteus Do you saw it hit and disappeared at client?

Yes, it hits but does not cause damage, any HitDetectionMode option other than raycast causes this problem

darkkriteus commented 8 months ago

@Edit

So I did more tests, I noticed that if the size of the Collider type is greater than 5, it starts to fail. image with this size it works More than that it starts to cause problems

moepi2k commented 8 months ago

im sure it a wrong setting on ur side. radius that size will automaticly collide on instaniate. normal player have a size of 2. so when u go bigger u collide with ground

Eniotnacram commented 8 months ago

My game works entirely using missile, been playing with them for a year, and they finally work fine now. The only problem now is the speed hack stuff, I'm positive to say that any other problem related to the missiles are caused by a bad configuration.

darkkriteus commented 8 months ago

im sure it a wrong setting on ur side. radius that size will automaticly collide on instaniate. normal player have a size of 2. so when u go bigger u collide with ground

No, because I set it so that Projectile doesn't collide with the ground

moepi2k commented 8 months ago

you dont neeed to have a collider attached to it, and spherecastradius has nothing todo with a collider component. also the size u set is wrong. 1) it make no sense to make that big size, becasue the size is bigger than your player so it already collider with nearby stuff (ground). thats the reason why it only work for nearby target

Callepo commented 8 months ago

Good afternoon, I also did the tests on 185c3, I was having this problem, in addition to disabling hack detection, there is another problem that must be the case with the xnitro1

the other problem is in the detection configuration, if you use MissisleDamageEntity and use HitDetectionMode as sphere or other than raycast, then it doesn't hit targets very far away, only up close, the solution I had was to set HitDetectionMode as raycast, and use a collider component such as a sphereCollider or another, how Firebolt is configured. This way it will always collide correctly, I hope I helped :)

This is not true

Callepo commented 8 months ago

@edit

So I did more tests, I noticed that if the size of the Collider type is greater than 5, it starts to fail. image with this size it works More than that it starts to cause problems

also not true

Callepo commented 8 months ago

This is my Missile Damage Entity prefab, from default kit.. i only changed the Distance the player can shoot.. from 5 to 20.. so its far away.. image

i didnt change anything on the prefab, its using Same Sphere cast u said didnt work from far distance if radius not massive..

this is test from it

https://github.com/suriyun-production/mmorpg-kit-docs/assets/7702658/3cf13ebd-b888-4d80-b3df-0b4e8baacb3a

Callepo commented 8 months ago

@darkkriteus u have something wrong on ur side, idk what it is, but what u said above every thing i tested proved otherwise. there is 3 people saying the same thing that what ur saying is not correct and its probably something ur doing wrong on something else

I didnt even disable the HitValidation Code, i left it on. My missile speed is 60, Distance is 20, Sphere cast, Raduis of 0.3

Callepo commented 8 months ago

@darkkriteus im doing next test, by changing the Hitvalidation code, with what i said above that makes it better at high speeds image

With same Radiuis on my sphere cast, which is 0.3.. default..

changed distance from 20 to 30 now speed from 60 to 150 image

IDK what else u wanna see, Not 1 single arrow missed..

@insthync

https://github.com/suriyun-production/mmorpg-kit-docs/assets/7702658/d0960f4a-4003-4437-8f16-61bbf807267a

darkkriteus commented 8 months ago

do the test with a large sphere radius, I said that the problem is with it being too big, not when it is small

Callepo commented 8 months ago

do the test with a large sphere radius, I said that the problem is with it being too big, not when it is small

  • Also disable to collide with the ground, so that the very large radius does not collide with the ground

making it too big is as pointless as it sounds.. "TOO BIG"... if ur radius is bigger than ur character, obvs its gonna hit the ground or ur own character before it even starts moving..

Whats the point of making it too big? Whats the reason u wanna make it "too big" for? do u have a purpose for this ?

Its like saying, throw a wrench in ur engine, and tell me if it drives good..

darkkriteus commented 8 months ago

you dont neeed to have a collider attached to it, and spherecastradius has nothing todo with a collider component. also the size u set is wrong. 1) it make no sense to make that big size, becasue the size is bigger than your player so it already collider with nearby stuff (ground). thats the reason why it only work for nearby target

and who said I added a collider component? and there is no way for the sphera to collide with the ground, if it was disabled to collide with the ground, only with Monsters

darkkriteus commented 8 months ago

do the test with a large sphere radius, I said that the problem is with it being too big, not when it is small

  • Also disable to collide with the ground, so that the very large radius does not collide with the ground

making it too big is as pointless as it sounds.. "TOO BIG"... if ur radius is bigger than ur character, obvs its gonna hit the ground or ur own character before it even starts moving..

Whats the point of making it too big? Whats the reason u wanna make it "too big" for? do u have a purpose for this ?

Its like saying, throw a wrench in ur engine, and tell me if it drives good..

I'm just trying to report the problem, and as I said, the projectile hits the enemy, and doesn't cause damage, so if it travels to the enemy, how does it hit the ground? Not to mention that collision with the ground has been disabled, only against monsters.

Callepo commented 8 months ago

1) u do know clients can display 1 thing and server another right?? meaning, not just becuase it" hit " the monster on ur client it did on server, and having a massive radius is straight up stupid, and pointless.. in every single test i did, there was not a single issue 2) We been saying from the start, that it could be a user error, and seeing by what ur saying just confirms it, i see literally not a single reason to have a collidor on a missile bigger than the actual player and having to disable all collision except monster to just have a missile be able to work, just listen to what ur saying.. 3) if suri had to go make the full kit idiot proof, we would never progress

u have still to mention any usecase where this is needed in an actual environment. Instead of delaying the actual issue, and finding a solution, to the actual issue, which is the speedhack validation calculation not being optimal for high speeds of missiles, we are here discussing " An oversized radius on a missile that is bigger than the actual player, which u have to specifically disable all collision, including ground, to just have it be able to move, and try to hit a monster.. "

Callepo commented 8 months ago

image This make any sense to u ?

darkkriteus commented 8 months ago

Okay, it's my mistake then, don't talk about it anymore

Callepo commented 8 months ago

Okay, it's my mistake then, don't talk about it anymore

LOL, wouldnt be talking bout it, if u didnt bring that dumb shit up lol, and now u wanna command me to stop talking bout some ?

xnitro1 commented 8 months ago

Just calm down... nobody is commanding anyone. He has a problem and dont feel he got heard. Now he is not expecting any help anymore. And calling his problem "dumb shit" is also Not very friendly. So let's just calm down and drop this matter. Suri knows about the speed stuff and Dark is Not expecting anything anymore. This Thread should be closed before someone says anything he might regret later. Let's be adults.

Callepo commented 8 months ago

Just calm down... nobody is commanding anyone. He has a problem and dont feel he got heard. Now he is not expecting any help anymore. And calling his problem "dumb shit" is also Not very friendly. So let's just calm down and drop this matter. Suri knows about the speed stuff and Dark is Not expecting anything anymore. This Thread should be closed before someone says anything he might regret later. Let's be adults.

it wont go that far, dw, also im calm as can be, im just very direct, even asked multiple times, whats his usecase was or why he needed this, or in what scenario this would be viable, to try and find a solution for him, which i never got a response for, and how he was replying to every comment on his matter i didnt like :) nor how he spoke. sometimes even adults needs a reality check.

Also suri closes threads once the matter have been attended to, which he will do on his own time