AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Code Snippets/Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=83)
-   -   [TUT] Modules and efficient scripting (https://forums.alliedmods.net/showthread.php?t=88792)

joaquimandrade 03-29-2009 11:24

Re: [TUT] Modules and efficient scripting
 
Quote:

Originally Posted by ot_207 (Post 792250)
I know, you don't need to explain, this is your situation or any other good coders situation. There are some problems that will be fixed on that tutorial. If a scripter needs it he will modify the code. It depends on experience at first, if a scripter is a beginner he can't be able to see all weak spots of a code. That is a thing which everyone will learn with time.

The thing is: despite the fact that his code make things better it also does things wrong. It is re-setting models on spawn so, in a 32 slots full server, when a round begins it is re-setting 32 models (despite the fact that it is not needed). And because of that it also has tasks to prevent problems that can arise from these simultaneous re-sets. So, it's not only the efficient that it can be as it also can still let problems happen. By hooking team join event you would never re-set 32 models at the same time.

So basically what am i saying?
Changing its code like i said is not a trivial optimization but, for me, a obligatory one.

hleV 03-29-2009 13:36

Re: [TUT] Modules and efficient scripting
 
Quote:

Originally Posted by joaquimandrade (Post 792122)
FM, absolutely. But, you can improve Mercylez code. Look at this:

http://forums.alliedmods.net/showpos...7&postcount=40
http://forums.alliedmods.net/showpos...0&postcount=44

I didn't continue the talk there but, you should remove the tasks. And, if that causes problems put them again.

LOL. I never used tasks. ^^
Just checked if the model is right on player's spawn. If not - give player the right model.

But yeah... Doing it on team change event should be better.

SchlumPF* 03-29-2009 15:05

Re: [TUT] Modules and efficient scripting
 
so does it matter whether i use pev_origin or EV_VEC_origin for example? thats the only question which left in my eyes :)

nice tut ;o)

ot_207 03-29-2009 15:10

Re: [TUT] Modules and efficient scripting
 
Quote:

Originally Posted by SchlumPF* (Post 792530)
so does it matter whether i use pev_origin or EV_VEC_origin for example? thats the only question which left in my eyes :)

nice tut ;o)

Thanks :).
Engine is faster than FakeMeta in this situation for instance.

Exolent[jNr] 03-29-2009 15:19

Re: [TUT] Modules and efficient scripting
 
So anything that Fakemeta and Engine can do, Engine will do it faster, or...?

ot_207 03-29-2009 15:26

Re: [TUT] Modules and efficient scripting
 
Quote:

Originally Posted by Exolent[jNr] (Post 792549)
So anything that Fakemeta and Engine can do, Engine will do it faster, or...?

Yes ...
Look as an example you can try to test this code.
http://forums.alliedmods.net/showthread.php?t=65427
In that topic you can see both fakemeta and engine example you will see that engine works better.
[The camera pozition is better/faster updated!]

Edit: I will later post these plugins in the main topic and some of your questions so that people can see them :).

joaquimandrade 03-29-2009 15:36

Re: [TUT] Modules and efficient scripting
 
About:

Quote:

Originally Posted by SchlumPF* (Post 792530)
so does it matter whether i use pev_origin or EV_VEC_origin for example? thats the only question which left in my eyes :)

nice tut ;o)

My guess is that it is the same thing (Or probably engine better since there's no need to check the data type (i guess)). Will profile later.

ot_207 03-29-2009 15:37

Re: [TUT] Modules and efficient scripting
 
Quote:

Originally Posted by joaquimandrade (Post 792565)
About:

My guess is that it is the same thing. Will profile later.

Ok, will wait for your feedback. I'm also curious :).

Emp` 03-29-2009 15:38

Re: [TUT] Modules and efficient scripting
 
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.

joaquimandrade 03-29-2009 15:54

Re: [TUT] Modules and efficient scripting
 
2 Attachment(s)
About set_pev/entity_set the results say that it is basically the same thing.

(The same for pev/entity_get)


All times are GMT -4. The time now is 04:54.

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