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 7 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.

insthync commented 8 months ago

When is its end :(

Eniotnacram commented 8 months ago

When is its end :(

I know brotha, I am so sorry, seems so hard to find the perfect way to make it work :(

There is a video of the problem if needed: https://medal.tv/games/requested/clips/1BAElImV3ZiPdT/d1337zzvIaLz?invite=cr-MSxrSzUsNDQ3NDMxODYs

insthync commented 8 months ago

Hmm.. it should hit because the missile is move straightly

Eniotnacram commented 8 months ago

Hmm.. it should hit because the missile is move straightly

Yea.. and the missile directly hit the enemy too. May be related to the speed of the missile? It's at 100. Slower missile seems to do damage more often, speed of 70.

Just to mension, but i was using 1.85b3 before updating to 1.85c3, and I did not have that problem before updating. I also have not modified nothing related to the missile entity, damage or what ever.

insthync commented 8 months ago

Yes, maybe

Eniotnacram commented 8 months ago

Have you any other suggestion for me? Bigger Damageable hitbox? Use projectile entity instead? Increase server FPS?

insthync commented 8 months ago

I have to fix it, I have to test it first, so I want to ask about your setting, are you using Missile Damage Entity with 100 speed?

Eniotnacram commented 8 months ago

Yes this is my Missile entity setting, 100 speed, using raycast, with a sphere collider on it (is trigger on) and a rigid body. Same setup as the (fire bolt) from the kit, but with more speed. (Using shooter controller)

insthync commented 8 months ago

Hey, missile damage entity and raycast are not the same kind of damage, not sure that it actually is raycast damage?

This one (1)

Screenshot_926

or (2)

Screenshot_927

Eniotnacram commented 8 months ago

I use missile, I mean using raycast on the damage entity, instead of sphere raycast or box raycast

insthync commented 8 months ago

Ahh, I see.

Eniotnacram commented 8 months ago

On my end, the missile does damage very fine when the enemy is far, but when the enemy is closer and closer to the player, the worst the damage is getting applied.

I would need some explanation for the damage entity.

Why we can add a collider OR not in it? What is the utility of the collider in that situation?

Eniotnacram commented 8 months ago

I also did test in fresh KIT MMO. Using the archer character and the same problem occur. Speed up the weapon type missile speed to 100 and 80% of hits doesnt do damage.

https://medal.tv/games/requested/clips/1BGxrj3CrfCZr9/d1337T80khh3?invite=cr-MSxnV1IsNDQ3NDMxODYs

Eniotnacram commented 8 months ago

Yea, after while and while of testing, it works REALLY GOOD using the ProjectileDamageEntity instead of the MissileDamageEntity. Hits always deal damage using the ProjectileDamageEntity. So its probably some logic in the MissileDamageEntity that makes it not work properly. Also, being able to specify the layermask in the ProjectileDamageEntity may be helping. (Also something really important is to remove the sphere collider on that damage entity because this will interfere with the hitbox.

Note that because im using the layer mask of the ProjectileDamageEntity, i have removed all layers from the AttackObstacleLayers from the GameInstance and also the IgnoreRaycastLayers.

The prediction step per frame from the ProjectileDamageEntity may be the reason why it is working.

So what should we do? I think we should investigate whats different in the ProjectileDamageEntity from the MissileDamageEntity. And modify the MissileDamageEntity accordingly.

Also important note, CLEARLY, the sphere collider should NOT be added to any DamageEntity.

@insthync

moepi2k commented 8 months ago

there is no collider on it, the new version of it dont need it anymore. i think u have old prefab in ur project. even stock kit dont have collider attached

unitys physic detectection when using collider is really bad with high speed.

Eniotnacram commented 8 months ago

there is no collider on it, the new version of it dont need it anymore. i think u have old prefab in ur project. even stock kit dont have collider attached

unitys physic detectection when using collider is really bad with high speed.

Looks at some, I don't remember which one, but some does have a collider in fresh kit. I think one variation of the arrow does or the fire bolt entity.

But yea glad I know now that we don't need them. But still missile entity is broken real bad using latest kit version. And it works flawlessly using the projectile entity, just need to understand why I guess

insthync commented 8 months ago

It is having speed hack detection added, you may try delete it in MissileDamageInfo -> IsHitValid function, and test it.

Eniotnacram commented 8 months ago

But the Projectile Damage Entity is using the "MissileDamageInfo" right? And it works fine using it. So I dont think the speed hack detection is faulty

insthync commented 8 months ago

Did you try to delete it? Just do what I've told you. If you want to help me to test it, or just tell me that you won't.

That Projectile Damage Entity has different updating.

xnitro1 commented 8 months ago

What exactly should he delete? Because i have the same problem and after reading this thread, i havent understood what to delete

insthync commented 8 months ago

Codes in IsHitValid function

Eniotnacram commented 8 months ago

Did you try to delete it? Just do what I've told you. If you want to help me to test it, or just tell me that you won't.

That Projectile Damage Entity has different updating.

@insthync Well, with the different updating from the "Projectile Damage Entity" it works very fine. So i think we should simply use the Projectile Damage Entity updating logic in the Missile Damage Entity. It would fix the problem and the Missile Damage Entity would work properly.

But yea, WITHOUT the speed hack in MissileDamageInfo, it works PERFECTLY

    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;

        // The check for speed hack detection removed

        return true;
    }
insthync commented 8 months ago

I think if the problem is speed hack detection, then I think I have to fix speed hack detection, not apply Projectile Damage Entity updating logic to Missile Damage Entity, why do you think I should do that?

Eniotnacram commented 8 months ago

Because it works perfectly using the "Projectile Damage Entity", with the new "speed hack detection" so maybe the "Missile Damage Entity" should simply be updated to work using the new "speed hack detection". You are the PRO here tho, dont take my words, if you think its better to adjust the "speed hack detection" then let's do it.

But yea, I made it work using the "Projectile Damage Entity", so in my head, the "Missile Damage Entity" was faulty. (not updated to work with the new speed hack)

insthync commented 8 months ago

Then try Missile Damage Entity

xnitro1 commented 8 months ago

mh for me its still not working. my missiles are not hitting at all in a certain distance. but maybe i´ll have another problem not related to this

Eniotnacram commented 8 months ago

mh for me its still not working. my missiles are not hitting at all in a certain distance. but maybe i´ll have another problem not related to this

what you mean by not hiting at all? going trough the monsters?

xnitro1 commented 8 months ago

yeah its going through i think: https://streamable.com/lg9us2 when the enemy is not that far away, it seems to work. but when he has quite the distance, its not working anymore. but maybe thats another problem on my side and has nothing todo with this anymore (i used your code from above, that atleast seemed to fix it when the monster is not that far away)

Eniotnacram commented 8 months ago

yeah its going through i think: https://streamable.com/lg9us2 when the enemy is not that far away, it seems to work. but when he has quite the distance, its not working anymore. but maybe thats another problem on my side and has nothing todo with this anymore (i used your code from above, that atleast seemed to fix it when the monster is not that far away)

yea looks like a problem on your end, are you using the projectile damage entity? you need to set the hit layer

insthync commented 8 months ago

@Eniotnacram Did you try Missile Damage Entity with speed hack detection removed?

@xnitro1 Seems like it is a different problem, the problem here is it hit then it told the server that it was hit but the server didn't trust the client, your problem is it doesn't hit at all, both the client and server, you must check enemy's hitboxes, may debugging by add debug.log() codes to MissileDamageEntity -> HitDetect function when it is hitting.

Eniotnacram commented 8 months ago

@Eniotnacram Did you try Missile Damage Entity with speed hack detection removed?

@xnitro1 Seems like it is a different problem, the problem here is it hit then it told the server that it was hit but the server didn't trust the client, your problem is it doesn't hit at all, both the client and server, you must check enemy's hitboxes, may debugging by add debug.log() codes to MissileDamageEntity -> HitDetect function when it is hitting.

YES! @insthync i did, it works! When the speed hack detection is removed the Missile Damage Entity works perfectly.

https://github.com/suriyun-production/mmorpg-kit-docs/issues/2300#issuecomment-1792523347

insthync commented 8 months ago

@Eniotnacram Okay, so both MissileDamageInfo and ProjectileDamageEntity works perfectly if speed hack detection removed, right?

Eniotnacram commented 8 months ago

@insthync ProjectileDamageEntity works well even without removing the hack detection from MissileDamageInfo. MissileDamageEntity needs hack detection removed to work properly.

So that's why I was tempted to try using the logic from the ProjectileDamageEntity in the MissileDamageEntity, because it was working well without removing the hack detection.

xnitro1 commented 8 months ago

@Eniotnacram Did you try Missile Damage Entity with speed hack detection removed?

@xnitro1 Seems like it is a different problem, the problem here is it hit then it told the server that it was hit but the server didn't trust the client, your problem is it doesn't hit at all, both the client and server, you must check enemy's hitboxes, may debugging by add debug.log() codes to MissileDamageEntity -> HitDetect function when it is hitting.

i hope the quality of the video gets better when its processed: https://streamable.com/00gcj9

i tried the Debug.Log and yes i can see that i hit the enemy, but its not recognized. in the video i hit the enemy serveral times but nothing happens. maybe its not another problem? i dont know :D

(those errors are just from the attack indicator on the client, nothing to do with the KIT)

insthync commented 8 months ago

@insthync ProjectileDamageEntity works well even without removing the hack detection from MissileDamageInfo. MissileDamageEntity needs hack detection removed to work properly.

So that's why I was tempted to try using the logic from the ProjectileDamageEntity in the MissileDamageEntity, because it was working well without removing the hack detection.

But the problem is occurring because of speed hack detection, isn't it ?

Eniotnacram commented 8 months ago

@insthync ProjectileDamageEntity works well even without removing the hack detection from MissileDamageInfo. MissileDamageEntity needs hack detection removed to work properly. So that's why I was tempted to try using the logic from the ProjectileDamageEntity in the MissileDamageEntity, because it was working well without removing the hack detection.

But the problem is occurring because of speed hack detection, isn't it ?

Yes I would say so, without the hack detection, Default Missile Damage Entity works fine

insthync commented 8 months ago

@Eniotnacram It works by client tell server when to play animation and launch damage entity, then client do hit detection, then when it is hit client tell server that it is hit. All done by client, server just do speed hack detection.

So, that is why it won't be fixed by use updating logic from ProjectileDamageEntity if problem is speed hack detection

insthync commented 8 months ago

@Eniotnacram Did you try Missile Damage Entity with speed hack detection removed? @xnitro1 Seems like it is a different problem, the problem here is it hit then it told the server that it was hit but the server didn't trust the client, your problem is it doesn't hit at all, both the client and server, you must check enemy's hitboxes, may debugging by add debug.log() codes to MissileDamageEntity -> HitDetect function when it is hitting.

i hope the quality of the video gets better when its processed: https://streamable.com/00gcj9

i tried the Debug.Log and yes i can see that i hit the enemy, but its not recognized. in the video i hit the enemy serveral times but nothing happens. maybe its not another problem? i dont know :D

(those errors are just from the attack indicator on the client, nothing to do with the KIT)

Why in the first video I saw it pass through the enemy? is it a server-view?

If it is client then when it is hit, it should exploded and disappear isn't it ?

xnitro1 commented 8 months ago

It's just not the fireball from the kit. It's another prefab with another sfx effect. But it's still a missile prefab. In the first video I found the error. The missiles were under the enemy at a certain range. After fixing this I hit the enemy on any distance (that's the debug.log). But the damage is not happening. But the missile is disappearing after the hit.

insthync commented 8 months ago

So in the first video it is not relates to problem in this post, right?

xnitro1 commented 8 months ago

Correct. I thought it was, but it wasn't. But the problem now could be (but maybe not. I am not the pro here :D ). All I can say that the client says he hit the target but nothing happens

insthync commented 8 months ago

Did I ask for a PRO here?

xnitro1 commented 8 months ago

I don't know what you mean by that. I was just stating that my knowledge is not the best and by far not as good as yours.

insthync commented 8 months ago

I see, so please don't comment anything that I didn't ask, okay?

insthync commented 8 months ago

@xnitro1 Did you rebuild a server, to test it after hit detection codes removed?

xnitro1 commented 8 months ago

yes.

Eniotnacram commented 8 months ago

@Eniotnacram It works by client tell server when to play animation and launch damage entity, then client do hit detection, then when it is hit client tell server that it is hit. All done by client, server just do speed hack detection.

So, that is why it won't be fixed by use updating logic from ProjectileDamageEntity if problem is speed hack detection

Ok I do understand. So for some reason, the server is accepting the data from the ProjectileDamageEntity but not from the MissileDamageEntity when speed hack is enabled. Maybe the ProjectileDamageEntity give more precise data to the server so the speed hack accept it?

insthync commented 8 months ago

Do you really want to know? If yes, then I think I have to write a document, Should I write a document to explain or fix it first? Fix it might be easier by just change that 3 lines of calculation codes.

Eniotnacram commented 8 months ago

Do you really want to know? If yes, then I think I have to write a document, Should I write a document to explain or fix it first? Fix it might be easier by just change that 3 lines of calculation codes.

I dont need to know, you can fix it, dont worry :)

Callepo commented 8 months ago

hmm Tested Missiles, with latest Pull from Repo, in mmo, using Bow and MissileDamageEntity. I didnt miss a single time when attacking Used literally all the 100 bullets in my inventory https://github.com/suriyun-production/mmorpg-kit-docs/assets/7702658/3b390be5-2b0f-4a94-bb22-e2f9d64ae945

And this is raycast With Guns

https://github.com/suriyun-production/mmorpg-kit-docs/assets/7702658/306c5bd8-e502-4bf0-b3bd-6764bca61f92

Ive never seen the kit more accurate than this lol.. Raycasting use to be u hit once every 50 shots..

This is old Raycasting.. Compare the 2 together urself lol https://github.com/suriyun-production/mmorpg-kit-docs/assets/7702658/3e2fb01d-3dc8-4a8b-8ebc-35396a515bc2

This is old Missile before the MissileDamageInfo https://github.com/suriyun-production/mmorpg-kit-docs/assets/7702658/151771a2-c1af-49b6-b5d0-098f0ba637f4