Performance issues on mid-range machine

For those having trouble installing/running the game or to report a bug

Moderator: Staff

User avatar
Roots
Dictator
Posts: 8666
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Performance issues on mid-range machine

Postby Roots » Tue Jun 28, 2011 9:21 pm

There's a guy on #opengameart, CharlesG, who tried out Allacrost and was unable to play it because it performed absolutely horrible on his machine. He's getting between 2-5 FPS, while I'm getting 60-70FPS on my system. His specs are:

- Windows Vista
- 3.3GHz Intel processor
- 1GB RAM
- Integrated Intel Graphics


Allacrost should certainly be playable on it. I asked him what the most demanding game he could play comfortably on his system was and he cited this one:
http://www.youtube.com/watch?v=wmY8gqGPX0w


This is the first performance issue I've heard of it a long time. I'm wondering if there's something we're doing with our FPS limiting code that is screwing things up. If you recall, a long time ago we used to see FPS constantly shoot up between 100-300 (at least on my system) and now its usually steady around 60 FPS no matter what I'm doing. I don't remember who added what code to do this, but maybe if the system isn't powerful to achieve 60+ FPS on its own, the code craps out in this case?

I also checked with him regarding other games and he said none of them show any problems, and his graphics drivers are updated. I'm wondering if for some reason his system is using an OpenGL software renderer instead of the video graphics hardware. That would explain a lot, but I'm not sure how that could be possible.


Does anyone have any clues as to what the problem may be? I highly doubt that our code is just too slow/bloated to run on his machine faster than 5FPS... :uhoh:
Image
rujasu
Developer
Posts: 758
Joined: Sun Feb 25, 2007 5:40 am
Location: Maryland, USA

Re: Performance issues on mid-range machine

Postby rujasu » Tue Jun 28, 2011 9:41 pm

I've had similar problems on my Windows machine with Intel graphics. When I boot into Linux on the same machine, I get much better performance.
nan
Newbie
Posts: 18
Joined: Sat May 28, 2011 12:57 pm

Re: Performance issues on mid-range machine

Postby nan » Wed Jun 29, 2011 4:16 am

I did a quick run with gpu perfstudio. Looks like intel windows driver doesn't like glTexSubImage2D. It is called 8 times per frame in battle mode and slows the frame rate down to 3fps.

Some info:
http://software.intel.com/en-us/forums/ ... hp?t=76303

Using GL_BGRA seems to fix it. Frame rate is at 240fps in battle mode(but the texture loading code will have to be adjusted).
nan
Newbie
Posts: 18
Joined: Sat May 28, 2011 12:57 pm

Re: Performance issues on mid-range machine

Postby nan » Wed Jun 29, 2011 4:32 am

One could also ask why glTexSubImage2D is called that often per frame in the first place.
User avatar
Roots
Dictator
Posts: 8666
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Performance issues on mid-range machine

Postby Roots » Wed Jun 29, 2011 6:07 am

Wow, thanks for looking into that nan. I didn't write our graphics engine and have barely any graphics programming knowledge or experience so this is completely out of my league. I did re-write the graphics engine back in early 2007 because the initial design was horrible, but for the most part I left all of the gl calls in place and just improved the API around things.

http://www.opengl.org/sdk/docs/man/xhtm ... mage2D.xml
I read the glTexSubImage2D reference and I'm not sure I get it, but what I do know is that our graphics engine creates textures that store multiple images in it. So instead of having an entire texture for each tile (which is 32x32 pixels), we have large textures that can store multiple small images in them. I'm going to take a guess and say that glTexSubImage2D is used to extract those smaller images from the larger textures. The guy who designed our graphics engine in this way said that we needed to do so to improve performance, so that we weren't switching textures a crazy number of times. At least that's what I think I remember him saying. But the guy who wrote the graphics engine is long gone and we don't have anyone on the team at the moment with enough of a background in graphics to really give us any further insight into this issue.
Image
nan
Newbie
Posts: 18
Joined: Sat May 28, 2011 12:57 pm

Re: Performance issues on mid-range machine

Postby nan » Wed Jun 29, 2011 10:12 am

I think glTexSubImage2D is optimal for static sprites, but not so great for dynamic. For intel it even looks like it is copying the texture(GL_RGBA) into user memory before modifying it. I think a sprite batch per (static)texture atlas could be faster here.

A quick fix for battle mode is to move skill_points_text.SetText(), _hit_points_text.SetText() out of the draw loop, 2*4 glTexSubImage2D(). It gives me about 340fps if I comment them out.

Edit:
Btw the map mode runs at 40-100fps.
nan
Newbie
Posts: 18
Joined: Sat May 28, 2011 12:57 pm

Re: Performance issues on mid-range machine

Postby nan » Thu Jun 30, 2011 9:54 pm

Here a (possible)patch to workaround the issue for the skill and hit points.
Attachments
hit_skill_points.txt
(2.81 KiB) Downloaded 186 times
User avatar
Bertram
Senior Member
Posts: 127
Joined: Fri Feb 26, 2010 10:08 am

Re: Performance issues on mid-range machine

Postby Bertram » Fri Jul 15, 2011 7:54 am

Hi,

Roots asked me to bump this topic.

Has a fix been pushed already or considered so far?

Best regards,
User avatar
Roots
Dictator
Posts: 8666
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Performance issues on mid-range machine

Postby Roots » Fri Jul 15, 2011 2:00 pm

I'll apply nan's patch in my next commit. I don't know if that will solve this issue entirely, but at the least the change he made is something that is needed anyway even without this bug.
Image
User avatar
Bertram
Senior Member
Posts: 127
Joined: Fri Feb 26, 2010 10:08 am

Re: Performance issues on mid-range machine

Postby Bertram » Fri Jul 15, 2011 4:43 pm

Great :)
rujasu
Developer
Posts: 758
Joined: Sun Feb 25, 2007 5:40 am
Location: Maryland, USA

Re: Performance issues on mid-range machine

Postby rujasu » Fri Jul 15, 2011 6:30 pm

The real problem is in MapMode. If the FPS drops below 10 or so, characters start randomly pingponging around because they can't pathfind properly, or something like that. It's strange, to say the least.

Battles and menus look bad with low FPS, but at least they function correctly.
nan
Newbie
Posts: 18
Joined: Sat May 28, 2011 12:57 pm

Re: Performance issues on mid-range machine

Postby nan » Fri Jul 15, 2011 11:44 pm

The patch reduces glTexSubImage2D calls, increases battle fps from 2 to 150-350 fps. It will still fail for the cases where text is changed every frame. One could modify the text renderer to draw glyphs as quads instead of writing them into textures(this is the slow operation).

The maps intro and cave run for me(intel gm45) at 40 to 120 fps. Haven't looked why the framerate is fluctuating yet.

Return to “Technical Issues”

Who is online

Users browsing this forum: No registered users and 1 guest