URL:
  <http://gna.org/patch/?973>

                 Summary: Fixes CPU cycle wasting on pause
                 Project: Warzone Resurrection Project
            Submitted by: buginator
            Submitted on: Friday 02/08/2008 at 04:41
                Category: Fix
                Priority: 9 - Immediate
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

This patch is needed mostly for notebook users, since wasting CPU cycles eats
up battery life for no good reason, but it also is good for everyone else.

Inline profiling results:

atmos.c is still a *massive* CPU hog
This is mainly because of:
#define MAX_ATMOS_PARTICLES (MAP_MAXWIDTH * MAP_MAXHEIGHT)

When paused, it *still* executes that horrible loop.
When condition for paused is check, at least we don't execute that loop
anymore.
This resulted in limited savings for CPU cycles though.

However, we are still executing the mainloop & gameloop @ whatever
framelimiter is set to when paused.

I think it is set to 60 for default.

Even by not doing many of the drawing routines, we are still wasting CPU
cycles
when paused.  I pretty much stopped all drawing routines when paused, and it
didn't help much either, which does make sense when you look at how this loop
operates, and just what the lone
SDL_Delay() is used for.

Tried to set the framelimiter to a lower value when paused, and restore it
when unpaused, that resulted in choppy menu animation, and overall was not
satisfied with the results at all.

Next added a SDL_Delay(30) call when the pause menu is up.  This worked
nicely, and is a *huge* improvement.

I also modified display3d.c to not execute some routines when paused, and
came across this:
/* This is done here as effects can light the terrain - pause mode problems
though */

I didn't notice a problem when I did:
        if ( !gamePaused() )    // Don't bother drawing/updating when paused!
        {
                processEffects();
                atmosUpdateSystem();
        }

Can someone shed some light on what the issue is(was?)?  I did NOT include
that in this patch.





    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Friday 02/08/2008 at 04:41  Name: pausefix.patch  Size: 1kB   By:
buginator

<http://gna.org/patch/download.php?file_id=3766>

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?973>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to