Introducing Replay: a cross-platform JS game engine inspired by React

Introducing Replay: a cross-platform JS game engine inspired by React

Today I’m publishing a new open-source library for creating games: Replay.

I’ve built many indie games over the years (such as The Impossible Game). I’ve also built many web apps using React.

Replay takes the ideas and concepts that makes React such a great library for building user interfaces, and brings them to game development. Take a look at how Replay manages state and rendering through a declarative API:

const Player = makeSprite({
  init() {
    // Initial state
    return {
      posX: 0,
      posY: 0,
    };
  },

  loop({ state }) {
    // Return new state at 60 fps
    return {
      posX: state.posX + 1,
      posY: state.posY + 1,
    };
  },

  render({ state }) {
    // Draw a circle based on current state
    return [
      t.circle({
        position: {
          x: state.posX,
          y: state.posY,
        },
        color: "#147aff",
        radius: 10,
      }),
    ];
  },
});

Check out the docs on how to quickly get setup with a new JavaScript or TypeScript project, and then deploy to the web or iOS.

I hope you enjoy using it to build some new games!

Leave a Reply

Your email address will not be published.