RE: [GD-General] longjmp for C++
Brought to you by:
vexxed72
From: Daniel V. <vo...@ep...> - 2002-01-09 19:12:57
|
What Secret Level did for the DreamCast version of Unreal Tournament was reloading the section of the executable that contains the global variables and resetting the heap for level changes. On PS2 and XBox we simply "reboot". Of course this is all console stuff ;) If it's a PC game: not only do you have to worry about the memory you allocate dynamically but also resources like textures, open files and whatnot in the case where you can't guarantuee everything is completly loaded after init (e.g. in a multiplayer game a player joins with a different player skin). -- Daniel, Epic Games Inc. > -----Original Message----- > From: gam...@li... > [mailto:gam...@li...]On Behalf Of > Thatcher Ulrich > Sent: Wednesday, January 09, 2002 1:47 PM > To: Gam...@li... > Subject: Re: [GD-General] longjmp for C++ > > > On Jan 09, 2002 at 12:31 -0600, Corrinne Yu wrote: > > Out of curiosity, what are you using longjmp/setjmp for? > > > > -- Daniel, Epic Games Inc. > > > > -- It can be a convenient/lazy :) way to restart a clean game. > > > > -- You set jump after all the startup but before game specific code. > > Then when a game ends, you can just long jump back to the state after > > startup but before game code. You can use the same idea to rewind a game > > (after game data loaded, but before any game play changes has started). > > > > -- Another way (which is the way it is done now) is to do a full cleanup > > after game ends and manually restores state to start up but before game > > data load. > > > > -- The lazy jump way of restarting is only safe for a pure C app. Our > > code base has now a lot of C++ classes and need to have their objects be > > destroyed and constructed properly. Long jump is not guaranteed to do > > that correctly. > > Neither setjmp/longjmp nor exceptions are going to do anything for > your heap, though, correct? Which seems like the much tougher issue. > > -- > Thatcher Ulrich <tu...@tu...> > http://tulrich.com > > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > |