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

Introduction:
Hello.

Last time there were a lot of command processors, but almost all of them were just an edited versions of ZCMD.
Now it's time to break that chain.
Let me show you a new command engine: DC_CMD. It was created as a plugin and written in pure ASM.
Installation and usage:
1. Put "dc_cmd.dll" or "dc_cmd.so" in your "plugins" folder and "dc_cmd.inc" into "pawno/include" folder.
2. Add "dc_cmd" (or "dc_cmd.so") to the plugins list in "server.cfg"
3. Add the following code at the top of your script, under #include <a_samp>
PHP код:
#include <dc_cmd> 
4. If you are using DC_CMD in a filterscript, make sure it contains the following line at the top:
pawn Код:
#define FILTERSCRIPT
or else your FS will be determined as gamemode and commands in actual gamemode won't work.
5. Make commands as for ZCMD:
pawn Код:
// test command
CMD:info(playerid, params[])
{
    return SendClientMessage(playerid, -1, "DC_CMD plugin installed successfully!");
}

// "/i" - shortened variation of "/info"
CMD:i(playerid, params[])
{
    // call "/info" command
    return _info(playerid, params);
}
You can also use Fast Mode (standard commands won't be supported), just add #define DC_CMD_FAST before including "dc_cmd.inc", like this
pawn Код:
#define DC_CMD_FAST // <<==== enable Fast Mode
#include <dc_cmd>
Speed tests:
  1. Windows 7:
  2. Xubuntu 12.10:
Features planned for next versions:
  • Completely rewrite plugin in C++
    Add more useful features
Download:
Plugin (.dll + .so + .inc): https://www.dropbox.com/s/eu1704igk9rnwe2/dc_cmd.zip
Source code (for FASM): https://www.dropbox.com/s/ce2sqv3clp0imz2/Source.zip
Speed tests: https://www.dropbox.com/s/5cgm648l94m7u71/speedtest.zip
Reply
#2

nice job
Reply
#3

Looks pretty good but realistically the difference it will make overall is so marginal as to not even be measurable in a public server environment. How many commands are going to be made per second on average? Maybe two dozen on a large RP server it may be faster but the difference was probably not worth your time considering your bench mark is generally not attainable without command spamming hotkeys.
Reply
#4

how would you know its faster then ZCMD but good work tho man keep it up.
Reply
#5

Good work so this is telling me the ultimate zcmd is not ultimate anymore cause it has been pwned by DC_CMD??
so after a long time zcmd is finally 2nd to the fastest?? and ycmd is third?
Reply
#6

Quote:
Originally Posted by Ryan_Obeles
Посмотреть сообщение
Good work so this is telling me the ultimate zcmd is not ultimate anymore cause it has been pwned by DC_CMD??
so after a long time zcmd is finally 2nd to the fastest?? and ycmd is third?
It's not going to really make any significant difference overall it just looks pretty.
Reply
#7

Quote:
Originally Posted by Ryan_Obeles
Посмотреть сообщение
Good work so this is telling me the ultimate zcmd is not ultimate anymore cause it has been pwned by DC_CMD??
so after a long time zcmd is finally 2nd to the fastest?? and ycmd is third?
ycmd is not even fast

i still think zcmd is faster anyways.
Reply
#8

Quote:
Originally Posted by Fredrick
Посмотреть сообщение
ycmd is not even fast

i still think zcmd is faster anyways.

check the test ****** did
+ i noticed that with this being a plugin i like zcmd better since this has a plugin which is not that handy
Reply
#9

Can you do a test with YCMD?
Reply
#10

I got an error.
pawn Код:
C:\Users\Marcho\Documents\[ SA-MP Server ]\pawno\include\dc_cmd.inc(35) : error 004: function "dc_cmd_OnPlayerCommandText" is not implemented
Reply
#11

i think ****** should do a test on this
Reply
#12

You are NUTS! Haha.
Good one.
Reply
#13

Quote:
Originally Posted by Fredrick
Посмотреть сообщение
i think ****** should do a test on this
Indeed.
As always ****** will have something to say to improve the performance and code of this plugin.

Let's wait till then.
Reply
#14

good work
Reply
#15

Okay, looks like I forgot to write about two things in first post =/
1. You can use a Fast Mode (standard commands won't be supported). Just add
PHP код:
#define DC_CMD_FAST 
before inluding "dc_cmd.inc", something like this:
PHP код:
#define DC_CMD_FAST
#include <dc_cmd> 
2. If you want to keep standard commands support, just keep standard
OnPlayerCommandText() callback in your mode and don't use Fast Mode.

First post updated.


Quote:
Originally Posted by greentarch
Посмотреть сообщение
I got an error.
pawn Код:
C:\Users\Marcho\Documents\[ SA-MP Server ]\pawno\include\dc_cmd.inc(35) : error 004: function "dc_cmd_OnPlayerCommandText" is not implemented
Try to use one of two options described above.
Reply
#16

Amazing plugin! I don't there is going to be released a faster command processor than this.

Код:
db 13, 10, 13, 10
db 'Feel the power of ASSembler', 0 ;I have no idea what it does here, lol
lol
Reply
#17

Quote:
Originally Posted by Rockk
Посмотреть сообщение
Indeed.
As always ****** will have something to say to improve the performance and code of this plugin.

Let's wait till then.
you do know that this plugin i got a feeling about this one. just need to wait and see what the processors and witch is faster this may can be done up even more!!


EDIT: am going to inbox ****** now so he can see this.
Reply
#18

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
I'm not going to modify this plugin (maybe optimize some code sections, and no more), it is already done.
And what about optimization: first I wrote some snippets of code in C++ and used ASM listings from MSVC++ compiler, enabled and disabled some optimizations and compared code. Then I simplified and optimized that code even more and rewrote whole plugin in ASM from scratch. That's why I doubt it can be optimized more with C compilers.

Quote:
Originally Posted by ******
Посмотреть сообщение
"help", built in per-player permissions, alternate names, mutliple script support, mutliple language support, and command lists
Is it really necessary in every gamemode or filterscript?

Quote:
Originally Posted by ******
Посмотреть сообщение
This isn't even the first plugin based command processor: https://sampforum.blast.hk/showthread.php?tid=423815
Okay. Let's look at some "cool features" of LifeCMD:
1. If you are using it in FS, commands in gamemode won't work.
2. If there is more than one space character between command name and parameters, plugin will skip only the first ' ' character.
3. etc.
Reply
#19

Quote:
Originally Posted by ******
Посмотреть сообщение
There we go, simply by continuing your assumption that no-one cares about the features provided by a command processor we have halved the time taken!
I almost died laughing reading this, thank ****** I just got up and you already made my day!
Reply
#20

Quote:
Originally Posted by ******
Посмотреть сообщение
...
Damn. I love reading these posts from you, ******.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)