Raised This Month: $32 Target: $400
 8% 

[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 09-01-2009 , 02:44   Re: [TUT] Modules and efficient scripting
Reply With Quote #101

Quote:
Originally Posted by Bad_Bud View Post
I thought the concept behind the fakemeta high was that the engine module eats up CPU time when it's doing nothing, whereas fakemeta does not. I haven't seen anyone do a profile with fakemeta running for long periods of time with the engine module disabled, versus engine running for long periods of time. In most profiles, I see the fakemeta being compared with the engine in the same plugin, which guarantees that the engine module is still running -- defeating the purpose of a comparison between engine and "pure fakemeta"; we've taken away the most preached aspect of the comparison: engine module uses CPU when it is not being used.

I'm not taking sides, because I'm not advanced enough of a scripter to really care, but I think these tests are less intuitive than they appear, and that if we are going to state things as solid facts with profiles, fair tests should be run.
The difference of that the engine uses cpu always instead of fakemeta that it does not. Can be explained with a simple and plain example.

In fakemeta if you need the prethink forward you will register it.
Whereas in engine you place it as a function client_PreThink(id).
The difference is that fakemeta if it does not have any forwards to call (no plugins have this forward registered) it does not bother to get the forward from the engine and call the plugins.
Where as engine sends the function call to all the plugins (it doesn't care if the plugins have the forward or nor).
That is the difference.
I think that the "fakemeta high" problem started from the things that people misunderstood, they thought that fakemeta will use cpu when it is asked to, that is what was making fakemeta > engine not the power of the module itself. Both modules are great, and work flawlessly, using one of them is good but using both of them will make it all more efficient.

And this tutorial advices you to use less module communications because these are the problems when we talk about CPU usage (efficiency).
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 09-01-2009 at 02:48.
ot_207 is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 09-01-2009 , 03:16   Re: [TUT] Modules and efficient scripting
Reply With Quote #102

So it was not true at all?

One oddity though... it doesn't match up with the funcwiki, but I have engine disabled, but client_PreThink still works.
__________________
Bad_Bud is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-01-2009 , 03:33   Re: [TUT] Modules and efficient scripting
Reply With Quote #103

Because in this new version of AMXX, if a plugin require an module and it's not enabled will be enabled automaticly.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 09-01-2009 , 03:42   Re: [TUT] Modules and efficient scripting
Reply With Quote #104

Quote:
Originally Posted by Bad_Bud View Post
So it was not true at all?

One oddity though... it doesn't match up with the funcwiki, but I have engine disabled, but client_PreThink still works.
I did not say it was not true, I said that people misunderstood what the module developers have said. This tutorial is meant to point you into the right direction.

Quote:
Originally Posted by Alka View Post
Because in this new version of AMXX, if a plugin require an module and it's not enabled will be enabled automaticly.
That is true!
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 09-01-2009 , 03:56   Re: [TUT] Modules and efficient scripting
Reply With Quote #105

No, I mean, my plugin is written entirely in ham and fakemeta except for that function. I don't even #include engine. I would think that another include is secretly including engine, but I've tried calling some engine functions just to see, and I get errors... just not on client_PreThink().

PHP Code:
#pragma dynamic 32768

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <sqlx>
#include <ava_ts> 
__________________
Bad_Bud is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 09-01-2009 , 03:59   Re: [TUT] Modules and efficient scripting
Reply With Quote #106

Quote:
Originally Posted by Bad_Bud View Post
No, I mean, my plugin is written entirely in ham and fakemeta except for that function. I don't even #include engine. I would think that another include is secretly including engine, but I've tried calling some engine functions just to see, and I get errors... just not on client_PreThink().

PHP Code:
#pragma dynamic 32768

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <sqlx>
#include <ava_ts> 
Engine doesn't know you have the client_PreThink function in your plugin, even if you include engine. The module will call the function even if it is not included .
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 09-01-2009 , 04:02   Re: [TUT] Modules and efficient scripting
Reply With Quote #107

It shouldn't be able to compile... er...

I think I understand what you're saying now... and I think that's kind of dumb if it's true, lol.

Though I would think it would say something like the function is not used in the compiler output, but it doesn't, it recognizes what it's for.

PHP Code:
#include <amxmodx>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
}

public 
client_PreThink(id)
{
    

Doesn't even gripe.

Heh, but that was it. I removed the engine.dll and it stopped prethinking. I suppose with sneaky functions like that, us who think we have removed engine from our plugins may have not. ;(
__________________

Last edited by Bad_Bud; 09-01-2009 at 04:19.
Bad_Bud is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 09-01-2009 , 12:18   Re: [TUT] Modules and efficient scripting
Reply With Quote #108

Quote:
Originally Posted by Bad_Bud View Post
Though I would think it would say something like the function is not used in the compiler output, but it doesn't, it recognizes what it's for.
Because you declare it as a public function.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 09-01-2009 , 12:19   Re: [TUT] Modules and efficient scripting
Reply With Quote #109

Quote:
Originally Posted by Emp` View Post
Because you declare it as a public function.
Good to know that, haven't thought of it .
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-01-2009 , 12:35   Re: [TUT] Modules and efficient scripting
Reply With Quote #110

Engine module won't be auto-loaded by a public function (forward).
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 05:44.


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