GithubHelp home page GithubHelp logo

jeremyosborne / confetti-pigs-in-space Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 26.53 MB

an experiment with phaser

Home Page: http://jeremyosborne.com/confetti-pigs-in-space/

HTML 12.39% TypeScript 87.49% Shell 0.12%

confetti-pigs-in-space's Introduction

confetti pigs in space

I originally made this game for my son, and then I played it more than he did.

Development

One time

Dev server

npm start

Production build

npm run build

Test the built files with:

npx http-server ./dist

Notes

  • TypeScript as programming language.
  • Phaser as game engine.
  • Webpack as code bundle-orchestration.
  • Github Pages for hosting.
  • Code and artifact organization:
    • ./.env.example: contains documentation of all environment variables that can be passed at build time. The majority of environment variables are for developer convenience are not used during production builds.
    • ./.env: if included (presumed via copy-paste from .env.example), will be used during build time.
    • ./src: contents processed in some way and become transpiled output.
    • ./static: not processed, but required in the output.'
      • ./static/assets: game assets (images, sounds, etc.) live here.
        • Use relative references to assets in game, as the final deploy will be in an application document root, not the absolute path of the url.
    • ./dist: target folder, becomes the application root of the final build.
  • Code builds:
    • Development:
      • webpack-dev-server for code watching and application hosting.
      • Push work in progress changes to main.
    • Production:
      • Push main to release to publish a new version of the game.
      • Github actions run to build the code and push the changes into the gh-pages branch, which will be made available via Github Pages.

Game notes

  • Phaser is used mainly for rendering and entity management.
  • Phaser arcade physics is used for motion and collision management.

Other acknowledgements and Credits

Known issues / historical notes

  • .nvmrc and package.json#engines need to be kept in sync manually.
  • .tsconfig.json is contorted to support both a node build environment with a TypeScript config for webpack and the needs of our application.
  • Note on choice of webpack: had trouble using rollup or plain tsc with phaser output, so picked out a simple webpack config and things seem to "just work."
  • Phaser will cause webpack to complain (appropriately) about artifact size, and I have not investigated tree shaking or partial builds for Phaser.
  • The webpack dev server does not watch the following files and will need a manual restart:
    • .env
    • ./src/app/types/* global types
  • The game code does not watch browser resize events.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.