Editor hang/performance issue

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

Moderator: Staff

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

Editor hang/performance issue

Postby Roots » Mon May 09, 2011 12:19 am

So there's an issue with our editor that I have been experiencing since my return a couple weeks ago which makes it virtually unusable for me. Most of the time, the editor will become extremely unresponsive and sometimes hangs completely. Its even caused my entire system to hang, where I'd either have to restart the X server (the Linux graphical backend), or get a terminal outside of X and kill the editor forcefully to get control back. Its really bad. :( Sometimes though, the editor works just fine and continues to behave for half an hour or more. This seems to happen more often when I create a new map or open an existing map that is small. Loading a large map almost always results in failure. So this thread is dedicated to tracking and fixing this issue, which is the most critical one facing us right now IMO because we need to create maps for our next release.




How to reproduce the issue
1) Open a large map (river_access_cave.lua is one)
2) Try resizing the editor window after the map loads.
3) Try scrolling down to the bottom left corner of the map (where the only tiles are at the moment) and start making modifications.
4) If you see no problems, try closing the editor application and opening it up again, repeating these steps a few times to confirm it performs consistently
*) Note: This may cause your system to become unresponsive or unstable. Save your work before attempting to use the editor right now!

If you have performance issues or if the app hangs, it should be obvious. I usually see the issue as soon as I try using the scroll bars on the editor to move around.



If you've tested the editor recently (checked out and compile from SVN), please report if you see the same issue here and what your specs are. This may be unique to my system, although other QT apps like KDevelop (my code editor of choice) work perfectly fine so I'm skeptical its a system problem.

System Specs
- Ubuntu Linux 10.10, x86_64
- nVidia GeForce9800 GTX+ graphics card
- QT 4.7.0
- nvidia drivers 260.19.06-ubuntu
- Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz (dual-core)
Image
rujasu
Developer
Posts: 758
Joined: Sun Feb 25, 2007 5:40 am
Location: Maryland, USA

Re: Editor hang/performance issue

Postby rujasu » Mon May 09, 2011 5:43 am

It's not hanging, I just can't edit anything at all.

System Specs
- Debian GNU/Linux, Sid/Unstable
- Integrated ATI (Radeon 2100/R300)
- QT 4.7.2
- Open source Radeon drivers
- AMD Phenom(tm) 8450 Triple-Core Processor
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Editor hang/performance issue

Postby Roots » Mon May 09, 2011 5:48 am

What do you mean you can't edit anything at all? You mean it doesn't open any files anymore?


I've done some additional tests today and I've found the editor isn't completely broken. For example, the tileset editor still works like a charm. The map context and music dialog boxes work fine as well. The problem seems to be with the main editor view, and it happens whenever you try to resize or move the screen in particular.

Earlier with the old cave map from our last demo, I opened it and added a new context. The context added fine, but then it wasn't letting me edit anything on it. I tried to paint tiles, erase them, etc. and saw no change. Then I tried a paint operation and somehow, it painted two different types of tiles kind of intersecting one another. :twitch: Shortly thereafter, the editor crashed with a seg fault.
Image
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Editor hang/performance issue

Postby Roots » Mon May 09, 2011 7:54 am

I'm pretty sure the error is stemming from the code that either updates and/or paints the map tiles to the screen. The editor always seems fine until it has to do some editing or change the viewport of this area in the application. Unfortunately, this code is also some of the most complex and its going to take me some time to even fully understand it. I am starting to get an idea of how everything in the editor is put together though.


--- EDIT ---

Now that I understand the editor source tree more, I've narrowed down where this bug can be found to four files.
  • src/editor/grid.h ~250 lines
  • src/editor/grid.cpp ~1,000 lines
  • src/editor/editor.h ~500 lines
  • src/editor/editor.cpp ~2,500 lines

The bug is in there somewhere! I'm going to focus all of my attention on looking over these files. Its still difficult though, due to the nature of this issue. I think I'll try running the editor via my debugger and seeing if it has any useful information it can show me.
Image
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Editor hang/performance issue

Postby Roots » Mon May 09, 2011 6:17 pm

I put in a temporary hack to Grid::paintGL(), which is the function which paints all of the map tiles to the screen, to return immediately after its entered. So the costly draw operation of putting all those tile textures in place is skipped. However, this didn't make any difference to the application behavior. It showed a black space where the map tiles would usually be drawn, and after resizing the window and trying to use the scroll bars, it froze up just like usual. So it doesn't look like the draw/render code is an issue here. Perhaps its the resizeGL logic, or there's a method on the base QGLWidget class that we should implement.
Image
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Editor hang/performance issue

Postby Roots » Mon May 09, 2011 8:55 pm

I'm investigating whether this may be a problem on my system and not the actual code. One thing that I've seen printed out when I start the editor is the following message:

Xlib: extension "RANDR" missing on display ":0.0"


However I've seen that printed out on some other applications as well, and it hasn't been of great concern to me. The game application does not print this message. I tried looking into this more and found that this might actually be the cause of all my problems.

https://bugs.launchpad.net/xorg-server/+bug/650539

Apparently there's a bug (that has re-appeared after being fixed) in Ubuntu that causes some QT applications like Skype to hang or crash. Well out of curiosity, I just installed Skype on my system and sure enough, after I opened it it was very sluggish and brought my system to a crawl, before it crashed.


I'm going to look into this more and try disabling my dual-monitor setup and see if the editor works when I have just one monitor. i'll report back later to see whether or not fixing this warning message fixes the editor.
Image
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Editor hang/performance issue

Postby Roots » Mon May 09, 2011 9:40 pm

Hah, I don't believe it. Sure enough, when I disabled my dual-monitor setup that Xlib warning went away and now the editor suffers absolutely zero performance/stability issues, even with the larger maps. So that's good news!


The bad news is it looks like somehow I broke the editor in other ways during my other commits. :heh: I can't paint/move/edit tiles at all anymore. Oops. :ohnoes: I'll work on fixing that ASAP, then get to work on fixing the issue with my dual monitor setup. And then its time to make some maps! :cool:

--- EDIT ---

Editor is fixed as of commit #1867.
Image
User avatar
gorzuate
Developer
Posts: 2575
Joined: Thu Jun 17, 2004 3:03 am
Location: Hermosa Beach, CA
Contact:

Re: Editor hang/performance issue

Postby gorzuate » Tue May 10, 2011 7:40 am

I'm finding this thread quite amusing :D
Image
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Editor hang/performance issue

Postby Roots » Tue May 10, 2011 7:53 am

gorzuate wrote:I'm finding this thread quite amusing :D


:axe:


On the positive side, once the editor does work it does its job very well. I had completely forgotten all the nice features added to it over the last year or two. Autotiling, terrain tile randomization, undo/redo operations, and block paint/move are making my life so much easier. :bow:
Image
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Editor hang/performance issue

Postby Roots » Tue May 10, 2011 5:02 pm

FYI, new crash discovered with editor: http://bugs.allacrost.org/view.php?id=187

Fix plz! :angel:
Image
User avatar
gorzuate
Developer
Posts: 2575
Joined: Thu Jun 17, 2004 3:03 am
Location: Hermosa Beach, CA
Contact:

Re: Editor hang/performance issue

Postby gorzuate » Wed May 11, 2011 8:14 am

Roots wrote:FYI, new crash discovered with editor: http://bugs.allacrost.org/view.php?id=187

Fix plz! :angel:


Added a note: http://bugs.allacrost.org/view.php?id=187

As for the code cleanup you've been doing, it appears you and I have different likes/dislikes for the formatting of a file. I'd like to request that if something is not specifically mentioned in our coding standard, please leave it alone.
Image
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Editor hang/performance issue

Postby Roots » Wed May 11, 2011 8:33 am

Responded to your note with another note.


gorzuate wrote:As for the code cleanup you've been doing, it appears you and I have different likes/dislikes for the formatting of a file. I'd like to request that if something is not specifically mentioned in our coding standard, please leave it alone.


That's what happens when I invade code and you're not around to stop me :angel:. Okay, I'll try to restrain myself. But some of your formatting I find seriously difficult to read. Especially where you put a comment at the end of an if/else or loop block that states what the block is supposed to do. I've always seen those types of comments occur at the beginning of the block, not the end. Also in your source files, you really should be wrapping your code around the local namespace (ie, namespace hoa_editor {) and not just putting a "using namespace hoa_editor;" at the top. Its best to explicitly define the namespace where those functions are being implemented.
Image
User avatar
gorzuate
Developer
Posts: 2575
Joined: Thu Jun 17, 2004 3:03 am
Location: Hermosa Beach, CA
Contact:

Re: Editor hang/performance issue

Postby gorzuate » Wed May 18, 2011 6:06 pm

rujasu wrote:It's not hanging, I just can't edit anything at all.

System Specs
- Debian GNU/Linux, Sid/Unstable
- Integrated ATI (Radeon 2100/R300)
- QT 4.7.2
- Open source Radeon drivers
- AMD Phenom(tm) 8450 Triple-Core Processor


Are you still having problems with the editor, rujasu?
Image
User avatar
Roots
Dictator
Posts: 8665
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Editor hang/performance issue

Postby Roots » Wed May 18, 2011 6:28 pm

I think the editor is still sometimes crashing rujasu's system completely. I'm not sure though. I'm almost positive its an issue with his system though and not the editor itself.
Image
rujasu
Developer
Posts: 758
Joined: Sun Feb 25, 2007 5:40 am
Location: Maryland, USA

Re: Editor hang/performance issue

Postby rujasu » Thu May 19, 2011 2:34 am

I have a hunch that the issue is with me using integrated video and not having enough video memory for really large maps. Things work properly but slowly if I drop to software rendering. They also work fine if I make smaller maps, which is what I will do for the time being.

With that in mind, it's probably a good practice in general to not make huge maps, instead breaking them up into smaller chunks.

Return to “Technical Issues”

Who is online

Users browsing this forum: No registered users and 3 guests