Layouting large amount of rich text is slow

Bug #577888 reported by SirVer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Medium
Unassigned

Bug Description

The chat window in multiplayer should only remember ~20 messages. Otherwise, there is always a notable lag when opening the window after some playtime when a lot of chatting was going on. This is because the whole textarea needs to be rerendered and relayouted each time.

The original name of this bug was:
Chat window remembers all messages ever

because the problem is most obvious with many chat messages in a game

Related branches

SirVer (sirver)
Changed in widelands:
status: New → Confirmed
importance: Undecided → Medium
tags: added: chat multiplayer performance ui
Revision history for this message
Nasenbaer (nasenbaer) wrote :

sound useful - BUT:
There should be a function to view the chat history - perhaps steping back in 20 message steps or so.

Revision history for this message
Nicolai Hähnle (nha) wrote :

The obvious solution is to make the textarea implementation smarter so that it doesn't relayout everything all the time. Then there'd be no need to make the UI more complicated.

Revision history for this message
Timowi (timo-wingender) wrote :

The font/text rendering still needs to be reworked for opengl. I "fixed" this by disabling parts of the code. So it's the right time to put up some ideas how to do the text(/font) rendering.

Revision history for this message
Nicolai Hähnle (nha) wrote :

I think this particular issue is orthogonal to how font rendering is done. If I recall correctly the Multiline_Textarea tries to render the entire text at once, and this is what's causing the slowdown. If we instead did line breaks manually and rendered the text line by line, the problem would go away.

Revision history for this message
SirVer (sirver) wrote :

iirc the layouted text is cached as a SDL surface, but since the text changes with each message, it is relayouted each time.

While we are talking about the text rendering: other projects (like wesnoth) uses pango to layout text. It enables very rich text, including floating images and html like links. Moving to this or a similar library would greatly enhance our flexibility and would make a help system much richer and more pleasant to use.

SirVer (sirver)
summary: - Chat window remembers all messages ever
+ Layouting large amount of rich text is slow
description: updated
Revision history for this message
Nicolai Hähnle (nha) wrote :

I suppose we should consider this fixed after bzr6501. Please reopen if you think otherwise.

Changed in widelands:
status: Confirmed → Fix Committed
milestone: none → build18-rc1
Revision history for this message
SirVer (sirver) wrote :

It isn't. The new and the old rendering engine exist in parallel at this point in time. Rich text rendering still uses the old engine (there is a massive workload involved in converting stuff in txt/* into the new syntax, especially the license). I have shied away from doing this work and so far there has always been 'something more important',

Changed in widelands:
status: Fix Committed → Confirmed
assignee: nobody → SirVer (sirver)
Revision history for this message
SirVer (sirver) wrote :

Ohh.. help is appreciated of course :). Just remove usage of g_fh through g_fh1.

Revision history for this message
SirVer (sirver) wrote :

Charlie, if you want to work on this it World be usefull add raw text support to the new text rendering engine. Than the old one can be killed completely.

Revision history for this message
SirVer (sirver) wrote :

sorry for the last post - was made from my phone including the usual spelling errors :).

It would be really nice to get rid of the old font handling stuff - there is more to be done here (e.g. replace the current rich text rendering in campaigns with the new system), but the most difficult and the most crucial to get feature parity with the existing system would be to get raw string support. That is text that does not support formatting, but might contain a cursor (for editboxes and multiline editboxes). It would be terrific if you could work on this.

SirVer (sirver)
Changed in widelands:
milestone: build18-rc1 → build19-rc1
Revision history for this message
SirVer (sirver) wrote :

Setting to incomplete for bug sweeping.

Changed in widelands:
status: Confirmed → Incomplete
Revision history for this message
SirVer (sirver) wrote :

Gun, could you summarize what the current situation here is? What still needs doing before b19?

Changed in widelands:
assignee: SirVer (sirver) → GunChleoc (gunchleoc)
Revision history for this message
GunChleoc (gunchleoc) wrote :

I am not planning to do the actual richtext multiline-textareas for Build19. There are still too many problems with fh1, e.g. images not being shown in messages.

So, I am doing the switchover element by element, e.g. buttons and tables are already done.

If you would like to work on fixing the problems, I should do a merge first.

GunChleoc (gunchleoc)
Changed in widelands:
milestone: build19-rc1 → none
Revision history for this message
GunChleoc (gunchleoc) wrote :

The old renderer is gone now, so I'm marking this as Fix Committed.

Changed in widelands:
status: Incomplete → Fix Committed
milestone: none → build20-rc1
assignee: GunChleoc (gunchleoc) → nobody
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build20-rc1

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.