PlaneShift

Gameplay => General Discussion => Topic started by: Giraut Mawhrin on December 02, 2007, 04:22:21 am

Title: A solution to speed-up PlaneShift on slow computers
Post by: Giraut Mawhrin on December 02, 2007, 04:22:21 am
Hello everybody,

I made a little patch that helps speed up the game enormously. The patch adds a command key to enable/disable the creation of labels above players and items. The labels, strangely enough, are real CPU pigs. When I disable them with the patch (which, incidentally, truly disables them, unlike the option in the game's menu), I get a 20 FPS speed increase in areas such as the path from the north tower to the plaza, the stairway to the tavern, or the Akkaio gate. This makes the game completely playable even on a lowly computer like mine.

Here's a link to the patch:

http://users.skynet.be/ppc/planeshift/planeshift_disablelabels_patch.tar.gz (http://users.skynet.be/ppc/planeshift/planeshift_disablelabels_patch.tar.gz)

It comes with a README that tells you how to install it and use it. Of course, you need to be able to recompile the client, and I've only tested it under Linux, but I see no reason why it wouldn't work on other platforms.

I hope this helps!
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Xordan on December 02, 2007, 04:47:03 am
Yes, entity labels are our biggest resource hog by far. The method used to create them is very expensive unfortunately.

Quick question, doesn't disabling labels in the ingame options have the same affect?
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Giraut Mawhrin on December 02, 2007, 04:53:57 am
Yes, entity labels are our biggest resource hog by far. The method used to create them is very expensive unfortunately.
Quick question, doesn't disabling labels in the ingame options have the same affect?

No, when you set labels invisible, they're still created each time an object arrives, they're just not displayed, which is why you see exactly no speed improvement when you disable them in-game.
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Xordan on December 02, 2007, 05:03:28 am
If you can make a patch to 'fix' that option so it doesn't create them, maybe so it doesn't create them for the mouseover option either (until you mouseover), then I'd be most grateful :)
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Rongar Elani on December 02, 2007, 07:41:27 am
Oh, that'd be excellent. I didn't even know that the labels are that much of a problem, which is why I had them on "always visible" all the time. :sweatdrop:

Thanks for your efforts, Giraut! :thumbup:
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Vornne on December 02, 2007, 10:12:39 am
I will just add some recent output from the svn log:

------------------------------------------------------------------------
r312 | kemedes | 2007-11-28 09:34:56 +1300 (Wed, 28 Nov 2007) | 1 line

- Entity labels are only rendered when needed, not always.
------------------------------------------------------------------------

From looking at the diff, it seems they are not created if the option is set to never show labels. Though still you could look at the svn trunk code and make a patch to stop it creating them until mouseover, like Xordan wanted.

But nice work ;)
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Aiken on December 02, 2007, 10:35:29 am
Would be nice if it is already implemented in truck. I have a patch that has the same result. With performance the increase when entity labels are not even created is enough to not worry about using labels most of the time. Earlier I did a few runs from Percy to Harn. I have the fps indicator in the bottom left corner

The results of a few runs
all labels -> min fps 6
invisible labels -> min fps 6
no labels -> min fps 17

That is with adaptive turned off and distance set to 1,000.
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Makiraren on December 08, 2007, 01:41:25 am
I didn't get a readme file with the patch.  Can you tell me where I can get it?
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Aiken on December 08, 2007, 03:28:56 am
The download should contain 2 files. One of them called README.
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Makiraren on December 08, 2007, 04:45:35 am
I've tried it twice, and all I get is the patch file with a .tar extension.  Maybe it's just me.
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Aiken on December 08, 2007, 06:06:09 am
Open the tar file.

.tar = archive of files
.tar.gz = compressed tar file
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Makiraren on December 08, 2007, 06:20:56 am
Ahh, much better.  Thank you.
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Tuxide on December 08, 2007, 10:50:01 am
Yes, entity labels are our biggest resource hog by far. The method used to create them is very expensive unfortunately.
Is this true with the text in the chat window as well?  I notice the longer I let psclient run on Laanx (for, say, several hours), the more it lags until I reach a point where my connection times out.  Even when I do nothing but sit in the tavern for six hours.
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Tontow on December 08, 2007, 07:20:30 pm
I have a question.

Are labels destroyed when no longer needed?  If they aren’t then that’s a big memory leak……..
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Lanarel on December 08, 2007, 11:32:10 pm
If labels take so much resources, then what about chat bubbles? Aren;t those similar 2D effects? Just wondering if these 2D things are the reason the game freezes the moment Harn's place gets into view :)
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Vornne on December 10, 2007, 11:34:28 am
I have run psclient with valgrind --tool=callgrind, the major slowdown is entity labels being created, not when they are shown... I don't think chat bubbles even come on the radar ;)

I am working to get some temporary fixes into svn, to help loading times... currently the labels are always created when the character or item is in range to be visible, but the labels are not shown until you are much closer, and have the mouse on them if you have that set. So I changed it to only create the label just before it is shown, if it does not exist already - this causes a momentary freeze when you move your mouse over for the first time, but that is in my opinion better than lagging for a minute or two waiting for 50 labels to be created, when you are just running through the map and will never see them.

The next thing to do is to make the label creation process faster, but that is not so easy...
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Tontow on December 10, 2007, 07:09:26 pm
Some Ideas:
Create all the labels while the map is loading?
Or just have one label that is used for all objects, but the text changes when each object is viewed.
Or replace labels with a modified version of the chat bubbles system since chat bubbles aren’t even on the radar of recourses.


(sorry if I’m overstepping my bounds)
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Vornne on December 11, 2007, 10:38:34 am
OK, jorrit came into #planeshift-build and was answering some questions of Ragnarin about this:

<@jorrit> Best is to avoid SetRenderTarget.
<@jorrit> It is not needed for this.

<@jorrit> You put ALL entity labels in one single mesh.

<@jorrit> But I think this is the best solution. A few facts:
<@jorrit>   - More meshes -> slower
<@jorrit>   - Less materials -> faster
<@jorrit>   - Render2Texture -> slow
<@jorrit> So a single mesh with a single material for entity labels -> fast

<@jorrit> Plus that the labels will even work when PS window is iconified.
<@jorrit> Currently that's not the case.
<@jorrit> Labels generated while PS window is obscured contain garbish.
(this is the reason planeshift is very slow to respond after switching back to it from another application, in windowed mode - all the entity labels are recreated)

I found it interesting... and the developers are working on it :)

As for "Create all the labels while the map is loading?" this is what currently happens, well, when the model appears... and is part of the major lag when entering a sector like hydlaa plaza...
"Or replace labels with a modified version of the chat bubbles system since chat bubbles aren’t even on the radar of recourses."
Hmm well, I probably wasn't very clear about what I meant, and thinking later probably why they did not show up in the callgrind.out was because there were around 50 entity labels, and only 5 or so chat bubbles probably... I will test properly later by making a npc talk a lot, and turn labels off and see if it runs the 'bad' part of the code or not... it may, as they are both coded in a similar way...
Title: Re: A solution to speed-up PlaneShift on slow computers
Post by: Tuxide on December 23, 2007, 11:47:31 pm
Thought I would mention that Giraut's patch works on MinGW, so there is hope for Windoze users after all.