Raised This Month: $ Target: $400
 0% 

Why is pev_v_angle so choppy?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jameszhao00
Junior Member
Join Date: Jan 2008
Old 01-05-2008 , 22:26   Why is pev_v_angle so choppy?
Reply With Quote #1

Hi,
I'm recording a player's view vectors and importing them into another application for analysis. Currently I update a list of all the view vectors each server_frame, and when the fire button has been pressed and released, I save it to a file. Although it works, the results are very choppy. Is this an coding error or just how the HL1 engine works?

Also included is a screenshot of vertical viewvec recording's plot. Notice how choppy it is.

Here's my server_frame. recordAngles records the angles to disk.
Code:
//anges stuff
new Float:angles[100][3];
new angleCurrent = 0;
//player stuff
new Players[32]
new playerCount
new inAttack=0;
public server_frame()
{
    get_players(Players, playerCount, "c")
    if(playerCount>0)
    {
        //a human player is in the game
        new playerID = Players[0];
        pev(playerID, pev_v_angle, angles[angleCurrent])
        if(get_user_button(playerID) & IN_ATTACK)
        {
            inAttack=1;    
            
        }
        else if(inAttack ==1)
        {
            //here the attack button has been clicked and released
            //record the data
            recordAngles();
            inAttack=0;
            client_print(playerID, print_chat, "Recorded Aim Vectors");
        }
        angleCurrent++;
        if(angleCurrent > 99)
            angleCurrent=0;
                
    }
}
Thanks,
James
Attached Thumbnails
Click image for larger version

Name:	screenshot.jpg
Views:	152
Size:	13.3 KB
ID:	22760  

Last edited by jameszhao00; 01-05-2008 at 22:29.
jameszhao00 is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 01-05-2008 , 23:27   Re: Why is pev_v_angle so choppy?
Reply With Quote #2

It's most likely caused when using "server_frame()". Also, the way you're using "get_players()" it would only return the first player it finds.
Code:
//anges stuff new Float:angles[100][3]; new angleCurrent = 0; //player stuff new Players[32] new playerCount new inAttack=0; public server_frame() {     get_players(Players,playerCount,"c");     for(new i;i<playerCount;i++)     {         new playerID = Players[i]         pev(playerID, pev_v_angle, angles[angleCurrent])         if(get_user_button(playerID) & IN_ATTACK)         {             inAttack=1;                         }         else if(inAttack ==1)         {             //here the attack button has been clicked and released             //record the data             recordAngles();             inAttack=0;             client_print(playerID, print_chat, "Recorded Aim Vectors");         }                 angleCurrent++;         if(angleCurrent > 99)             angleCurrent=0;                         } }
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
jameszhao00
Junior Member
Join Date: Jan 2008
Old 01-06-2008 , 00:39   Re: Why is pev_v_angle so choppy?
Reply With Quote #3

If so, which event should I listen to? I already tried the client_PostThink, which didn't work out so well...

I only needed the first non-bot player's data, as I'm testing stuff and there's only myself on the server. (except the bots) When I start analyzing cal demos I'm probably going to make it support up to 32 players.
jameszhao00 is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 01-06-2008 , 01:15   Re: Why is pev_v_angle so choppy?
Reply With Quote #4

Well.. Maybe a task, although more efficient then "server_frame()" it can only call a function as fast as 0.1 seconds.
Example:
Code:
set_task(0.1,"MyFunc",0,"",0,"b");
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode