Fabrefact

a blog by Sara Farquharson

Virtual Party Space Devlog #11: Refactoring

Today I continue resolving bugs, but also start refactoring my spaghetti code and looking into resources to make a character creator.

Log

  • local user DOM elements weren’t being removed because by the time it was called calla.localUserId was reset, so just unload all elements on leave
  • username wasn’t being loaded because I had hardcoded username to empty string before I figured out where to get username from! RESOLVED
  • video wasn’t being loaded on conference join because I was calling setPreferredDevice with ID, instead of MediaDevicInfo object
    • audio still autoloaded because Calla passes in a flag to try loading even if preferred device not set
      • this is why I unexpectedly had audio feedback issues
    • video is passed with flag to only use preferred device, so have to set it first RESOLVED
  • need to make select box update when Calla updates audio source by other means RESOLVED
  • want option to mute, since can’t prevent audio from loading RESOLVED
    • might still be broken, sometimes the mute flag gets reversed, can’t quite pin down why

UI/Game

  • trying to resolve the circular reference problem, here is the plan:
    • refactor GameScene out of main.ts
    • refactor most of Conference.ts into a class
      • all references to Calla contained here
    • move random non-class code from Conference into main
      • main imports Conference class, all current function calls turned into conf. calls
    • Conference class has GameScene member
      • adds event listeners on important GameScene events (and GridPhysics?)
        • update
        • movePlayerSprite
      • can call GameScene methods directly to send info the other way

Character Creator

About this series

Back in mid-December I started an ambitious project to create a custom platform for a virtual birthday party in February. I kept notes on my progress, both for personal reference and to turn into a series of blog posts. It quickly became apparent that I did not have time to both do the project and blog about the project. I have retroactively decided to post my raw notes as a dev log.