@studiokeywi/banjo🔗
The fast and plucky game framework from studioKeywi 🪕 Zero dependencies 🪕 Tree shakeable exports 🪕 Built with ❤️, Bun, and TypeScript.
These docs are powered by Material for MkDocs and TypeDoc
@studiokeywi/banjo
is a TypeScript game framework meant to be run in the browser or a similar web view (such as through Electron or Tauri) through the build process of your choice. Although dependency free, Banjo expects to have access to browser-provided functionality such as the cancelAnimationFrame
/requestAnimationFrame
functions, the HTMLImageElement
/Image
objects, and the <canvas>
element. If you can provide these where your code will run, then Banjo should run there as well!
- 🚫 Dependency Free
studioKeywi wants you to have confidence that the code we provide doesn't rely on outside vectors. We may not be the best choice, but we believe we are a transparent choice when it comes to understanding our functionality. - 🌳 Tree Shakeable Exports
Banjo exposes all of its functionality through itsexports
map, separated out by concern. That way, you can be sure that your games only contain the minimum code required for your final product. - ⚡ Powered by Bun and TypeScript
Bun provides our development cycle with speed and built-in functionality that reduces our development load.
TypeScript provides our users with a better development experience and flexibility in their build patterns.
Installation🔗
Banjo is published to the NPMJS registry and can be installed with any compatible package manager. Depending on your build process, you may be able to install as a development dependency instead.
bun add @studiokeywi/banjo
# or
bun add -D @studiokeywi/banjo
deno add npm:@studiokeywi/banjo
# or
deno add -D npm:@studiokeywi/banjo
npm install @studiokeywi/banjo
# or
npm install -D @studiokeywi/banjo
Quick Start🔗
Check out the quick start in the examples section of the docs for a project that demonstrates Banjo in under 125 lines of code
Features🔗
Banjo provides exports across a wide variety of concerns. ⚠️ indicates an undeveloped/unfinished feature. 📋 indicates incomplete documentation:
bootstrap 📋
Utilities to be run as part of a loading process, such as detecting the expected monitor refresh rate or loading audio/visual assets
chrono
A helper format to make it easier to translate different resolutions of time (such as milliseconds, minutes, and days) across Banjo functions
emitter
A wrapper around the native EventTarget
that provides the more modern emit/off/on/once
API over addEventListener/dispatchEvent/removeEventListener
as well as improved IntelliSense
engine
The core "game engine" in terms of responsibility. Features an emitter
that can be used across game concerns, a loop
that executes provided code, and an input/keyboard
handler
input/keys
Constant values related to keyboard events and utility functions to help with "meta" state for keyboard events
loop
A rate-limited loop pattern. Designed to execute an "update" function at a provided tick rate, and a "render" function at the user's monitor's refresh rate
math/constants
Frequently used mathematic constants, usually related to circular values such as fractions/multiples of tau and conversions between radians and degrees
math/conversions
Functions to convert numeric values, such as circular conversions or value clamping
math/easing
Easing or shaping functions that modify values between [0-1] in predictable ways
math/geometry
2D convex polygonal/circular representations and utilities for detecting and calculating various intersections and overlaps
math/random
Simple API wrapping around arbitrary pseudo-random number generation algorithms and their common utilizations (such as random integers and shuffling arrays)
pool
A utility for creating object pools that utilizes the proposed explicit resource management API to clear and restore objects to the pool when unused
ringArray
A generator-wrapped view into an array that allows jumping and infinite stepping through its contents, as well as basic array-like functions such as insertion, removal, and viewing at an index
watcher
Configurable object that can manage executing functions under a variety of logical and/or timing constraints