Bug Minor regen saves a person from death

Discussion in 'General Archive' started by sebastian_fl, Jan 18, 2016.

Dear forum reader,

if you’d like to actively participate on the forum by joining discussions or starting your own threads or topics, please log into the game first. If you do not have a game account, you will need to register for one. We look forward to your next visit! CLICK HERE
Thread Status:
Not open for further replies.
  1. sebastian_fl

    sebastian_fl Count Count

    So here is an annoying bug I'm sure everyone saw.

    Eventually, you will hit the low HP character with tons of damage, so his HP must have been already way below zero, like -5000, but he survives in some cases.

    That is hard to reproduce, as the case is uncommon, but here is why and how it happens.

    Apparently, the game is designed the way it decides whether character is dead once per every game frame, or sequence number, or some fraction of game time, whatever you guys call it. It could be happening 60 times per second for example.

    So what happens is if the damage received in the same frame character get his regen out of a skill, gem, an item or whatever, he will survive no matter what the damage is and my guess is that happens because that isDead function is being called at the and of the frame, and the order of receiving damage and healing is following in the hypothetical function
    _processFrame() {
    // Comment: character HP is 100 right now
    Call receiveDamage () ->
    HP -= damageReceived;
    // Character should be -4900
    If HP < 0 set HP = 0; // Character HP is set to 0, assuming 0 is dead anyway
    Call receiveHealing ()->
    HP += healing amount;
    // Character HP is now 20, as he got healing out of a ring of life or a skull
    Call checkIdDead () ->
    If HP equals 0 set char is dead.
    // Character survive, as his HP was 20 at the moment of a check.

    To fix this you need to either check if dead before the healing has happened, or change the order of healing and receiving damage, or allow negative hp during the frame time.

    Interesting consiquence of this would be the following example. You play as a mage against a DK. You just killed him and exploding volcanic area appears, that should have killed you with the first explosion, but if it doesnt, the following explosions will not kill you too no matter what is the damage and the fact that your HP is just above zero, as every explosion will happen in sync with healing, once per second and the very same exact frame. So at the end, that mage with 20 HP will survive all 3-4 waves of damage out of that explosion, even though they deal 30k dmg in total.

    Hope it isn't over complicated :)
    Last edited: Jan 18, 2016
    EhtovK likes this.
  2. Zed

    Zed Forum Pro

    Hi thanks for the "coding" explanation. I think everyone has experienced this bug at least once and I don't think someone wants it to be fixed :p it's fun surviving some bosses' final blasts :D
  3. sebastian_fl

    sebastian_fl Count Count

    Dear Mods, this is a separate bug, which has nothing to do with that 'visial' or not issue discussed here. 'My' bug is real :)

    Move it back pls, unless you want to keep all defects related to HP together. This thread isn't even marked as bug.
    Zed likes this.
  4. Mal3ficent

    Mal3ficent Guest

    Does it make a difference? We are forwarding them anyway. :)

    sebastian_fl likes this.
  5. Troneck86

    Troneck86 Forum Great Master

    I guess this explains how I have survived a Heredur swing that deals more than 1k of my base HP.
  6. sebastian_fl

    sebastian_fl Count Count

    Thanks, I was just afraid it will get lost in miscommunication as that 'visual' one is well known and this as a comment might have been skipped :) thanks anyway)
  7. MegaNuker

    MegaNuker Forum Ambassador

    Note sometimes my damage is not displayed on the killing blow. This leads me to think there is a logarithm that does this prior to damage delivery on if they have enough hp to survive the hit.

    Secondly I have seen damage I dealt not be accurately displayed on lightning strike. Lag might make on your side perceive they are in one spot and in actuality they are in a different spot. Plus I have seen where they where not hit at all. I think some of this is due to the server prediction and can been wrong.
  8. BigPapa

    BigPapa Forum Overlooker

    Would this be similar to taking an HP potion having it go into cooldown, but dying anyway before it takes effect. Or, is that a client side lag issue?
    Darwarren and sebastian_fl like this.
  9. sebastian_fl

    sebastian_fl Count Count

    Quite similar. Nothing to do with the lag. Might be not exactly the same, as there isnt a requirement to be in the same frame. Guess we talk about a number of frames, perhaps the number of frames the value of ALLOW-INTERRUPTION is set to on rhe action of taking the elixir. It could be 4-10-20 frames, whatever number they set, so the odds are elixir and other skills cooldown issue should be much more common.

    There are a bunch of other issues with frames, like the debuff skill not canceling the burning effect.

    To add more details into the elixir, it should work like this. And any other action too.

    1. Action takes some number of 'frames'. N.
    2. Action could be interrupted before some number of frames passed since action began, otherwise it is in effect. I.
    3. Action cooldown is triggered at some frame C.

    the issue with elixirs would happen if C is less than I. e.g. Potion takes N=10 frames, becomes effective after I=10 frames. Cooldown is triggered at Frame C=4.

    Out of 60 frames per second, there is a (10-4)/60 = 10% chance the elixir will not be used but the cooldown will trigger.

    Disclaimer. Numbers are taken out of sky, and the explanation is also just my best SWAG :)

    Btw, those defects should be caught by Dev testing routine. They are way too random for the QA testing of any type. Dev should think of the 'extreme' scenarious and simulate them with mocked data.

    Theoretically, or speculatively, one could be completely immortal to a mob that deals damage with the period of exactly 1 second if player's healing is in sync with mob damage. You would just stay in front of Mortis with 10hp, receive 10k dmg and still survive every hit. But guess it isn't that simple, you would be always out of sync as regen starts, I assume, the next frame after you received some damage, so you will be let's say 1 frame late, or 59 frames late.

    Not sure how could that happen with Heredur. There are 4 scenarious I could think of
    1. Heredur doesn't necessarily hit ones per second. If he is than:
    2. Heredur's walking makes a shift
    3. You received dmg of something else (not possible with heredur). Or maybe possible, that something he throws at you might have hit you exactly on time.
    4. You appeared on the map with less than full hp, so your regen was already active, and you summoned heredur just in time.

    No matter what, defect is there, and it creates more issues in pvp than pve, and it would be hard to abuse it. But would be funny to test, on some noob mob :)
    Last edited: Jan 19, 2016
  10. MegaNuker

    MegaNuker Forum Ambassador

    Please note.
    All data on the sever side is not based on frames. Client side only is based on frames, because it has to be rendered for us to see. Any thought about frames will be client side. Now your frames and my frames ate not in sync by anything on the server either.
  11. sebastian_fl

    sebastian_fl Count Count

    All clients and the server are in complete precise sync the sequence#/frame#. It would a complete mess if they were not.
  12. MegaNuker

    MegaNuker Forum Ambassador

    No a server does not sync with the client. There is a packet delay for the information. The father you are from the sever the longer the packet exchange is. The server has timeouts for replies this is know as time to live or TTL but other than that it just serves out data and processes info back to us. When you have alot of lag you can see you get hit but no mob is around. This is due to the server telling the client they received damage but you do not see who hit you. Sequence numbers are for packet exchange. Client will refuse packet 19 after processing packet 20. UDP can handle out of order packets where as TCP can not.
  13. sebastian_fl

    sebastian_fl Count Count

    as I started reading, wanted to immediately reply UDP doesnt care about not replying, but apparently you know how UDP works). So, what you wrote just supports what I said. Client and Server are in sync, and Server is autocratic, and even if there is any lag with an individual client, he will get in sync again after the exchange has happened, and the client will be rolled back in case of collision. but, at the same time, even if packets didnt go through (yet), client and server operate with the same seq# and the same frame#. Assuming client sends server a notice 'I have started the action on frame #333 or seq# 4400', but the packet was received when current seq# is already 4450 (or plus 3 frames), server will still proceed with the action, with a shift, server will skip the frames already passed and order the other clients to do the same. at the end
    1. action by client A will start right away no matter lag, as his predictive client can 'predict' his own action.
    2. server will start the same action, if no collision, with some delay (few frames that last some specific number of seq#), but the action will end at the very same time.
    3. other clients will start the action with even more delay, but they will also skip those delayed frames and finish the action together, in sync with everyone else.

    this is how latency compensation works.

    and back to your original remark. you are right that the term 'frame' is a client side term, but whatever it is, there is a Unit on the server which is related to Frame (Frame at the end will have a number of those units), and that Unit is also related to Seq#, and all clients and the server are in complete sync about the # of Unit currently active.

    They are 'out of sync' in terms of client only predicting what is going to happen. Client will start any action no matter what without waiting for OKAY from the server, but rather notifying server post-factum, and asking if the an action might be continued rather than if action might be started. So during those frames, when the client A has just started his action, and the Client B has just started his own action, they are out of sync in terms of what users see on the screen (because their client cannot predict actions by other clients without any data), but they will get back in sync very soon. and what is important both clients are running the same Unit# despite seeing different picture.
  14. MegaNuker

    MegaNuker Forum Ambassador

    What I think your trying to get at would be a procedure call. Not sure a regen would keep someone from dieing. The RPC in the Software control would save this from makeing an error in propagation and calling of the procedures. In this game the term is event. Event takes place adds hp but if the hp is 0 event is canceled. A user will see interrupted if the event was taken in response to his action. A regen is a server side event and happens during a process loop. Damage is calculated and determined if it was a killing blow. Once this happens all events are cancled.
  15. sebastian_fl

    sebastian_fl Count Count

    Well, we know none of above. I doubt we can talk about control at all. What control? And what procedure call? I doubt we can talk at such detail level.

    What we do know, the regen is not the server side only event. Nothing in the game is. Every client does regen by itself, and so does the server at the same time for the mirror character on the server. The server, however, requests the client to rollback his action in case of collision/interruption. If that worked well, my client wants to do regen, so it does, so does server but collision should happen on the server, requesting me to roll it back, receive dmg and die. In other words server should tell me I'm dead and regen didn't help, but it does not.

    Read 'What every programmer needs to know about game networking' by Gaffer, so we on the same page of what is latency compensation arcitecture with fat predictive client and autocratic server.

    Buy anyway, there is a bug, and it doesn't matter what causes it, is it the function to process frame, or is it some listener that should not have received some event, whatever. They have the code so should fix it)
  16. MegaNuker

    MegaNuker Forum Ambassador

    Everything in the game that effects our toons is server side only. Reason for this is people can write programs to give you unlimited...

    This can bee seen when dailies pop. You have to wait til you change maps to see them. The client only displays the data from the server. This not like a consol game where you have an off-line version of a game running with a server this game literally exists on the server Heredure and on server Agathon. All the items you have are kept on that server. Clients do some work but all the work it does is visual. You can see this when you have lag and get hit with invisible monsters. I mostly get kilt because of the rubber band effect. Where you jump out of the way of something and bounce back into it and die.
  17. sebastian_fl

    sebastian_fl Count Count

    Read the article. It was like that before 1998 or somethin . Since that time, there isnt a single multiplayer shooter or rpg that works like you wrote. Client does all the work, and so does the server in paralel. Server plays a role of mediator and a judge, to clean-up the collisions. It is done so to compansate the latecy, so it is called latency compensation architecture.

    Given latency, a ping of 300ms or higher, gme would be unplayable. Since the update called QuakeWorld, the world of games changed forever. Since that time, client is built fat, he knows everything and makes ALL desicions on his own (predicts what would happen) and doesn't wait 300ms to start an action. In case client predicted wrong, server will request a rollback.

    Google that article and read so I don't need to copy everything here.

    In a few words, imagine your client has a 500ms delay. So it would take him 1 second to tell the server about an action and hear back from him. It also means he would lag like a crazy.

    So instead of asking the server for a permission, client starts the action right away, notifying the server in parallel. Server will also do that action, and request a client to rollback if smth is wrong. This way noone is impacted by lagged players, as I'm not waiting for you and you are not waiting for me. Every party does the very same frame, and if someone lags like a crazy, it would be only his problem.

    That also means client has to know everything, not only be able to display animations at x,y->. Client knows the physics, client knows what bosses do, etc. Client even predicts other players movement, that is why we sometime see flying characters - char is moving 2-3 yards and then is rolled back to previous position. It happens as your client was predicting his movement, but his client failed to communicate it to the server, so he is forced back.

    If it was like you are describing, lagged player would not move at all.
    Last edited: Jan 20, 2016
  18. MegaNuker

    MegaNuker Forum Ambassador

    I have read his article and it covers multiplayer games. MMORPG are not multiplayer games in a server client mode.

    Google how MMORPG games work it will be the 2nd article. It explains in detail how they operate why the servers have to go down. Will make it more understandable how the Lazer bug happened and about rubber banding. This is more in depth than what I have explained but this is a copulation of authors and is writen from a developer and programers.

    tracyv wilson page 6 or 7
    Last edited: Jan 20, 2016
  19. sebastian_fl

    sebastian_fl Count Count

    Nuker, I'm a developer, I know exactly how the games work, including MMORPG.

    Even Random IS NOT a server side action. That function that decides your dmg, you crit or not, happens on the Client AND the Server. Some functions like loot generation are server side, but the actions by the players happen immediately on the client no matter ping
  20. MegaNuker

    MegaNuker Forum Ambassador

    I am pretty sure your not a developer. You would know some of the terms before posting them. Developers pay the programers...

    Also the PRNG is a server that all servers get the numbers from. That would be the SQRL Data base server would be the ovious choise.
    Last edited: Jan 20, 2016
Thread Status:
Not open for further replies.

Share This Page