Re: [hlcoders] weapon animation prediction problems, client-side
You checked "cl_predictionlist 1" to see that the weapon was being predicted? The time is supposed to go back on the client. It stores all predicted values over a period of time. When it goes back in time, it restores the values to what they were at that time. If you have a value that is important and needs to be restored when going back in time, it needs to be put in the prediction table. I would check that your variables have been put in the prediction table and setup correctly. I can't be anymore specific because I don't understand what you're doing in terms of animation. You need to do all animations on the server otherwise the player hitboxes aren't going to match up. I also wouldn't expect fakelag of 300 to look right even when the code is working perfectly fine. That's what a player with 600 ping plays like. On Tue, Dec 16, 2008 at 3:38 AM, Michael Chang wrote: > Hi all > > This has been brought up before and I don't think the details of "fixing it" > has ever been fully disclosed. I think I'm running exactly into this problem > as described by Tony Sergi from 2007 > > http://www.opensubscriber.com/message/hlcoders@list.valvesoftware.com/6392737.html > >> Hey guys, I'm having a bit of a prediction issue with weapon code. >> >> Basically what's happening is, when you're lagged out (real, or >> net_fakelag) >> the client seems to be calling ItemPostFrame multiple times a frame, >> instead >> of just once. >> This is causing my weapons to fire a random amount of times more, on the >> client, than they should. >> >> Has anyone else encountered this? gpGlobals->curtime as per usual is being >> tested, and when I DevMsg the fire sequence, the multiple fire times are >> indeed using the exact same time. >> >> I would like to fix this, as quickly as possible without a gross hack. >> >> Thanks >> >> -- >> -omega >> -- . > > > > Yahn's answer was a big clue, to test if it's the first time you're > predicting this thing on client, and if so.. do whatever you're supposed to > do.. otherwise ignore the method. > > This is the way prediction works, the client "resimulates" all of the >> CUserCmds since the last ack'd one. For debugging this stuff, it's best >> to turn cl_pred_optimize to 0 and you'll always do the full reprediction >> every frame. >> >> When you trigger client side only effects in weapons, you should only do >> them the first time a CUserCmd is predicted. You should use something >> like this: >> >> #if defined( CLIENT_DLL ) >> // during prediction play footstep sounds only once >> if ( prediction->InPrediction() && >> !prediction->IsFirstTimePredicted() ) >> return; >> #endif >> >> To deal with such cases. >> >> Yahn >> > > > > Ofcourse this applies to client-side-only stuff that should play once, like > client-side-only animation. This applies to us because we've decided to make > all player-animations client-side-only for local players. > > Without further-ado, here's my problem, demonstrated in video-form. > http://www.ghost-hack.com/berimbau/prediction_problem.avi > > In the video, the first two times I swing I had 0 lag (listen server). Next > third and fourth time I swing, I turned on net_fakelag 300. You see the > problem > > We have a weapon controlling the player animation. The weapon fires 3 > times, resets itself (wait time), and then fires 3 times again, etc while > holding IN_ATTACK. > > The following print-out reveals the bizarre problem. > (Swingcount controls the player animation as well as the > m_flNextPrimaryAttack.) > > > Client predicts the attack message: > > client is attacking at 99.284996 > client has enough stamina true with swingcount: 0 > client incrementing swingcount to... 1 > client stance: 0, direction: 0, swingcount: 1 > client time: 99.284996, firerate: 0.30 > > Server gets it, and things are good > > server is attacking at 99.284996 > server has enough stamina true with swingcount: 0 > server incrementing swingcount to... 1 > server stance: 0, direction: 0, swingcount: 1 > server time: 99.284996, firerate: 0.30 > client is attacking at 99.584999 > > > Did client get the message yet? Swingcount is still 1! > > client has enough stamina true with swingcount: 0 > client incrementing swingcount to... 1 > client stance: 0, direction: 0, swingcount: 1 > client time: 99.584999, firerate: 0.30 > > > Already something here goes terribly wrong. Even though swingcount updates > (networked) with the msg "client incrementing swingcount to ...", the client > weapon re-simulates itself using ItemPostFrame 0.3 seconds later. > > > server is attacking at 99.584999 > server has enough stamina true with swingcount: 1 > server incrementing swingcount to... 2 > server stance: 0, direction: 0, swingcount: 2 > server time: 99.584999, firerate: 0.30 > > > We get a notification here from the server. So far the client is one swing > count behind, which gets corrected in the following: > > > client is attacking at 99.584999 > client has enough stamina tr
[hlcoders] weapon animation prediction problems, client-side
Hi all This has been brought up before and I don't think the details of "fixing it" has ever been fully disclosed. I think I'm running exactly into this problem as described by Tony Sergi from 2007 http://www.opensubscriber.com/message/hlcoders@list.valvesoftware.com/6392737.html > Hey guys, I'm having a bit of a prediction issue with weapon code. > > Basically what's happening is, when you're lagged out (real, or > net_fakelag) > the client seems to be calling ItemPostFrame multiple times a frame, > instead > of just once. > This is causing my weapons to fire a random amount of times more, on the > client, than they should. > > Has anyone else encountered this? gpGlobals->curtime as per usual is being > tested, and when I DevMsg the fire sequence, the multiple fire times are > indeed using the exact same time. > > I would like to fix this, as quickly as possible without a gross hack. > > Thanks > > -- > -omega > -- . Yahn's answer was a big clue, to test if it's the first time you're predicting this thing on client, and if so.. do whatever you're supposed to do.. otherwise ignore the method. This is the way prediction works, the client "resimulates" all of the > CUserCmds since the last ack'd one. For debugging this stuff, it's best > to turn cl_pred_optimize to 0 and you'll always do the full reprediction > every frame. > > When you trigger client side only effects in weapons, you should only do > them the first time a CUserCmd is predicted. You should use something > like this: > > #if defined( CLIENT_DLL ) > // during prediction play footstep sounds only once > if ( prediction->InPrediction() && > !prediction->IsFirstTimePredicted() ) > return; > #endif > > To deal with such cases. > > Yahn > Ofcourse this applies to client-side-only stuff that should play once, like client-side-only animation. This applies to us because we've decided to make all player-animations client-side-only for local players. Without further-ado, here's my problem, demonstrated in video-form. http://www.ghost-hack.com/berimbau/prediction_problem.avi In the video, the first two times I swing I had 0 lag (listen server). Next third and fourth time I swing, I turned on net_fakelag 300. You see the problem We have a weapon controlling the player animation. The weapon fires 3 times, resets itself (wait time), and then fires 3 times again, etc while holding IN_ATTACK. The following print-out reveals the bizarre problem. (Swingcount controls the player animation as well as the m_flNextPrimaryAttack.) Client predicts the attack message: client is attacking at 99.284996 client has enough stamina true with swingcount: 0 client incrementing swingcount to... 1 client stance: 0, direction: 0, swingcount: 1 client time: 99.284996, firerate: 0.30 Server gets it, and things are good server is attacking at 99.284996 server has enough stamina true with swingcount: 0 server incrementing swingcount to... 1 server stance: 0, direction: 0, swingcount: 1 server time: 99.284996, firerate: 0.30 client is attacking at 99.584999 Did client get the message yet? Swingcount is still 1! client has enough stamina true with swingcount: 0 client incrementing swingcount to... 1 client stance: 0, direction: 0, swingcount: 1 client time: 99.584999, firerate: 0.30 Already something here goes terribly wrong. Even though swingcount updates (networked) with the msg "client incrementing swingcount to ...", the client weapon re-simulates itself using ItemPostFrame 0.3 seconds later. server is attacking at 99.584999 server has enough stamina true with swingcount: 1 server incrementing swingcount to... 2 server stance: 0, direction: 0, swingcount: 2 server time: 99.584999, firerate: 0.30 We get a notification here from the server. So far the client is one swing count behind, which gets corrected in the following: client is attacking at 99.584999 client has enough stamina true with swingcount: 1 client incrementing swingcount to... 2 client stance: 0, direction: 0, swingcount: 2 client time: 99.584999, firerate: 0.30 Client goes on to predict the next attack 0.3 seconds later client is attacking at 99.92 client has enough stamina true with swingcount: 2 client incrementing swingcount to... 3 client stance: 0, direction: 0, swingcount: 3 client time: 99.92, firerate: 0.80 Okay WTF Client GOES BACK IN TIME HERE and resimulates at swingcount 1. And for the next few steps, it immediately increments swingcount multiple times. client is attacking at 99.584999 client has enough stamina true with swingcount: 1 client incrementing swingcount to... 2 client stance: 0, direction: 0, swingcount: 2 client time: 99.584999, firerate: 0.30 client is attacking at 99.92 client has enough stamina true with swingcount: 2 client incrementing swingcount to... 3 client stance: 0, direction: 0, swingcount: 3 client time: 99.92, firerate: 0.80 client is attacking at 99.974998 client has enough st
Re: [hlcoders] weapon animation.
-- [ Picked text/plain from multipart/alternative ] http://download.yousendit.com/0AD10E412B8EAC0B .qc file inside... By the way, I am using HL2SP Mod. On 1/17/08, Tobias Kammersgaard <[EMAIL PROTECTED]> wrote: > > -- > [ Picked text/plain from multipart/alternative ] > Post your QC file. > > /ProZak > > > On 16/01/2008, Alvin Ng <[EMAIL PROTECTED]> wrote: > > > > -- > > [ Picked text/plain from multipart/alternative ] > > I'm using my own custom model and i can get the range attack a.k.apistol > > and such animation working, however the melee animation seems to > > be missing > > and no mater how i edit the codes it doesn' seem to make the melee > > animation > > work. anybody have any idea with whats wrong with it? when i get close > to > > the wall and the crowbar hits the wall.the crowbar would shake and the > > player body would move abit, but thats all i get, it doesn run the > > animation > > that was assign to it. anybody has any help. > > -- > > > > ___ > > To unsubscribe, edit your list preferences, or view the list archives, > > please visit: > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > -- > > ___ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > -- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] weapon animation.
-- [ Picked text/plain from multipart/alternative ] Post your QC file. /ProZak On 16/01/2008, Alvin Ng <[EMAIL PROTECTED]> wrote: > > -- > [ Picked text/plain from multipart/alternative ] > I'm using my own custom model and i can get the range attack a.k.a pistol > and such animation working, however the melee animation seems to > be missing > and no mater how i edit the codes it doesn' seem to make the melee > animation > work. anybody have any idea with whats wrong with it? when i get close to > the wall and the crowbar hits the wall.the crowbar would shake and the > player body would move abit, but thats all i get, it doesn run the > animation > that was assign to it. anybody has any help. > -- > > ___ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > -- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
[hlcoders] weapon animation.
-- [ Picked text/plain from multipart/alternative ] I'm using my own custom model and i can get the range attack a.k.a pistol and such animation working, however the melee animation seems to be missing and no mater how i edit the codes it doesn' seem to make the melee animation work. anybody have any idea with whats wrong with it? when i get close to the wall and the crowbar hits the wall.the crowbar would shake and the player body would move abit, but thats all i get, it doesn run the animation that was assign to it. anybody has any help. -- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
[hlcoders] Weapon animation events
This is a multi-part message in MIME format. -- [ Picked text/plain from multipart/alternative ] Hi everyone, How are weapon animation events properly meant to be used? I have a sequence with an event on a model, the QC line is: $sequence swing "v_human_shortsword_swing" activity ACT_VM_MISSCENTER 1 fps 20 { frames 11 20 } { event 3003 3 } the event code is for EVENT_WEAPON_MELEE_SWISH. Then in the Operator_HandleAnimEvent function in my weapon code, i added a case for that event. I decided in that case to set a bool to true, so that in the postframe function, i can see that the event had occurred, and go from there. however, strange things happenned, it seemed as though the bool were set, but also as if that didnt matter in the functions which were then called from the postframe function. my guess is im using the events in an inproper fashion, any suggestions as to what im doing wrong? Thanks, l3fty -- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
RE: [hlcoders] Weapon animation
Title: Message what freaking retard I am ;) would help if I renamed the bleeping enum as well ;) enum handgrenade_e { blah }; -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Yacketta, RonaldSent: Tuesday, January 22, 2002 6:38 AMTo: [EMAIL PROTECTED]Subject: RE: [hlcoders] Weapon animation I am only having this with custom weapons, that is take an existing HL weapon and basicly rename it tis all.. same functionality etc.. just different enum/define/class names etc... I have tried it with 4 weapons so far, each and everyone works as is (stock hl), once you copy/paste the entire .cpp into another file do some minor name changes (for compile / duplication issues) they never work again :( -Ron -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of CortexSent: Tuesday, January 22, 2002 2:03 AMTo: [EMAIL PROTECTED]Subject: Re: [hlcoders] Weapon animation I've got the same problems whith _all_ the weapons :( Sometimes, their animations are not played... I don't know what could cause this... CortexHL Albator coder & mapperwww.hlalbator.fr.stICQ : 71548738 - Original Message - From: Yacketta, Ronald To: [EMAIL PROTECTED] Sent: Monday, January 21, 2002 10:59 PM Subject: [hlcoders] Weapon animation Folks,Have a slight problem here, adding a new grenade type ( Based 100% fromthe current handgrenade.cpp )I made several changes to only allow a player to have one grenades at atime (default give is 1 as well as max_carry is 1)The grenade functions (for now) like a normal handgrenade, with oneexception the weapon animations are not playing. I am unable to get anyanimations from the pinpull on to work :( would this be a result of onlyallowing a player to one at a time?I removed checks for ( m_pPlayer->m_rgAmmo[ m_iPrimaryAmmoType ] > 0)in PrimaryAttack etc..Any ideas?Regards,Ron___To unsubscribe, edit your list preferences, or view the list archives, please visit:http://list.valvesoftware.com/mailman/listinfo/hlcoders
RE: [hlcoders] Weapon animation
Title: Message I am only having this with custom weapons, that is take an existing HL weapon and basicly rename it tis all.. same functionality etc.. just different enum/define/class names etc... I have tried it with 4 weapons so far, each and everyone works as is (stock hl), once you copy/paste the entire .cpp into another file do some minor name changes (for compile / duplication issues) they never work again :( -Ron -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of CortexSent: Tuesday, January 22, 2002 2:03 AMTo: [EMAIL PROTECTED]Subject: Re: [hlcoders] Weapon animation I've got the same problems whith _all_ the weapons :( Sometimes, their animations are not played... I don't know what could cause this... CortexHL Albator coder & mapperwww.hlalbator.fr.stICQ : 71548738 - Original Message - From: Yacketta, Ronald To: [EMAIL PROTECTED] Sent: Monday, January 21, 2002 10:59 PM Subject: [hlcoders] Weapon animation Folks,Have a slight problem here, adding a new grenade type ( Based 100% fromthe current handgrenade.cpp )I made several changes to only allow a player to have one grenades at atime (default give is 1 as well as max_carry is 1)The grenade functions (for now) like a normal handgrenade, with oneexception the weapon animations are not playing. I am unable to get anyanimations from the pinpull on to work :( would this be a result of onlyallowing a player to one at a time?I removed checks for ( m_pPlayer->m_rgAmmo[ m_iPrimaryAmmoType ] > 0)in PrimaryAttack etc..Any ideas?Regards,Ron___To unsubscribe, edit your list preferences, or view the list archives, please visit:http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Weapon animation
I've got the same problems whith _all_ the weapons :( Sometimes, their animations are not played... I don't know what could cause this... CortexHL Albator coder & mapperwww.hlalbator.fr.stICQ : 71548738 - Original Message - From: Yacketta, Ronald To: [EMAIL PROTECTED] Sent: Monday, January 21, 2002 10:59 PM Subject: [hlcoders] Weapon animation Folks,Have a slight problem here, adding a new grenade type ( Based 100% fromthe current handgrenade.cpp )I made several changes to only allow a player to have one grenades at atime (default give is 1 as well as max_carry is 1)The grenade functions (for now) like a normal handgrenade, with oneexception the weapon animations are not playing. I am unable to get anyanimations from the pinpull on to work :( would this be a result of onlyallowing a player to one at a time?I removed checks for ( m_pPlayer->m_rgAmmo[ m_iPrimaryAmmoType ] > 0)in PrimaryAttack etc..Any ideas?Regards,Ron___To unsubscribe, edit your list preferences, or view the list archives, please visit:http://list.valvesoftware.com/mailman/listinfo/hlcoders
[hlcoders] Weapon animation
Folks, Have a slight problem here, adding a new grenade type ( Based 100% from the current handgrenade.cpp ) I made several changes to only allow a player to have one grenades at a time (default give is 1 as well as max_carry is 1) The grenade functions (for now) like a normal handgrenade, with one exception the weapon animations are not playing. I am unable to get any animations from the pinpull on to work :( would this be a result of only allowing a player to one at a time? I removed checks for ( m_pPlayer->m_rgAmmo[ m_iPrimaryAmmoType ] > 0) in PrimaryAttack etc.. Any ideas? Regards, Ron ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders