Open main menu

Difference between revisions of "Advanced Engine Features"

Line 169: Line 169:
===Loading/Saving during run time===
===Loading/Saving during run time===
'''What is this about?'''<br>
'''What is this about?'''<br>
TODO
The GMM optionally can display two buttons "Load" and "Save" which permit the user to load/save gamestates at any time the Engine chooses to allow so. This is in addition to whatever other GUI the engine offers for loading/saving. The main purpose is to provide a uniform way to the user to load/save in all games.
 
In the future, this could also be used to implement generic auto-saving support; or generic quick-save / quick-load support.


'''How to implement it'''<br>
'''How to implement it'''<br>
TODO
Unlike to the other features presented above, this is an ability of your Engine subclass, not of MetaEngine. First thing, you have to advertise the abilities of your engines with the appropriate engine feature flags. You can implement only loading, or only saving, or both.
 
Next, for each of the two, you have to implement two Engine methods (so up to four). We focus on adding loading support here: For that, first implement Engine::canLoadGameStateCurrently(). This method should only return true if loading a savestate is possible right now. If this is always possible, just always return true. But if loading is not possible at some points, say while a cutscene is playing, make it return false at these times.
Next,  the Engine::loadGameState() is used to request the loading of a specific saveslot. The GMM will invoke this method with a valid save slot, then hide itself. If there is an immediate error, you can indicate so with its return value (for details, refer to the doxygen comments), in which case the GMM will show an appropriate error dialog. You may delay the actual loading (that's what the SCUMM engine does, for example), but then you have to handle any occurring errors yourself (in particular, show an informative error dialog to the user).


'''Relevant Engine API'''
'''Relevant Engine API'''
1,079

edits