{"id":65,"date":"2023-07-06T15:22:51","date_gmt":"2023-07-06T15:22:51","guid":{"rendered":"https:\/\/blogs.scummvm.org\/hax0kartik\/?p=65"},"modified":"2023-07-08T03:54:11","modified_gmt":"2023-07-08T03:54:11","slug":"working-on-save-game-support","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/hax0kartik\/2023\/07\/06\/working-on-save-game-support\/","title":{"rendered":"Working on save game support"},"content":{"rendered":"<p>Hi all, past week&#8217;s progress has also been slow due to health issues. However, I have started the work on adding savegame support.<\/p>\n<p>The rationale behind this step was that it would help cover more stages\/levels during tests, since till now, I <strong>have not<\/strong> tested past stage 3. Once the savegame implementation is done, I and my mentors would be able to create savegames at different stages which we could share and test if every stage is working as expected.<\/p>\n<p>Coming to the topic of CRAB&#8217;s save system, it works by dumping the state of <em>all the game objects<\/em> to an XML file which is later read to instantiate the various objects according to the values when the savefile is loaded. This includes dialogues of various characters present in the level. I found this to be <em>weird<\/em> because if I had to design a save system, I would only save the level number and when that would be loaded, the character dialogues would get loaded in as well.<\/p>\n<p>Anyways, I was able to port the save system to be compatible with ScummVM but immediately there were some noticeable problems.<\/p>\n<p>The very first problem was that font rendering in the loading menu is broken due to some reason(The glyphs for some strings are not rendered properly)<\/p>\n<figure id=\"attachment_66\" aria-describedby=\"caption-attachment-66\" style=\"width: 580px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-66\" src=\"https:\/\/blogs.scummvm.org\/hax0kartik\/wp-content\/uploads\/sites\/68\/2023\/07\/image-1024x603.png\" alt=\"\" width=\"580\" height=\"342\" srcset=\"https:\/\/blogs.scummvm.org\/hax0kartik\/wp-content\/uploads\/sites\/68\/2023\/07\/image-1024x603.png 1024w, https:\/\/blogs.scummvm.org\/hax0kartik\/wp-content\/uploads\/sites\/68\/2023\/07\/image-300x177.png 300w, https:\/\/blogs.scummvm.org\/hax0kartik\/wp-content\/uploads\/sites\/68\/2023\/07\/image-768x452.png 768w, https:\/\/blogs.scummvm.org\/hax0kartik\/wp-content\/uploads\/sites\/68\/2023\/07\/image-1200x706.png 1200w, https:\/\/blogs.scummvm.org\/hax0kartik\/wp-content\/uploads\/sites\/68\/2023\/07\/image.png 1286w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><figcaption id=\"caption-attachment-66\" class=\"wp-caption-text\">Broken font rendering<\/figcaption><\/figure>\n<p>Next, due to the way keymapper has been implemented, when inputting the save name, certain keys get skipped. For example, when typing in &#8220;kartik&#8221; only &#8220;kark&#8221; gets processed since both &#8220;T&#8221; and &#8220;I&#8221; are bound to some game actions.<\/p>\n<p>To remedy these bugs, I decided that I would simply replace both the save menu and load menu with ScummVM&#8217;s GMM load\/save menus. This required a lot of changes to the save system but I was able to get it done. Pressing the save\/load button would now open ScummVM&#8217;s load\/save menus and not the original ones.<\/p>\n<figure id=\"attachment_74\" aria-describedby=\"caption-attachment-74\" style=\"width: 580px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-74 size-large\" src=\"https:\/\/blogs.scummvm.org\/hax0kartik\/wp-content\/uploads\/sites\/68\/2023\/07\/imgonline-com-ua-twotoone-Uew633YdsB-1024x302.jpg\" alt=\"\" width=\"580\" height=\"171\" srcset=\"https:\/\/blogs.scummvm.org\/hax0kartik\/wp-content\/uploads\/sites\/68\/2023\/07\/imgonline-com-ua-twotoone-Uew633YdsB-1024x302.jpg 1024w, https:\/\/blogs.scummvm.org\/hax0kartik\/wp-content\/uploads\/sites\/68\/2023\/07\/imgonline-com-ua-twotoone-Uew633YdsB-300x88.jpg 300w, https:\/\/blogs.scummvm.org\/hax0kartik\/wp-content\/uploads\/sites\/68\/2023\/07\/imgonline-com-ua-twotoone-Uew633YdsB-768x226.jpg 768w, https:\/\/blogs.scummvm.org\/hax0kartik\/wp-content\/uploads\/sites\/68\/2023\/07\/imgonline-com-ua-twotoone-Uew633YdsB-1536x453.jpg 1536w, https:\/\/blogs.scummvm.org\/hax0kartik\/wp-content\/uploads\/sites\/68\/2023\/07\/imgonline-com-ua-twotoone-Uew633YdsB-2048x604.jpg 2048w, https:\/\/blogs.scummvm.org\/hax0kartik\/wp-content\/uploads\/sites\/68\/2023\/07\/imgonline-com-ua-twotoone-Uew633YdsB-1200x354.jpg 1200w, https:\/\/blogs.scummvm.org\/hax0kartik\/wp-content\/uploads\/sites\/68\/2023\/07\/imgonline-com-ua-twotoone-Uew633YdsB-1980x583.jpg 1980w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><figcaption id=\"caption-attachment-74\" class=\"wp-caption-text\">Improved load\/save menus<\/figcaption><\/figure>\n<p>While this does work as expected, my mentors want me to keep the original menus so that the user can use the original menus if they wish to do so.<\/p>\n<p>This is all that I was able to accomplish this week. While savegames do work, a lot of changes still need to be made before it can be called complete. Thanks for reading!<\/p>\n<p><em>PS: On a personal note, I would like to dedicate all the further work and the work till now to my grandmother whom I lost this week. I hope I continue to make you proud!<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi all, past week&#8217;s progress has also been slow due to health issues. However, I have started the work on adding savegame support. The rationale behind this step was that it would help cover more stages\/levels during tests, since till now, I have not tested past stage 3. Once the savegame implementation is done, I [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-65","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/hax0kartik\/wp-json\/wp\/v2\/posts\/65","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/hax0kartik\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/hax0kartik\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/hax0kartik\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/hax0kartik\/wp-json\/wp\/v2\/comments?post=65"}],"version-history":[{"count":9,"href":"https:\/\/blogs.scummvm.org\/hax0kartik\/wp-json\/wp\/v2\/posts\/65\/revisions"}],"predecessor-version":[{"id":78,"href":"https:\/\/blogs.scummvm.org\/hax0kartik\/wp-json\/wp\/v2\/posts\/65\/revisions\/78"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/hax0kartik\/wp-json\/wp\/v2\/media?parent=65"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/hax0kartik\/wp-json\/wp\/v2\/categories?post=65"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/hax0kartik\/wp-json\/wp\/v2\/tags?post=65"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}