2019-12-15 21:32 EST


View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002446FSSCPgraphicspublic2011-05-30 14:48
ReporterFury 
Assigned ToThe_E 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version3.6.13 
Target VersionFixed in Version3.6.13 
Summary0002446: Particle generation when game is paused
DescriptionIf you pause the game by pressing either esc, pause or alt-tabbing (same as pause) while FSO is generating particles, resuming the game will take really long time by seemingly freezing FSO to halt until it slowly starts recovering from really low fps to normal fps. This problem can be replicated by either tabling options or any script that produces particles.

This problem isn't new and has been around since at least 3.6.11.

I suggest trying this script to trigger the problem.
http://www.hard-light.net/forums/index.php?topic=76406
TagsNo tags attached.
Attached Files
  • patch file icon mantis2446-patch.patch (2,340 bytes) 2011-05-30 13:35 -
    Index: code/graphics/2d.cpp
    ===================================================================
    --- code/graphics/2d.cpp	(revision 7218)
    +++ code/graphics/2d.cpp	(working copy)
    @@ -31,6 +31,7 @@
     #include "graphics/grbatch.h"
     #include "parse/scripting.h"
     #include "gamesequence/gamesequence.h"	//WMC - for scripting hooks in gr_flip()
    +#include "Io/keycontrol.h" // m!m
     
     
     #if defined(SCP_UNIX) && !defined(__APPLE__)
    @@ -1469,12 +1470,16 @@
     
     void gr_flip()
     {
    -	//WMC - Evaluate global hook if not override.
    -	Script_system.RunBytecode(Script_globalhook);
    -	//WMC - Do conditional hooks. Yippee!
    -	Script_system.RunCondition(CHA_ONFRAME);
    -	//WMC - Do scripting reset stuff
    -	Script_system.EndFrame();
    +	// m!m avoid running CHA_ONFRAME when the "Quit mission" popup is shown. See mantis 2446 for reference
    +	if (!quit_mission_popup_shown)
    +	{
    +		//WMC - Evaluate global hook if not override.
    +		Script_system.RunBytecode(Script_globalhook);
    +		//WMC - Do conditional hooks. Yippee!
    +		Script_system.RunCondition(CHA_ONFRAME);
    +		//WMC - Do scripting reset stuff
    +		Script_system.EndFrame();
    +	}
     
     	gr_screen.gf_flip();
     }
    Index: code/io/keycontrol.cpp
    ===================================================================
    --- code/io/keycontrol.cpp	(revision 7218)
    +++ code/io/keycontrol.cpp	(working copy)
    @@ -88,6 +88,7 @@
     									  // 666)6=N79+Z45=BE0e
     int Tool_enabled = 0;
     bool Perspective_locked=false;
    +bool quit_mission_popup_shown = false;
     
     	/*
     #else 
    @@ -1404,6 +1405,8 @@
     		game_stop_looped_sounds();
     		snd_stop_all();
     
    +		quit_mission_popup_shown = true;
    +
     		pf_flags = PF_BODY_BIG | PF_USE_AFFIRMATIVE_ICON | PF_USE_NEGATIVE_ICON;
     		choice = popup(pf_flags, 3, POPUP_NO, XSTR( "&Yes, Quit", 28), XSTR( "Yes, &Restart", 29), XSTR( "Do you really want to end the mission?", 30));
     
    @@ -1431,6 +1434,7 @@
     		default:
     			break;  // do nothing
     		}
    +		quit_mission_popup_shown = false;
     
     		game_start_time();
     		game_flush();
    Index: code/io/keycontrol.h
    ===================================================================
    --- code/io/keycontrol.h	(revision 7218)
    +++ code/io/keycontrol.h	(working copy)
    @@ -21,6 +21,8 @@
     extern int Dead_key_set_size;
     extern bool Perspective_locked;
     
    +extern bool quit_mission_popup_shown;
    +
     typedef struct button_info
     {
     	int status[NUM_BUTTON_FIELDS];
    
    patch file icon mantis2446-patch.patch (2,340 bytes) 2011-05-30 13:35 +

-Relationships
+Relationships

-Notes

~0012695

Fury (reporter)

Forgot to say that the recovery from pause is slower the more particles were generated when game was paused.

~0012699

Fury (reporter)

I further tested the pause problem and I have to correct myself. This doesn't occur with pause, only with esc menu.

You see, if you press pause, you get Got event GS_EVENT_PAUSE_GAME (6) in state GS_STATE_GAME_PLAY (2)
If you press it again, you get Got event GS_EVENT_PREVIOUS_STATE (7) in state GS_STATE_GAME_PAUSED (3)

But if you press esc instead, game state does not change. I suspect this means all scripts are left in running state and when you resume the game, everything that your scripts have been working while esc menu was on, is getting thrown in at once. No idea at this time if this is limited to scripts or whether it does affect tabled particle generation too.

~0012700

m_m (developer)

I traced the code responsible for the popup and it calls gr_flip() which causes the CHA_ONFRAME scripting hook to be run. Disabling this hook as long as the popup is shown fixes the problem.
Patch is attached.

~0012701

The_E (administrator)

Patch committed to trunk in revision 7219
+Notes

-Issue History
Date Modified Username Field Change
2011-05-29 12:49 Fury New Issue
2011-05-29 12:50 Fury Note Added: 0012695
2011-05-30 12:38 Fury Note Added: 0012699
2011-05-30 13:35 m_m File Added: mantis2446-patch.patch
2011-05-30 13:36 m_m Note Added: 0012700
2011-05-30 14:47 The_E Note Added: 0012701
2011-05-30 14:48 The_E Status new => resolved
2011-05-30 14:48 The_E Fixed in Version => 3.6.13
2011-05-30 14:48 The_E Resolution open => fixed
2011-05-30 14:48 The_E Assigned To => The_E
+Issue History