{"id":106,"date":"2014-07-08T08:36:52","date_gmt":"2014-07-08T08:36:52","guid":{"rendered":"https:\/\/blogs.scummvm.org\/uruk\/?p=106"},"modified":"2022-05-22T18:47:31","modified_gmt":"2022-05-22T18:47:31","slug":"save-and-load-system","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/uruk\/2014\/07\/08\/save-and-load-system\/","title":{"rendered":"Save and load system"},"content":{"rendered":"<p>Hi everybody! \ud83d\ude42<\/p>\n<p>My last week&#8217;s progress is mainly centered around the save and load system. I had a couple of difficulties, but now CGE2 engine supports almost every\u00a0<a href=\"http:\/\/wiki.scummvm.org\/index.php\/Advanced_Engine_Features\" target=\"_blank\" rel=\"noopener\">Advanced Engine Features<\/a>. I only left out &#8220;Return to Launcher&#8221; support, since the engine still have a lot of memory leak issues (even through I managed to solve a couple of them) needed to be fixed before that.<\/p>\n<div class=\"separator\"><img decoding=\"async\" src=\"https:\/\/blogs.scummvm.org\/uruk\/wp-content\/uploads\/sites\/48\/2022\/05\/saveload-1.png\" \/><\/div>\n<p>So as I said, now it&#8217;s possible to load a gamestate via the launcher, or even do saving or loading in-game. I plan to also implement an autosave functionality, similar to the one implemented in CGE1, but for now it works and that&#8217;s totally enough for debugging and the translation works of Arnaud.<br \/>\nI&#8217;ve got a couple of hardships during the implementation of this subsystem, but ScummVM&#8217;s built-in\u00a0<a href=\"http:\/\/doxygen.scummvm.org\/d8\/dbb\/classCommon_1_1Serializer.html\" target=\"_blank\" rel=\"noopener\">Common::Serializer<\/a>\u00a0class helped me a lot and spared me a great deal of time by hiding the actual stream operations behind an abstract interface. Since the original game only supports saving when exiting the game, and loading when starting it, I had to make so modifications in the engine itself to make it possible to save\/load anytime during gameplay. But knowing the internal workings of the engine, it was quite straightforward. The hardest part was to rework\u00a0<a href=\"https:\/\/github.com\/urukgit\/scummvm\/blob\/cge2\/engines\/cge2\/spare.cpp\" target=\"_blank\" rel=\"noopener\">Spare<\/a>\u00a0and the way it&#8217;s used, so now it&#8217;s not just a temporary container for some of the sprites in the game, but a big catalog, which stores every Sprite used by the engine, all the time, so most of the synchronization work is to keep Spare up to date.<\/p>\n<p>Otherwise, I mostly spent my time with annoying and hard to find bugfixes like this\u00a0<a href=\"https:\/\/github.com\/urukgit\/scummvm\/commit\/10a37ea478050c37d368f31815fb189f4c7af7b1\" target=\"_blank\" rel=\"noopener\">miracle<\/a>.<\/p>\n<p>During the past week, Arnaud went on a translation-frenzy. \ud83d\ude00 Thanks to him, almost all of\u00a0<a href=\"http:\/\/wiki.scummvm.org\/index.php\/SfinxSolution\" target=\"_blank\" rel=\"noopener\">the scenes of the game<\/a>\u00a0(Warning, spoiler alert!) are reachable\/finishable. I just can&#8217;t express my gratitude toward him. \ud83d\ude42<\/p>\n<p>My plans for the upcoming week is more bugfixes and even more taking care of various Valgrind errors, provided generously by David, what I am still really thankful for. \ud83d\ude42<\/p>\n<p>See you soon!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi everybody! \ud83d\ude42 My last week&#8217;s progress is mainly centered around the save and load system. I had a couple of difficulties, but now CGE2 engine supports almost every\u00a0Advanced Engine Features. I only left out &#8220;Return to Launcher&#8221; support, since the engine still have a lot of memory leak issues (even through I managed to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-106","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/uruk\/wp-json\/wp\/v2\/posts\/106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/uruk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/uruk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/uruk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/uruk\/wp-json\/wp\/v2\/comments?post=106"}],"version-history":[{"count":1,"href":"https:\/\/blogs.scummvm.org\/uruk\/wp-json\/wp\/v2\/posts\/106\/revisions"}],"predecessor-version":[{"id":107,"href":"https:\/\/blogs.scummvm.org\/uruk\/wp-json\/wp\/v2\/posts\/106\/revisions\/107"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/uruk\/wp-json\/wp\/v2\/media?parent=106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/uruk\/wp-json\/wp\/v2\/categories?post=106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/uruk\/wp-json\/wp\/v2\/tags?post=106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}