Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Wed Jun 10, 2009 12:28 am   

[3.08] Is it possible to improve this cap-and-gag script?
 
Code:
<trigger name="aMapCapStart" priority="12370" id="85">
  <pattern>--*v(%d) *--$</pattern>
  <value>#CAP aMapWin
#gagon
#C+ aMapWin
AetVnum=%1</value>
  <trigger>
    <pattern>%d</pattern>
    <value>#C-
#gagoff</value>
  </trigger>
</trigger>

Its taking 3.4 seconds to gallop through 9 rooms (9 map displays) as opposed to 1.2 when I disable this trigger.

This really does add up when I auto-run around the game. I particularly notice the difference if I am following someone else with the same mapper as myself. Across 200 rooms they tend to arrive significantly sooner than I.
_________________
Athlon 64 3200+
Win XP Pro x64
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Fri Jun 12, 2009 1:59 pm   
 
Can we see sample text of several rooms. Without that it would be hard to really offer any improvements. Off hand, nothing really jumps out at me.
_________________
Asati di tempari!
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri Jun 12, 2009 5:30 pm   
 
Aardwolf has a similar in-line map system. Here are the triggers that I use to capture the map:
Code:
<trigger priority="141230" id="14123">
  <pattern>^~<MAPSTART~>$</pattern>
  <value>#GAG
#GAGON
:Map:#CLR
#C+ Map
</value>
</trigger>
<trigger priority="141240" id="14124">
  <pattern>^~<MAPEND~>$</pattern>
  <value>#GAG
#C-
#GAGOFF</value>
</trigger>


So it looks very similar to your triggers, but I don't get any lag or delay for this. Or at least it's very minimal. I am always speedwalking across the world with this enabled and it certainly doesn't take the kind of time that you are talking about. So I'm not sure why it would be doing it for you. You might want to open the Script Debugger and see what other triggers or scripts are also firing as you move.
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Sun Jun 14, 2009 12:16 pm   
 
I started with a blank session. Gallop, is an ability very similar to dash. For anyone unfamiliar with IRE, this means that "gallop e" will go as many rooms east in a straight line as possible, with the one command. Unlike dash/sprint, gallop shows a full room description (and map in this case) for each room passed through.

With a blank session, galloping across the Jaru bridge (9 rooms) took 0.6s
With a capturing trigger:

Code:
<trigger priority="20" id="2">
  <pattern>--- v(%d) ---</pattern>
  <value>#cap testwin
#gag
#gagon
#c+ testwin
vnum=%1</value>
  <trigger>
    <pattern>---$</pattern>
    <value>#c-
#gagoff</value>
  </trigger>
</trigger>


It was only marginally more.
I added the following prompt trigger:

Code:
<trigger priority="50" prompt="true" id="5">
  <pattern>H:(%d)~|(%d) B:%d~% Exp:(%d) ~[([kcsdbpf]) (%x) (%x)~] ~{(%d)~|(%d)~|(%d)~|(%d)~} Kai:%d</pattern>
  <value>#raiseevent onPrompt %1 %2 %4 %5 %6 %9 %10 %7 %8
xp=%3</value>
</trigger>

With associated variables and two onPrompt events setting those variables. Still only fractionally more. In fact, I noticed some difference each time so I guess lag can factor in. I did do some repetitions, but only enough to get an idea of the average, nothing with statistical power.

I then opened my package that has my combat affliction triggers in it. The commands in each are to run an alias (addaff) which in turn calls an event. There is no decision-making curing alias/function, nor any triggers containing cure messages or cure-use balance messages. It is a package of just incoming affliction triggers. Obviously, none of them firing during this test, but there are a lot of them.

At this point it now seems to take an average of 1.9s to gallop through the 9 rooms (6 seconds with the debugger open, but I did it with the window open a few times. No scripts are being called.) It seems that a large volume of triggers are an effort to parse. My triggers are (I think) well-written though. A lot (all venom affs, diagnose messages, hypnosis lines for example) are also in disabled classes, that only get enabled by triggers that detect when they may be about to arrive. Most are anchored, and while I do use (*) here and there, it is never at the beginning or end of a pattern. I'll go through them one by one and do my best to improve them, but I admit I am a little disappointed that it doesn't seem to be something I can fix easily (or perhaps at all).

The following is my moving one room, with the capture trigger, prompt trigger/events/variables, and the cure-trigger package. As you can see, there is very little going on there, certainly no scripts being called from the curing package. ctrl+q results in 7ms without the curing package, and 23.6 with it. With all my other packages (i.e. my proper character session) I am getting 43.
Code:
0.0004 |
0.0011 | a  TestMapC |H:5745|5408 B:100% Exp:28 [k eb lr] {100|100|100|100} Kai:0w
0.0109 | j  TestMapC >w
0.2218 | a  TestMapC |Sororal Span.
0.0021 | a  TestMapC |--- Area 19: Enorian -------------- v2108 ---
0.0004 | f  TestMapC |  Pattern: --- v(%d) --- : (%1=2108)
0.0007 | n  TestMapC |  Exec Trigger "--- v(%d) ---"
0.0002 | a   testwin |--- Area 19: Enorian -------------- v2108 ---
0.0040 | a  TestMapC |Capture text ON
0.0035 | k  TestMapC |  Var "vnum" changed from "2107" to "2108"
0.0019 | a  TestMapC #Telnet 200: Room.Brief Sororal Span
0.0009 | a  TestMapC #Telnet 200: Room.Brief Sororal Span
0.0010 | a  TestMapC #Telnet 200: Room.Exits e,w
0.0008 | a  TestMapC #Telnet 200: Char.Vitals<LF>H:5745/5745 M:5408/5408 E:27623/27625 W:24655/24655 NL:28/100
0.0010 | a  TestMapC |                  |
0.0003 | a   testwin |                  |
0.0053 | a  TestMapC |                  |
0.0003 | a   testwin |                  |
0.0159 | a  TestMapC |                  |
0.0003 | a   testwin |                  |
0.0055 | a  TestMapC |                 [ ]
0.0005 | a   testwin |                 [ ]
0.0053 | a  TestMapC |                    \
0.0003 | a   testwin |                    \
0.0054 | a  TestMapC |                      \
0.0003 | a   testwin |                      \
0.0054 | a  TestMapC |                        \
0.0003 | a   testwin |                        \
0.0054 | a  TestMapC |                         [ ]
0.0003 | a   testwin |                         [ ]
0.0060 | a  TestMapC |                          |
0.0003 | a   testwin |                          |
0.0055 | a  TestMapC |                         [ ]
0.0003 | a   testwin |                         [ ]
0.0056 | a  TestMapC |                  |       |
0.0003 | a   testwin |                  |       |
0.0055 | a  TestMapC |-[ ]-[ ]-[ ]-[ ]-[ ]-[+]-[ ]-[H]
0.0007 | a   testwin |-[ ]-[ ]-[ ]-[ ]-[ ]-[+]-[ ]-[H]
0.0057 | a  TestMapC |          |       |         \
0.0003 | a   testwin |          |       |         \
0.0056 | a  TestMapC |         [^]     [H]          \  [H]
0.0007 | a   testwin |         [^]     [H]          \  [H]
0.0058 | a  TestMapC |                                \ |
0.0003 | a   testwin |                                \ |
0.0056 | a  TestMapC |                                 [ ]- - - - -
0.0004 | a   testwin |                                 [ ]- - - - -
0.0056 | a  TestMapC |                                / |
0.0003 | a   testwin |                                / |
0.0055 | a  TestMapC |                             [^] [ ]
0.0004 | a   testwin |                             [^] [ ]
0.0064 | a  TestMapC |                                  |
0.0003 | a   testwin |                                  |
0.0060 | a  TestMapC |                                 [_]
0.0003 | a   testwin |                                 [_]
0.0061 | a  TestMapC |                                             
0.0003 | a   testwin |                                             
0.0058 | a  TestMapC |                                             
0.0004 | a   testwin |                                             
0.0055 | a  TestMapC |                                             
0.0004 | a   testwin |                                             
0.0055 | a  TestMapC |--- Sororal Span -------------- -14:-23:0 ---
0.0004 | a   testwin |--- Sororal Span -------------- -14:-23:0 ---
0.0029 | f  TestMapC |  Pattern: ---$
0.0008 | n  TestMapC |  Exec Trigger "---$"
0.0002 | a  TestMapC |Capture text OFF
0.0059 | a  TestMapC |The stars twinkle in the clear night sky. A sewer grate looms darkly beneath your feet. There are 4 solemn chaplains here. An earthenware bowl rests comfortably on the ground. An argent intercessor is poised here, hefting an ancient-looking halberd in her glowing hands. There are 3 peacemaker of Enorians here.
0.0125 | a  TestMapC |You see exits leading east and west.
0.0027 | a  TestMapC ]H:5745|5408 B:100% Exp:28 [k eb lr] {99|100|100|100} Kai:0
0.0004 | f  TestMapC |  Pattern: H:(%d)~|(%d) B:%d~% Exp:(%d) ~[([kcsdbpf]) (%x) (%x)~] ~{... : (%1=5745, %2=5408, %3=28, %4="k", %5="eb", %6="lr", %7=99, %8=100, %9=100, %10=100)
0.0008 | n  TestMapC |  Exec Trigger "H:(%d)~|(%d) B:%d~% Exp:(%d) ~[([kcsdbpf]) (%x) (%x)~] ~{(%d)~|("
0.0002 | m  TestMapC |  Event "onPrompt" raised : (%1=5745, %2=5408, %3="k", %4="eb", %5="lr", %6=100, %7=100, %8=99, %9=100)
0.0003 | n  TestMapC |  Exec Event "onPrompt"
0.0001 | n  TestMapC |  Exec Event "onPrompt"
0.0003 | k  TestMapC |  Var "endurance" changed from "100" to "99"
_________________
Athlon 64 3200+
Win XP Pro x64
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Jun 15, 2009 5:32 pm   
 
You'll need to continue doing what you started and go through each set of triggers and enable/disable them to see which one is causing the slowdown. It's probably just a single trigger that has a problem causing the slowdown.

Remember that CMUD is going to test each enabled trigger on each line from the MUD, even if that line is being gagged. You might want to put *all* of your other triggers into a folder (like "triggers") and disable that folder while you are in the middle of capturing the map data to speed things up.

Remember that even if a trigger doesn't match, CMUD still has to test it and while the regular expression engine used in CMUD is the fastest available to test triggers, there are some trigger patterns that will be slower than others.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net