[Plugin] DC_CMD - command engine written in pure ASM
#21

Quote:
Originally Posted by DanielCortez
Посмотреть сообщение
Last time there were a lot of command processors, but almost all of them were just an edited versions of ZCMD.
It works on the same principle, as ZCMD
, but it is also kinda different from it and works much faster.
I lold.
Reply
#22

Quote:
Originally Posted by ******
Посмотреть сообщение
Anyway, there's no point doing a speed comparison - of course a plugin that's well coded will be faster, but speed isn't everything! I also seriously doubt that coding this in assembly will give much, if any, improvements over C given modern compilers. All it does is make the code longer, more obfuscated, harder to modify, and harder to optimise - read this:

http://stackoverflow.com/questions/2...bly-more-often
Actually, sometimes C compiler can't optimise the code as much as a good ASM developer would do. Assuming Daniel is a brilliant developer, this plugin would be faster (my tests proved this too, however I didn't save the results - you are free to do benchmarks).

Quote:
Originally Posted by ******
Посмотреть сообщение
You claim to be faster than ZCMD - that's not hard and there are other command processors that are also faster but they all get faster by skipping features like "OnPlayerCommandRecieved" and "OnPlayerCommandPerformed", which are used for permission systems. It is true that you are also faster than y_commands, but again you skip multiple features like the ones above from ZCMD, "help", built in per-player permissions, alternate names, mutliple script support, mutliple language support, and command lists. So yes, well done, you manged to write less code and it was faster! Wow...
It's faster than ZCMD and a few other command processor that have the same functionality. He compared his plugin with RCMD, ZCMD and LIFECMD. When two plugins have different functionality, well.. that's tricky. You'd probably have to calculate the utility of each feature, do a total score, etc. Anyway, that's not an actual benchmark.

--

I really like the idea of writing plugins in ASM, but I can't say I like ASM. It's pretty hard to mantain code written in ASM.
Reply
#23

LOL

It looks like ****** didn't like it :P


I really admire the skill of ASM programing, like that code.
But yes, of course, YCMD and ZCMD have a lof of better features...

But, even most important, those speed difference means nothing for a real RP/G server with 100+ players...

If you have a command being executed on 10µs or 5µs doesn't make a significant difference... Think about a complete RP/G gamemode has some functions called every second that may take around 100ms (100000µs) to be fully executed...
Or the famous "PRESS F TO ENTER" that make a loop around all doors getting player's position hundreds or, maybe, thousands of times only cuz the "IsPlayerInRangeOfPoint", and then makes a lot of float operations to check if the distance is inside the radius... EVERY TIME a player press F...



make better what is already awesome, doesn't change much...
if you are training for a race
half circuit you run at 1000kph
half circuit you run at 5kph
what is your average speed? Something around 9.95kph...

so, you get better where you were already good, and now you can do:
half circuit you run at 10000kph
half circuit you run at 5kph
what is your average speed? Something around 9.995kph...

after a speed enhacement of 900% on your good part, you changed less than 5% on average...
(yeah, I know it's not exactly analogous, but nvm, you can get the idea)

So, everyone, please, stop giving so much value for what is already good and start thinking in what isn't...


for exemple, the fixes2, ****** plugin, is something that could really makes an amazing difference on a real server (despite it's still a bit bugged)
The default SetTimer() takes 1100ms while it should take 1000ms... it means 1 extra sec on each 10 secs!!


Daniel, what you did is awesome, but not (only) for the speed...
But for the skill and lesson to everyone, showing the possibilities about to make a plugin in ASM (what a lot of programming-lovers like me can only dream about), congrats man.

And Alex Cole, no words for you man...
You are like a... "Carl Friedrich Gauss" of SA:MP man...
Anyone in the whole sa-mp world certainly have at least a piece of code made by you on his gamemode
Almost everyone have already been helped for you in something... perhaps not directly asking for you or on a topic answered by you, but almost mainly googling something and finding a topic with some message you wrote
(I did it at least 10 times only this year...)


So, guys, do not fight to see which system is better, It depends 99% about what you want to do with.
even the ond strcmp can be better for some stuffs, for exemple, if you want to change and/or add some alternate spelling ingame...



(I don't know how you did your strcmp tests, but here my result was 4ms on 10000 strcmp with this code below)
Код:
#include <a_samp>

main(){}

public OnGameModeInit()
{
    new string[] = "testt9999";
    new string2[10];
    new a = GetTickCount();
    for(new i = 0; i < 10000; i++)
    {  
        format(string2, 10, "testt%d", i);
        if(!strcmp(string, string2))
            printf("time = %d", GetTickCount() - a);
    }
}
Reply
#24

Quote:
Originally Posted by ******
Посмотреть сообщение
Do you mean ycmd: https://sampforum.blast.hk/showthread.php?tid=157228 which as you say is not fast.

Or y_commands: https://sampforum.blast.hk/showthread.php?tid=169029 which is faster than zcmd, not slower as you claim?

Anyway, there's no point doing a speed comparison - of course a plugin that's well coded will be faster, but speed isn't everything! I also seriously doubt that coding this in assembly will give much, if any, improvements over C given modern compilers. All it does is make the code longer, more obfuscated, harder to modify, and harder to optimise - read this:

http://stackoverflow.com/questions/2...bly-more-often

You claim to be faster than ZCMD - that's not hard and there are other command processors that are also faster but they all get faster by skipping features like "OnPlayerCommandRecieved" and "OnPlayerCommandPerformed", which are used for permission systems. It is true that you are also faster than y_commands, but again you skip multiple features like the ones above from ZCMD, "help", built in per-player permissions, alternate names, mutliple script support, mutliple language support, and command lists. So yes, well done, you manged to write less code and it was faster! Wow...

This isn't even the first plugin based command processor: https://sampforum.blast.hk/showthread.php?tid=423815

Edit: 3 questions about your tests:

1) Have you done some without using "format", jsut hard-code the command names to avoid that bottleneck?

2) Have you done some with a decent number of commands? How many modern modes have just 10 commands?

3) Have you done any comparisons with y_commands?
ycmd But am just saying it ant faster then zcmd or whatever.
Reply
#25

Error: Function not registered: 'DC_CMD'
Reply
#26

Quote:
Originally Posted by white_energy
Посмотреть сообщение
Error: Function not registered: 'DC_CMD'
Just use ZCMD or YCMD there is really no point to this plugin.
Reply
#27

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Just use ZCMD or YCMD there is really no point to this plugin.
This.

Why write a plugin that does something, when you can save yourself the huge headache and do it in PAWN? Some people do it for speed gain, but is it REALLY that worth it for 20 milliseconds of more speed? Stick to ZCMD and we can all live happily ever after!
Reply
#28

The difference would be so small you would have to do millions of iterations to find any difference even a 1000 players spamming a 1000 commands per second would only be marginally measurable if at all.
Reply
#29

How can I call some command from any place of gamemode? For example, on standart command processor I could write:
PHP код:
OnPlayerCommandText(playerid,"/command"); 
in public OnDialogResponse
Reply
#30

Have a callback? like OnPlayerCommandReceived or wher I need to put the code from OnPlayerCommandReceived?
Reply
#31

Quote:
Originally Posted by Mister0
Посмотреть сообщение
Have a callback? like OnPlayerCommandReceived or wher I need to put the code from OnPlayerCommandReceived?
Callbacks OnPlayerCommandReceived and OnPlayerCommandPerformed.

OnPlayerCommandReceived:
PHP код:
OnPlayerCommandReceived(playeridcmdtext[]) 
Called before processing the command. It is possible to specify the conditions of the command.
At the same time using the return 1/0 can enable/disable the command.

Example:
PHP код:
public OnPlayerCommandReceived(playeridcmdtext[])
{
    if(
PlayerInfo[playerid][pMute] == 1// if player have a mute (/mute)
    
{
        
SendClientMessage(playerid, -1"You have a mute, wait!");
        return 
0// transmit information for plugin, to not he execute command
    
}
    return 
1// allow command execution

OnPlayerCommandPerformed:
PHP код:
OnPlayerCommandPerformed(playeridcmdtext[], success); 
Called after the command.
Moreover, if 'success = 1' - the team is successful, 'success = 0' - error, 'success = -1' - command not found.
This way you can make independently support for standard commands:
PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if(
success == -1// if command not found
    
{
        return 
OnPlayerCommandText(playeridcmdtext);
    }
    return 
1// allow command execution

Or you can make a report about the nonexistent command:
PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if(
success == -1// if command not found
    
{
        return 
SendClientMessage(playerid, -1"This command not found on the server, please use /help.");
    }
    return 
1;

Taken from the official theme in Russian forum, translated by me.

Latest version plugin v2.8

Link: https://www.dropbox.com/s/3s7kjp5ipn..._v2.8.zip?dl=0
Reply
#32

This post seems to have an extremely outdated version of DC_CMD (posted in 2013, even before version numbers where assigned to the .inc file)

Here's a download link to the newest version; from a russian speaking community (don't want to advertise, but its from Daniel Cortez himself, on that forum)

Proof of topic author (without advertising):


Download: http://rgho.st/53289178
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)