npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cgame

v0.1.0

Published

Low level Coffeescript + canvas + HTML5 cross-platform 2D game engine

Downloads

7

Readme

CGame

Low level Coffeescript + Canvas + HTML5 cross-platform 2D game engine.

What is CGame?

CGame is a low-level interactive framework that is intended to make 2D HTML5 games for Web, iOS, and Android.

The engine is built from the ground up with CocconJS in mind for deployment to mobile devices that can leverage hardware-accelerated 2D graphics.

In other words, write HTML5 games that work on the web, but can be deployed as native mobile apps with no code changes.

The constructs used in CGame are fairly low-level and unopinionated, primarily aimed at reducing boilerplate and providing a clean, high-performance framework on which to develop games.

Getting started

CGame is a Coffeescript library that can be installed via NPM, and designed to be built with Grunt (and thus requires both the grunt-cli and npm binaries on your system)

npm install cgame
grunt build:demo

Will output the web- and CocoonJS-ready compiled demo.

Engine Components

Game

The central app, instantiated once at app start. Handles event delegation and state management.

  • Creates the primary screen canvas
  • Maintains the stack of States
  • Delegates touch events to the active State
  • Runs the primary render loop that builds each frame from the active States Layers

State

A controller representing a particular game state, used in the FSM handled by the Game. A state would be something like TitleScreen or PauseMenu, or even UserNameInput. Only the current state will recieve the delegated touch events and is responsible for either stop()ing itself or pushing a new state.

onStart(), onPause(), and onStop() are called during state transitions that can be used for setup and tear-down.

  • Handles touch events
  • Maintains and manipulates game models and objects
  • Contains a layer stack that is drawn by the Game

The majority of the heavy lifting should be done in game States. The more modular and granular the states, the better.

Layer

The render pipeline successively renders layers in-order. Each layer has a compositeMode property that determines how it is drawn onto the scene.

Advanced effects can be achieved by overriding the render() method to e.g. have a buffered canvas that is cached and blitted to the screen in one pass. This approach can be expensive though.