It is currently 12 Sep 2025, 07:28
   
Text Size

GUI slowdowns

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

GUI slowdowns

Postby Max mtg » 02 Aug 2012, 21:55

Investigating further game slowndowns I have come across mutiple repainting of PlayArea.
To see that, consider placing this code at the beginning of forge.view.arcane.PlayArea.wrap(CardStackRow, List<CardStackRow>, int)

Code: Select all
    private int cntRepaints = 0;
    private int wrap(final CardStackRow sourceRow, final List<CardStackRow> rows, final int insertIndex) {
        // The cards are sure to fit (with vertical scrolling) at the minimum
        // card width.
        final boolean allowHeightOverflow = this.cardWidth == this.getCardWidthMin();

        System.err.format("[%d] @ %d - Repaint playarea%n", new Date().getTime(), cntRepaints++);
I have started a match (ai won the coin) and played only a land. By that time there already were 2666 repaints in at least one of instances. The repaint counter bursts when phases are switched or any kind of animation happens.
I also ran profiler to play a number of turns in a match - there were some 146k calls to wrap(...), that summed up took 5 seconds.

There should not be that many repaints. Who knows what causes them?
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: GUI slowdowns

Postby Max mtg » 03 Aug 2012, 22:44

What I've learnt - doLayout of playarea iterates from maxCardWith till 50 until it finds a value when cards fit into playarea size. Each iteration include arraylist creation and other kind of collection management.

I have changed some code so that the costly method wrap is called 20 times less often. Expect low-end PCs to benefit from this change.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 41 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 41 users online :: 0 registered, 0 hidden and 41 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: No registered users and 41 guests

Login Form