Saturday Day 2: Scaffolding Modules


image.png

I spent another day working on infrastructure rather than actually making the game. To be fair to myself, I really wanted to use this jam as a reason to write infrastructure, but as I mentioned yesterday I didn’t realize how much time had passed since I’d last looked at this.

Today’s achievements were beginning to port the VIEWPORT, RENDERER, GAMESTATE, and GAMELOOP modules, and getting a really simple ThreeJS WebGL view to draw based on my own simulation timestep. I basically grabbed the first tutorial on the ThreeJS site and shoved it into my module structure.

It took several hours of details to nail down some of the component initialization dependencies (clearly needs work), as well as finding new bugs in the underlying framework I’m adapting from work. The HMR is now very solid so iteration should be much easier. I’ve also extended some of the “building-block” logic for creating a component-based game system. The key implementation is that now I have the phase-based hook system in place:

const PM = new PhaseMachine('UWORLD', {
  INIT: [],
  LOOP_BEGIN: [
    'CHECKS', // game checks
    'REFEREE' // game referee decisions
  ],
  LOOP_CALC: [
    'INPUT', // player, world inputs
    'UPDATE', // autonomous updates (timers)
    'PHYSICS', // physics sweep
    'CONDITIONS' // game trigger checks
  ],
  LOOP_THINK: [
    'THINK', // individual piece AI
    'OVERTHINK', // group manager AI
    'EXECUTE' // deferred actions, if any
  ],
  LOOP_RENDER: [
    'DRAW_WORLD', // threejs draw world
    'DRAW_UI', // draw UI elements over world
    'PLAY_SOUND' // play sound effects
  ],
  END: []
});

Creating the Piece classes and their Visual representations is next, as well as Viewport and Renderpass support for the various managers, each which can tap into the right place of the gameloop. Hopefully it goes well.

Files

sna-underworld.zip Play in browser
5 days ago

Get "Star Digger" Movement Demo

Leave a comment

Log in with itch.io to leave a comment.