{"author_link":"\/users\/daanvanyperen","author_name":"daanvanyperen","author_uid":"daanvanyperen","comments":[],"epoch":1494266029,"event":"LD38","format":"md","ldjam_node_id":30539,"likes":5,"metadata":{"p_key":"93051","p_author":"daanvanyperen","p_authorkey":"1006977","p_urlkey":"305969","p_title":"Little Fortune Planet Breakdown - Part 5: Performance Persmormanche!","p_cat":"LDJam ","p_event":"LD38","p_time":"1494266029","p_likes":"5","p_comments":"0","p_status":"WAYBACK","us_key":"1006977","us_name":"daanvanyperen","us_username":"daanvanyperen","event_start":"1492732800","event_key":"69","event_name":"LD 38"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD38","removed_author":false},"_superparent":9405,"_trust":1,"author":6977,"body":"**Continued from [part 4](https:\/\/ldjam.com\/events\/ludum-dare\/38\/little-fortune-planet\/little-fortune-planet-breakdown-part-4-how-to-dunk-minions-in-lava).**\n\n### Part 5: Performance Persmormanche!\n\n**Uh-oh. Trouble! The browser simulation runs at slideshow speed**. To be expected given the naive implementation. Besides going for a more technically sensible solution, how about we try to improve what we have.\n\nFirst we start by **freezing cells that don't need attention**. Eventually we could keep track of a queue of cells that demand attention, but given the available time we decided to give each cell a sleep counter and skip the simulation subsystem for that cell if it is asleep. **Things like dirt can typically sleep for multiple frames** without affecting the simulation much.\n\n![Q9VxPhc.png](\/\/\/raw\/14b\/1\/z\/4174.png)\n\nWhat if we only run **half the simulation each frame**? We can **double the simulation performance by interlacing**; calculating all even rows on frame 1, all odd rows on frame 2, etc.\n\n![image23.gif](\/\/\/raw\/14b\/1\/z\/4175.gif)\n![image6.gif](\/\/\/raw\/14b\/1\/z\/4176.gif)\n\nLuckily **the simulation seems visually identical**. Can you spot the difference? This pushes the game outside the slideshow experience. **Still slow, but it will do!**\n\n**Continued in [part 6: Finishing touches, deck of cards!](https:\/\/ldjam.com\/events\/ludum-dare\/38\/little-fortune-planet\/little-fortune-planet-breakdown-part-6-finishing-touches-deck-of-cards) or [play it here](https:\/\/ldjam.com\/events\/ludum-dare\/38\/little-fortune-planet)!**\n","comments":0,"created":"2017-05-08T17:52:20Z","files":[],"files-timestamp":0,"id":30539,"love":5,"love-timestamp":"2017-05-09T17:38:16Z","meta":[],"modified":"2017-05-09T17:38:16Z","name":"Little Fortune Planet Breakdown - Part 5: Performance Persmormanche!","node-timestamp":"2017-05-09T15:17:21Z","parent":21490,"parents":[1,5,9,9405,21490],"path":"\/events\/ludum-dare\/38\/little-fortune-planet\/little-fortune-planet-breakdown-part-5-performance-persmormanche","published":"2017-05-08T17:53:49Z","scope":"public","slug":"little-fortune-planet-breakdown-part-5-performance-persmormanche","subsubtype":"","subtype":"","type":"post","version":80816},"node_metadata":{"n_key":"30539","n_urlkey":"305969","n_parent":"21490","n_path":"\/events\/ludum-dare\/38\/little-fortune-planet\/little-fortune-planet-breakdown-part-5-performance-persmormanche","n_slug":"little-fortune-planet-breakdown-","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"6977","n_created":"1494265940","n_modified":"1494351496","n_version":"80816","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/38\/little-fortune-planet\/little-fortune-planet-breakdown-part-5-performance-persmormanche","text":"**Continued from [part 4](https:\/\/ldjam.com\/events\/ludum-dare\/38\/little-fortune-planet\/little-fortune-planet-breakdown-part-4-how-to-dunk-minions-in-lava).**\n\n### Part 5: Performance Persmormanche!\n\n**Uh-oh. Trouble! The browser simulation runs at slideshow speed**. To be expected given the naive implementation. Besides going for a more technically sensible solution, how about we try to improve what we have.\n\nFirst we start by **freezing cells that don't need attention**. Eventually we could keep track of a queue of cells that demand attention, but given the available time we decided to give each cell a sleep counter and skip the simulation subsystem for that cell if it is asleep. **Things like dirt can typically sleep for multiple frames** without affecting the simulation much.\n\n![Q9VxPhc.png](\/\/\/raw\/14b\/1\/z\/4174.png)\n\nWhat if we only run **half the simulation each frame**? We can **double the simulation performance by interlacing**; calculating all even rows on frame 1, all odd rows on frame 2, etc.\n\n![image23.gif](\/\/\/raw\/14b\/1\/z\/4175.gif)\n![image6.gif](\/\/\/raw\/14b\/1\/z\/4176.gif)\n\nLuckily **the simulation seems visually identical**. Can you spot the difference? This pushes the game outside the slideshow experience. **Still slow, but it will do!**\n\n**Continued in [part 6: Finishing touches, deck of cards!](https:\/\/ldjam.com\/events\/ludum-dare\/38\/little-fortune-planet\/little-fortune-planet-breakdown-part-6-finishing-touches-deck-of-cards) or [play it here](https:\/\/ldjam.com\/events\/ludum-dare\/38\/little-fortune-planet)!**\n","title":"Little Fortune Planet Breakdown - Part 5: Performance Persmormanche!","wayback_source":[]}