Git Product home page Git Product logo

menja's Introduction

Menja

A game about smashing cubes.

Development Commands

If cloning repo fresh, first install dev dependencies with:

yarn

To launch a live reloading dev server, run:

yarn start

To perform an optimized final build, run:

yarn build

To perform a special build that concatenates all JS for CodePen, run:

yarn build:codepen

Adding New JS files

New JS files must be linked directly in index.html. Order matters based on dependencies.

I'm not using a bundler so that I have complete control over all generated code (it's only an IIFE).

However, microbundle could be worth considering.

Build optimizations

All JS is:

  1. Combined into a single file
  2. Stripped of performance monitoring code
  3. Wrapped in an IIFE to keep global game vars private and mangle-able
  4. Run through a minifier/compiler
  5. Inlined directly into index.html

All CSS is minified and inlined.

HTML is minified.

Unit Tests

Test files should be added at the bottom of index.html with the other tests.

All tests will be run in the browser during development using a custom test runner. All tests, and the test runner itself are stripped out for final builds.

Assertions make use of @mjackson's expect library.

Performance Monitoring

Included is a system for tracking performance of various subroutines and displaying the data in an on screen overlay. This is very helpful when running on various mobile devices in the wild.

Enabling & Disabling Performance Monitoring

To enable, set the value of showPerfMonitor to true in PERF.js. To disable, set to false.

Changing What is Monitored

Three functions are exposed by PERF.js:

  • PERF_START
  • PERF_END
  • PERF_UPDATE

PERF_UPDATE simply displays the performance timing output. It is called automatically in draw.js.

To monitor a new subroutine, call:

PERF_START('name-of-subroutine');

at the start of the subroutine, and at the end call:

PERF_END('name-of-subroutine');

Always use single quotes for the name string, or the function invokation won't be removed for production build.

Care should also be taken to only use a subroutine name once throughout the entire program. If a name is reused, multiple subroutines will have their run times averaged.

menja's People

Contributors

milllertime avatar dependabot[bot] avatar

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.