{"id":35,"date":"2012-05-16T06:55:42","date_gmt":"2012-05-16T04:55:42","guid":{"rendered":"https:\/\/blogs.scummvm.org\/jakimushka\/?p=35"},"modified":"2022-04-18T06:59:51","modified_gmt":"2022-04-18T04:59:51","slug":"new-recording-format","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/jakimushka\/2012\/05\/16\/new-recording-format\/","title":{"rendered":"New recording format"},"content":{"rendered":"<p>Last 2 weeks I&#8217;ve worked on developing of format for holding recorded gameplay data. Why this needed and how does it work you may read under the cut.<\/p>\n<p>In first versions I wrote without formatting and then just read it in same order to the written. It worked, but wasn&#8217;t flexible and hadn&#8217;t any abilities to provide backward compatiblity in future. And there was a problem with navigation between file sections: for example, file has a header section, a section with info about autor and a section with gameplay data.<br \/>\nSo, it was necessary to find the way to structure the data. I thought that the \u00a0most appropriate format for current purposes is the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Resource_Interchange_File_Format\" target=\"_blank\" rel=\"noopener\">RIFF<\/a>, i.e. use containers with fields of unique identifier and size for every file section. It give us opportunity to find identify any section in file. Also we can easily skip any unsupported section.<\/p>\n<p>Now file has following sections:<\/p>\n<pre>PBCK \/\/format id, length = file length - 8\r\n     VERS \/\/version of recorder\r\n     HEAD \/\/Header, contains unnecessary info about author\r\n          HAUT \/\/Author's name\r\n          HCMT \/\/Comments\r\n     HASH \/\/table of MD5 hash of game files\r\n          HRCD \/\/record for one file\r\n               HNAM \/\/name\r\n               HMD5 \/\/MD5 hash  \r\n     RNDM \/\/Seeds for random number generator      \r\n     SETT  \/\/Game's settings\r\n          SKEY \/\/Name of setting\r\n          SVAL \/\/Value of setting\r\n     RCDS \/\/Gameplay data\r\nRCDS section always has 0 in size field, because isn't possible to calculate it during the recording.<\/pre>\n<p>To process this file, I wrote state machine which may be illustrated by following diagramm:<\/p>\n<p><a href=\"https:\/\/blogs.scummvm.org\/jakimushka\/wp-content\/uploads\/sites\/21\/2022\/04\/schart.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-36\" src=\"https:\/\/blogs.scummvm.org\/jakimushka\/wp-content\/uploads\/sites\/21\/2022\/04\/schart.png\" alt=\"\" width=\"640\" height=\"354\" srcset=\"https:\/\/blogs.scummvm.org\/jakimushka\/wp-content\/uploads\/sites\/21\/2022\/04\/schart.png 640w, https:\/\/blogs.scummvm.org\/jakimushka\/wp-content\/uploads\/sites\/21\/2022\/04\/schart-300x166.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last 2 weeks I&#8217;ve worked on developing of format for holding recorded gameplay data. Why this needed and how does it work you may read under the cut. In first versions I wrote without formatting and then just read it in same order to the written. It worked, but wasn&#8217;t flexible and hadn&#8217;t any abilities [&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-35","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/jakimushka\/wp-json\/wp\/v2\/posts\/35","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/jakimushka\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/jakimushka\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/jakimushka\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/jakimushka\/wp-json\/wp\/v2\/comments?post=35"}],"version-history":[{"count":2,"href":"https:\/\/blogs.scummvm.org\/jakimushka\/wp-json\/wp\/v2\/posts\/35\/revisions"}],"predecessor-version":[{"id":38,"href":"https:\/\/blogs.scummvm.org\/jakimushka\/wp-json\/wp\/v2\/posts\/35\/revisions\/38"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/jakimushka\/wp-json\/wp\/v2\/media?parent=35"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/jakimushka\/wp-json\/wp\/v2\/categories?post=35"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/jakimushka\/wp-json\/wp\/v2\/tags?post=35"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}