{"id":43,"date":"2020-07-20T16:26:29","date_gmt":"2020-07-20T16:26:29","guid":{"rendered":"https:\/\/blogs.scummvm.org\/npjg\/?p=43"},"modified":"2022-05-23T16:27:22","modified_gmt":"2022-05-23T16:27:22","slug":"lots-of-chop-suey","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/npjg\/2020\/07\/20\/lots-of-chop-suey\/","title":{"rendered":"Lots of chop suey"},"content":{"rendered":"<p>Hey there!<\/p>\n<p>My big showcase for the week\u2019s work is a few scenes from the kids\u2019 game Chop Suey, one of our primary Director 4 test cases:<\/p>\n<div>\n<div style=\"width: 480px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-43-1\" width=\"480\" height=\"360\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/blogs.scummvm.org\/npjg\/wp-content\/uploads\/sites\/30\/2022\/05\/Chop-Suey-Demo-kGMHHfJx8AU.mp4?_=1\" \/><a href=\"https:\/\/blogs.scummvm.org\/npjg\/wp-content\/uploads\/sites\/30\/2022\/05\/Chop-Suey-Demo-kGMHHfJx8AU.mp4\">https:\/\/blogs.scummvm.org\/npjg\/wp-content\/uploads\/sites\/30\/2022\/05\/Chop-Suey-Demo-kGMHHfJx8AU.mp4<\/a><\/video><\/div>\n<p><em>(Source: https:\/\/www.youtube.com\/watch?v=kGMHHfJx8AU)<\/em><\/p>\n<\/div>\n<p>Just a few weeks ago, Chop Suey ran at an almost unplayable crawl in ScummVM. Part of this was its reliance on Matte inks, for which I implemented a simple surface caching scheme and shaved about 20% off our buildbot\u2019s target test time for Spaceship Warlock. This also made Chop Suey run much faster, though it still consumed CPU<\/p>\n<p>Last week I called Chop Suey a Lingo-heavy game, and I was referring to how much it controls animation via puppets and the\u00a0<code>updateStage<\/code>\u00a0command. Because, as you saw, its cursors are bitmaps and certainly do not fit in the standard 16&#215;16 Macintosh cursor box, Chop Suey introduces its own mouse update code and calls for the stage to be updated several dozen times each frame. Most of the inefficiencies were here.<\/p>\n<p>I spent the early part of the week in much trial-and-error, working out the pieces of the renderer that were most inefficient under such repeated application. The idea is to do a little bit of work up front \u2013 checking flags and so forth \u2013 so the expense of redrawing a region of the screen is saved. (As I have realized, even when working on Chop Suey, very subtle bugs can arise from forgetting to check a rendering flag.) Even at usual framerates without much Lingo that doesn\u2019t matter very much, but Lingo-heavy games like Chop Suey have shown dramatic improvement.<\/p>\n<p>I also implemented another feature that is notable in Chop Suey by its absence. I said that Chop Suey does its own cursor handling. Well, the window manager was still drawing a regular cursor atop the bitmap, which looked pretty ugly. Near the end of the week, though, I added a flexible cursor class for the three cursor types Director can use: built-in cursors, cast (bitmap) cursors, and resource cursors. The last type is important for Majestic: Alien Encounter, but I haven\u2019t seen custom cursors used much elsewhere. It was fun to implement, though. As a nice byproduct in Chop Suey, the default cursor is now properly turned off.<\/p>\n<p>Oh, and I also spent most of a day trying to discover why some textboxes in Spaceship Warlock weren\u2019t rendering properly, along with some other nettling MacGUI issues. The issue actually lay in the cast loading code, which I hadn\u2019t touched much, but it\u2019s always satisfying to squash a bug and learn more about the codebase in the process \u2013 even if your \u201cfix\u201d breaks other stuff. \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey there! My big showcase for the week\u2019s work is a few scenes from the kids\u2019 game Chop Suey, one of our primary Director 4 test cases: (Source: https:\/\/www.youtube.com\/watch?v=kGMHHfJx8AU) Just a few weeks ago, Chop Suey ran at an almost unplayable crawl in ScummVM. Part of this was its reliance on Matte inks, for which [&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-43","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/npjg\/wp-json\/wp\/v2\/posts\/43","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/npjg\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/npjg\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/npjg\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/npjg\/wp-json\/wp\/v2\/comments?post=43"}],"version-history":[{"count":1,"href":"https:\/\/blogs.scummvm.org\/npjg\/wp-json\/wp\/v2\/posts\/43\/revisions"}],"predecessor-version":[{"id":44,"href":"https:\/\/blogs.scummvm.org\/npjg\/wp-json\/wp\/v2\/posts\/43\/revisions\/44"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/npjg\/wp-json\/wp\/v2\/media?parent=43"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/npjg\/wp-json\/wp\/v2\/categories?post=43"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/npjg\/wp-json\/wp\/v2\/tags?post=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}