A forum for feature requests/discussions and user submitted patches that improve MQ2
Moderator: MacroQuest Developers
-
Lax
- We're not worthy!

- Posts: 3524
- Joined: Thu Oct 17, 2002 1:01 pm
- Location: ISBoxer
-
Contact:
Post
by Lax » Wed Oct 15, 2003 7:17 pm
I've done this to my version, trust me when I say it's favorable.
#1: Only update the map when the map window is open. Where the mapping routines get called, check that pMap->Open (or common->open whatever it is) is nonzero (this is more precisely the Show/Hide status of the window, and that can be confirmed by looking at CXWnd__Show for the current version... well, I know where it is anyway :) )
#2: Only update the map every x cycles. Turning on the mapping feature visibly lags the client. Updating it only every other cycle improves performance greatly, but also keep in mind that the function gets called many times a second (10 times a second I think?). I mentioned this before but that's overkill even in the most intense situations. Mine updates every 11 cycles, with visible lag at that point while the map is open.
-
Lax
- We're not worthy!

- Posts: 3524
- Joined: Thu Oct 17, 2002 1:01 pm
- Location: ISBoxer
-
Contact:
Post
by Lax » Wed Oct 15, 2003 8:20 pm
Oh, another one real quick while on the subject. Apply labels only when the labels are turned on. I don't have the offset for that, but can find it and other parts of the _EQMAPWINDOW struct when I'm not busy later
-
Plazmic
- The One

- Posts: 800
- Joined: Fri Jun 14, 2002 12:31 am
-
Contact:
Post
by Plazmic » Thu Oct 16, 2003 4:13 am
Don't you mean only apply label text when labels is turned off?
label text when labels are on lags horribly if you are zoomed out at all.
-
Lax
- We're not worthy!

- Posts: 3524
- Joined: Thu Oct 17, 2002 1:01 pm
- Location: ISBoxer
-
Contact:
Post
by Lax » Thu Oct 16, 2003 8:28 am
Well, in the sense that the labels on the map are being shown (labels being on), only allocate the label texts then (will it crash if the text pointer is null?). But yeah, when the labels
filter on the map window is on, don't handle the labels

I dunno, just trying to think of ways to reduce slowdown
-
|| Napolion ||
- a ghoul

- Posts: 96
- Joined: Sat Dec 28, 2002 7:45 am
Post
by || Napolion || » Thu Oct 16, 2003 9:27 am
Love the /mapfilter feature. Yes it a lot as I am a non tracker class.
I have a question thow, can it be done so that I can make a list of the labes to be showen ??
Like :
/mapfilter label orc,ambass
Will only show labels for the mobs with orc and ambass in the name.
Can this be done or are it to big of a problem ?
-
ap50
- a snow griffon

- Posts: 425
- Joined: Sun Aug 18, 2002 2:29 pm
Post
by ap50 » Thu Oct 16, 2003 10:12 am
or as I think I've asked before, just stuff in your alert lists.
[color=yellow][size=92][b]Just because you're paranoid, it doesn't mean everyone isn't out to get you![/b][/size][/color]
-
Lax
- We're not worthy!

- Posts: 3524
- Joined: Thu Oct 17, 2002 1:01 pm
- Location: ISBoxer
-
Contact:
Post
by Lax » Mon Oct 20, 2003 9:43 am
although the slowness problem is solved by compiler optimizations, I've been PMed and asked how to do this, so here's what you do:
EQLib_Main.cpp
Code: Select all
VOID Pulse(VOID)
.
.
.
[color=red]
static int N; // dont initialize, #1 we dont care about the actual value
// and #2 since it's added here as static if you initialize here
// it "could" be set each time and the if will never be true.
N++;
if (N%3==0)
[/color]
if (EQADDR_CLASSMAPWND && *EQADDR_CLASSMAPWND && EQADDR_SPAWNLIST && *EQADDR_SPAWNLIST) {
[color=red]
if (((PEQMAPWINDOW)*EQADDR_CLASSMAPWND)->wincommon.Open) {
[/color]
ClearMapAllocs();
if (gMapFilters[MAPFILTER_All]) HandleMapLabelAdditions();
if (gMapFilters[MAPFILTER_CastRadius] > 0) HandleMapCastRadius();
[color=red]
}
[/color]
}
Every 3 passes is nice and smooth as far as the map goes, and updating only when the map window is open is just common sense. Enjoy.
Edit: Fixed error in the Open needing to be part of wincommon
Last edited by
Lax on Tue Oct 21, 2003 5:12 pm, edited 2 times in total.
-
Doodman
- a ghoul

- Posts: 124
- Joined: Thu Jan 02, 2003 12:07 pm
Post
by Doodman » Mon Oct 20, 2003 5:52 pm
If you wanna improve it a little more, the change:
to
The mod operator (%) is very expensive. Doing some tests with some simple code % is about twice as slow.
-
Lax
- We're not worthy!

- Posts: 3524
- Joined: Thu Oct 17, 2002 1:01 pm
- Location: ISBoxer
-
Contact:
Post
by Lax » Mon Oct 20, 2003 6:59 pm
Heh well whichever you want to do, the cycle(s) saved is(/are) miniscule compared to the thousands of instructions saved
-
Mckorr
- Developer

- Posts: 2326
- Joined: Fri Oct 18, 2002 1:16 pm
- Location: Texas
Post
by Mckorr » Tue Oct 21, 2003 10:23 am
Syntax error?
Code: Select all
VOID Pulse(VOID)
.
.
.
static int N; // dont initialize, #1 we dont care about the actual value
// and #2 since it's added here as static if you initialize here
// it will be set each time and the if will never be true.
N++;
if (N%3==0) [color=red]{[/color]
if (EQADDR_CLASSMAPWND && *EQADDR_CLASSMAPWND && EQADDR_SPAWNLIST && *EQADDR_SPAWNLIST) {
if (((PEQMAPWINDOW)*EQADDR_CLASSMAPWND)->Open)
{
ClearMapAllocs();
if (gMapFilters[MAPFILTER_All]) HandleMapLabelAdditions();
if (gMapFilters[MAPFILTER_CastRadius] > 0) HandleMapCastRadius();
}
}
[color=red]}[/color]
Think you missed a set of braces in there.
Last edited by
Mckorr on Tue Oct 21, 2003 10:34 am, edited 8 times in total.
MQ2: Think of it as Evolution in action.
-
Lax
- We're not worthy!

- Posts: 3524
- Joined: Thu Oct 17, 2002 1:01 pm
- Location: ISBoxer
-
Contact:
Post
by Lax » Tue Oct 21, 2003 10:27 am
Nope all braces are matched up, I just prepended the if with another if. It could also be shortened to
Code: Select all
if ([color=red]N%3==0 && [/color]EQADDR_CLASSMAPWND && *EQADDR_CLASSMAPWND && EQADDR_SPAWNLIST && *EQADDR_SPAWNLIST) {
and the result as well as the produced code would be exactly the same :)
-
Mckorr
- Developer

- Posts: 2326
- Joined: Fri Oct 18, 2002 1:16 pm
- Location: Texas
Post
by Mckorr » Tue Oct 21, 2003 10:41 am
Gotcha. Gonna CVS it in this way (easier for me to read

):
Code: Select all
static int N; // dont initialize, #1 we dont care about the actual value
// and #2 since it's added here as static if you initialize here
// it will be set each time and the if will never be true.
N++;
if (N%3==0 && EQADDR_CLASSMAPWND && *EQADDR_CLASSMAPWND && EQADDR_SPAWNLIST && *EQADDR_SPAWNLIST) {
if (((PEQMAPWINDOW)*EQADDR_CLASSMAPWND)->Open)
{
ClearMapAllocs();
if (gMapFilters[MAPFILTER_All]) HandleMapLabelAdditions();
if (gMapFilters[MAPFILTER_CastRadius] > 0) HandleMapCastRadius();
}
}
MQ2: Think of it as Evolution in action.
-
Doodman
- a ghoul

- Posts: 124
- Joined: Thu Jan 02, 2003 12:07 pm
Post
by Doodman » Tue Oct 21, 2003 12:36 pm
Code: Select all
static int N; // dont initialize, #1 we dont care about the actual value
// and #2 since it's added here as static if you initialize here
// it will be set each time and the if will never be true.
That is actually not true. Static variables are only initialized once. If your complier is initializing it more than once, report the bug.
Example:
Code: Select all
void a()
{
static int N=0;
N++;
printf("N=%d\n",N);
}
main()
{
a();
a();
}
Results:
-
koad
- Plugins Czar
- Posts: 127
- Joined: Fri May 16, 2003 8:32 pm
Post
by koad » Tue Oct 21, 2003 1:30 pm
i like the concept of this optimization but with this change i am getting a compile error:
Code: Select all
EQLib_Main.cpp(1049) : error C2039: 'Open' : is not a member of '_EQMAPWINDOW'
MQ.h(1061) : see declaration of '_EQMAPWINDOW'
i looked at the _EQMAPWINDOW struct and the common window struct is in there, but it doesnt see that open is there, whats wrong here? in some of the other window structs i see Open defined seperately, do we need to find Open in the _EQMAPWINDOW struct? like _EQHOTBUTTONWINDOW has baselevel Open defined as a BYTE but others dont
-
Mckorr
- Developer

- Posts: 2326
- Joined: Fri Oct 18, 2002 1:16 pm
- Location: Texas
Post
by Mckorr » Tue Oct 21, 2003 1:42 pm
Ah. I don't have a compiler here to check it, sorry.
Try replacing
Code: Select all
if (((PEQMAPWINDOW)*EQADDR_CLASSMAPWND)->Open)
with
Code: Select all
if (((PEQMAPWINDOW)*EQADDR_CLASSMAPWND)->PEQWINDOWCOMMON->Open)
and tell me what happens.
MQ2: Think of it as Evolution in action.