Raised This Month: $ Target: $400
 0% 

Frame by frame!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 08-26-2014 , 15:38   Frame by frame!
Reply With Quote #1

Wazza alliedmods community,

I was wondering what was the most expensive result in my situation. I have to check every single frames for a certain amount of players for a temporary time (which occur quite often).

I was wondering what would be the least expensive operation between request a frame for each players that I need to check or a OnGameFrame loop.

PHP Code:
public OnPlayerJump()
{
    
int player blablabalba;

    
myBoolVarToCheckPlayer[i] = true;
}

public 
OnGameFrame() 
{
    static 
int i;
    for (
1MaxClientsi++) 
        if (
IsClientInGame(i) && myBoolVarToCheckPlayer[i])  { // do my check }  

PHP Code:
public OnPlayerJump()
{
    
int player blablabalba;

    
RequestFrame(CheckIfLandedplayer);
}

public 
RequestFrameCallback(player)
{
    
// do my check

    // request a new frame if I still need to check

normally a jump varies between 0 - 2 seconds and I have to check every single frame between those time

Last edited by Mathias.; 08-26-2014 at 15:40.
Mathias. is offline
ceLoFaN
Member
Join Date: Apr 2014
Old 08-26-2014 , 17:42   Re: Frame by frame!
Reply With Quote #2

SDKHook_StartTouch might be another solution but sometimes it fails to detect collision. I use it mainly because I need wall and entity touch detection, combined with OnPlayerRunCmd, which might actually render it useless since I think it gets called every frame.

I'm not sure but I think calling the RequestFrameCallback many times, will prove to be more operation expensive than using OnGameFrame. I guess it's not much nowadays anyway.
__________________

Last edited by ceLoFaN; 08-27-2014 at 12:37.
ceLoFaN is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 08-26-2014 , 18:01   Re: Frame by frame!
Reply With Quote #3

yeah, im just going to wait for someone who got the answer, thank you for your suggestion but I am not interested into sdkhooks methods and their are not needed for my needs.
Mathias. is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 08-27-2014 , 00:28   Re: Frame by frame!
Reply With Quote #4

A blind say would be SDKHook_OnWeaponCanLOL ().

A blind say would be the second example as the is still gape between your check.
But if I were in that situation, I would go for the OnGameFrame() as they much sexy.
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 08-27-2014 , 06:20   Re: Frame by frame!
Reply With Quote #5

If you hook one of the client's thinks, you wouldn't have to run loops or check if they are in game.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 08-27-2014 , 13:48   Re: Frame by frame!
Reply With Quote #6

I'm asking this question on purpose for future other solutions that are not necessary related to players or w.e. sdkhooks can do. The question is simple, what is the most efficient way between the 2 Technics.

Thank you for your suggestions but that is not my question, this was just a setup example.
Mathias. is offline
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 23:11.


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