Raised This Month: $90 Target: $400
 22% 

[TUT] Modules and efficient scripting


Post New Thread Reply   
 
Thread Tools Display Modes
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 03-29-2009 , 16:56   Re: [TUT] Modules and efficient scripting
Reply With Quote #21

Quote:
Originally Posted by joaquimandrade View Post
About set_pev/entity_set the results say that it is basically the same thing.
Ok then Emp` is right!
Quote:
Originally Posted by Emp` View Post
I think there will need to be more testing on the actual fakemeta natives vs the engine natives. As for now the only argument has been fakemeta conversions (stocks that emulate the engine natives), but http://forums.alliedmods.net/showthread.php?t=65427 just puts it to fakemeta, there is not any fakemeta conversions so you can't completely say that fakemeta is slower in that situation.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 03-29-2009 , 16:59   Re: [TUT] Modules and efficient scripting
Reply With Quote #22

Quote:
Originally Posted by ot_207 View Post
Ok then Emp` is right!
He's right about what? Using fakemeta is never faster, even not being engine always clearly faster.

Basically:

All this years everybody (Except Hawk) thought that fakemeta way was faster. Fakemeta way is never faster and can be much slower.
__________________

Last edited by joaquimandrade; 03-29-2009 at 17:23.
joaquimandrade is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 03-29-2009 , 17:03   Re: [TUT] Modules and efficient scripting
Reply With Quote #23

Quote:
Originally Posted by joaquimandrade View Post
His right about what? Using fakemeta is never faster, even not being engine always clearly faster.
He said about natives functions like pev,set_pev,create_tr2,get_pdata_int are the same. He told us that stocks that emulate functions of engine use a lot of cpu. For example fakemeta util stocks use too much cpu usage if some of those stocks can be found in other modules than it is important to use those modules instead of the stocks.
Example:
Insead of fm_set_rendering it is best to use set_rendering from fun.

Anyway the test shows a slight difference.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 03-29-2009 , 17:04   Re: [TUT] Modules and efficient scripting
Reply With Quote #24

Quote:
Originally Posted by ot_207 View Post
He said about natives functions like pev,set_pev,create_tr2,get_pdata_int are the same. He told us that stocks that emulate functions of engine use a lot of cpu. For example fakemeta util stocks use too much cpu usage if some of those stocks can be found in other modules than it is important to use those modules instead of the stocks.
Example:
Insead of fm_set_rendering it is best to use set_rendering from fun.

Anyway the test shows a slight difference.
No. He just said that more tests should be made. Here they are and fakemeta is never faster.
__________________
joaquimandrade is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 03-29-2009 , 17:07   Re: [TUT] Modules and efficient scripting
Reply With Quote #25

Quote:
Originally Posted by joaquimandrade View Post
No. He just said that more tests should be made. Here they are and fakemeta is never faster.
Oh, didn't read right.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 03-29-2009 , 17:27   Re: [TUT] Modules and efficient scripting
Reply With Quote #26

More. (I'm assuming that pev_valid(id) is equivalent to is_valid_ent(id)). If they aren't, the results are invalid.
Attached Files
File Type: txt more.txt (2.1 KB, 185 views)
__________________
joaquimandrade is offline
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 03-29-2009 , 17:41   Re: [TUT] Modules and efficient scripting
Reply With Quote #27

the more results i see the more i think that i really should convert my plugins to use fakemeta only if there is no way to avoid it except for huge codes which can be done by a few fm lines :/
__________________
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
Old 03-29-2009, 18:00
joaquimandrade
This message has been deleted by joaquimandrade.
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-29-2009 , 18:13   Re: [TUT] Modules and efficient scripting
Reply With Quote #28

Quote:
Originally Posted by joaquimandrade View Post
More. (I'm assuming that pev_valid(id) is equivalent to is_valid_ent(id)). If they aren't, the results are invalid.
is_valid_ent only returns 0/1 when pev_valid returns 0,1 or 2.

Code:
/**
 * Checks the validity of an entity.
 *
 * @param entindex		The entity id to check.
 *
 * @return 			0 on invalid entity
 *						1 on entity is valid
 *						2 on entity is valid and it has private data (safe to use pdata natives on).
 */
native pev_valid(entindex);
__________________
- tired and retired -
ConnorMcLeod is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 03-29-2009 , 18:20   Re: [TUT] Modules and efficient scripting
Reply With Quote #29

Quote:
Originally Posted by ConnorMcLeod View Post
is_valid_ent only returns 0/1 when pev_valid returns 0,1 or 2.

Code:
/**
 * Checks the validity of an entity.
 *
 * @param entindex        The entity id to check.
 *
 * @return             0 on invalid entity
 *                        1 on entity is valid
 *                        2 on entity is valid and it has private data (safe to use pdata natives on).
 */
native pev_valid(entindex);
Ok. So the comparison is not fair.
A question: is it normal needing the "return 2" case?
__________________
joaquimandrade is offline
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 03-29-2009 , 18:37   Re: [TUT] Modules and efficient scripting
Reply With Quote #30

never used pev_valid(id) == 2 but i guess it is not really needed.
if you set some ents pdata you should already know whether it has pdata. but it may be usefull if you loop through different kinds of ents (classnames)


a new question which came to my mind
is there any difference between
client_preThink( plr ) and register_forward( FM_PlayerPreThink, "fwdPlayerPreThink" ) ?
__________________

Last edited by SchlumPF*; 03-29-2009 at 18:45.
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
Reply


Thread Tools
Display Modes

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 05:03.


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