{"id":286,"date":"2025-07-01T15:42:46","date_gmt":"2025-07-01T05:42:46","guid":{"rendered":"https:\/\/nonlinearexperience.com\/?p=286"},"modified":"2025-07-10T15:04:00","modified_gmt":"2025-07-10T05:04:00","slug":"the-knowledge-design-patterns","status":"publish","type":"post","link":"https:\/\/nonlinearexperience.com\/index.php\/2025\/07\/01\/the-knowledge-design-patterns\/","title":{"rendered":"Design Patterns"},"content":{"rendered":"<h1 class=\"wp-block-post-title\">Design Patterns<\/h1>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">10 reasons to use Design Patterns to design a game, 10 reasons not to, an approach to design an extensible, 2d action rpg game using vanilla javascript<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/gameprogrammingpatterns.com\">https:\/\/gameprogrammingpatterns.com<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.patterns.dev\">https:\/\/www.patterns.dev<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><span class=\"zp-InText-zp-ID--7544373---wp286 zp-InText-Citation loading\" rel=\"{ 'pages': 'np', 'items': '{7544373:}', 'format': '(%a%, %d%, %p%)', 'brackets': '', 'etal': '', 'separator': '', 'and': '' }\"><\/span>GIM6UU2V<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>architecture is about change (https:\/\/gameprogrammingpatterns.com\/architecture-performance-and-games.html)<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And also, testing\u2026<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Phaser.HEADLESS<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/dev.to\/davidmorais\/testing-phaser-games-with-vitest-3kon\">https:\/\/dev.to\/davidmorais\/testing-phaser-games-with-vitest-3kon<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Data structures<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.youtube.com\/watch?v=247cXLkYt2M&amp;list=PLRL3Z3lpLmH0TYcatLqFCeLihTmrk_V4l&amp;index=4\">Memory, Cache Locality, and why Arrays are Fast (Data Structures and Optimization)<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.youtube.com\/watch?v=jxaxyvHo8ZM&amp;list=PLRL3Z3lpLmH0TYcatLqFCeLihTmrk_V4l&amp;index=3\">Pass by Value vs Reference (JavaScript): Memory, Functions, and more!<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">pass by value &#8211; packages a copy of the values (more memory use)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">pass by ref &#8211; passes a ref to the values (less memory use)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">JS chooses it fo you\u2026&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">primitive types are passed by type, non-primitive types are done by reference<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">underscore for function names in javascript<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Spatial Hash Grids<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">problem &#8211;&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.youtube.com\/watch?v=sx4IIQL0x7c\">Spatial Hash Grids &amp; Tales from Game Development<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">optmising it:&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">LERP &#8211; Linear interpolation<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.youtube.com\/watch?v=YJB1QnEmlTs&amp;list=PLRL3Z3lpLmH0TYcatLqFCeLihTmrk_V4l&amp;index=6\">An In-Depth look at Lerp, Smoothstep, and Shaping Functions<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">smoothstep:&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXeArwzohmecQRiFbI9fAniaRSJwk4ormM0uTgZYEkZr5skjZ89gcN0HW9e5xR6IQ-Pk0mIEVb2EidIN9rMK0E_xAai6KGMIL0RvOyVIU6MfNTvLoFw8fZstt-XoaIpCyO6Uj8oNFth19URU43h5FSGXPJVI?key=qInBJpW04kC1Sm63MHgkfg\" alt=\"\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">MVC design pattern<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">controller class<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">display class<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">game class<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">engine class (utility items etc)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">AN example &#8211; <a href=\"https:\/\/www.youtube.com\/watch?v=w-OKdSHRlfA\">Create a Platformer Game with JavaScript &#8211; Full Tutorial<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Keep them as separate .js files<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Observer<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/refactoring.guru\/design-patterns\/observer\">https:\/\/refactoring.guru\/design-patterns\/observer<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/github.com\/developit\/mitt\">https:\/\/github.com\/developit\/mitt<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/gameprogrammingpatterns.com\/observer.html\">https:\/\/gameprogrammingpatterns.com\/observer.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>10 reasons to use Design Patterns to design a game, 10 reasons not to, an approach to design an extensible, 2d action rpg game using vanilla javascript https:\/\/gameprogrammingpatterns.com https:\/\/www.patterns.dev GIM6UU2V architecture is about change (https:\/\/gameprogrammingpatterns.com\/architecture-performance-and-games.html) And also, testing\u2026 Phaser.HEADLESS https:\/\/dev.to\/davidmorais\/testing-phaser-games-with-vitest-3kon Data structures Memory, Cache Locality, and why Arrays are Fast (Data Structures and Optimization) Pass [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"wp-custom-template-nlx-the-knowledge-page","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-286","post","type-post","status-publish","format-standard","hentry","category-the-knowledge"],"_links":{"self":[{"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/posts\/286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/comments?post=286"}],"version-history":[{"count":6,"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/posts\/286\/revisions"}],"predecessor-version":[{"id":459,"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/posts\/286\/revisions\/459"}],"wp:attachment":[{"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/media?parent=286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/categories?post=286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/tags?post=286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}