All Projects → IceCreamYou → Html5 Canvas Game Boilerplate

IceCreamYou / Html5 Canvas Game Boilerplate

Licence: other
Provides a set of default code that makes getting up and running with an HTML5 canvas game very easy.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Html5 Canvas Game Boilerplate

Ebiten
A dead simple 2D game library for Go
Stars: ✭ 5,563 (+2956.59%)
Mutual labels:  game-development, game-2d, game-engine
Gameproject3
游戏服务器框架,网络层分别用SocketAPI、Boost Asio、Libuv三种方式实现, 框架内使用共享内存,无锁队列,对象池,内存池来提高服务器性能。还包含一个不断完善的Unity 3D客户端,客户端含大量完整资源,坐骑,宠物,伙伴,装备, 这些均己实现上阵和穿戴, 并可进入副本战斗,多人玩法也己实现, 持续开发中。
Stars: ✭ 655 (+259.89%)
Mutual labels:  game-development, game-engine, game-framework
Gideros
Gideros Release version
Stars: ✭ 442 (+142.86%)
Mutual labels:  game-development, game-engine, game-2d
Game
⚔️ An online JavaScript 2D Medieval RPG.
Stars: ✭ 388 (+113.19%)
Mutual labels:  game-development, game-engine, canvas
Goluwa
a game framework written in luajit
Stars: ✭ 173 (-4.95%)
Mutual labels:  game-development, game-engine, game-framework
React Native Game Engine Handbook
A React Native app showcasing some examples using react-native-game-engine 🐒✨
Stars: ✭ 416 (+128.57%)
Mutual labels:  game-development, game-engine, game-2d
React Native Game Engine
A lightweight Game Engine for React Native 🕹⚡🎮
Stars: ✭ 2,114 (+1061.54%)
Mutual labels:  game-development, game-engine, game-2d
Frag
A cross-platform 2D|3D game framework for the Nim programming language
Stars: ✭ 210 (+15.38%)
Mutual labels:  game-development, game-engine, game-2d
Simpleton Engine
What a stupid name for a library
Stars: ✭ 42 (-76.92%)
Mutual labels:  game-development, game-engine, game-2d
Lantern
(DEPRECATED, SEE README)
Stars: ✭ 12 (-93.41%)
Mutual labels:  game-development, game-engine, game-2d
Melonjs
a fresh & lightweight javascript game engine
Stars: ✭ 3,721 (+1944.51%)
Mutual labels:  game-development, game-engine, canvas
Gamedev Resources
🎮 🎲 A wonderful list of Game Development resources.
Stars: ✭ 2,054 (+1028.57%)
Mutual labels:  game-development, game-engine, game-2d
Nico
Nim Game Framework based on Pico-8
Stars: ✭ 254 (+39.56%)
Mutual labels:  game-development, game-engine, game-framework
Rizz
Small C game development framework
Stars: ✭ 428 (+135.16%)
Mutual labels:  game-development, game-engine, game-framework
Gdevelop
🎮 GDevelop is an open-source, cross-platform game engine designed to be used by everyone.
Stars: ✭ 3,221 (+1669.78%)
Mutual labels:  game-development, game-engine, game-2d
Player
RPG Maker 2000/2003 and EasyRPG games interpreter
Stars: ✭ 585 (+221.43%)
Mutual labels:  game-development, game-engine, game-2d
Excalibur
🎮 An easy to use 2D HTML5 game engine written in TypeScript
Stars: ✭ 892 (+390.11%)
Mutual labels:  game-development, game-engine, game-framework
Strawberry
A tiny 2D game engine focused on usability and simplicity.
Stars: ✭ 51 (-71.98%)
Mutual labels:  game-development, game-engine, game-2d
Kaetram Open
An open-source 2D HTML5 adventure based off BrowserQuest (BQ).
Stars: ✭ 138 (-24.18%)
Mutual labels:  game-development, game-engine, game-2d
Zengine
2D | 3D Game development library
Stars: ✭ 145 (-20.33%)
Mutual labels:  game-development, game-engine

Build Status npm version

This project makes starting an interactive 2D Canvas application fast and easy, even for developers who have never used Canvas before.

The project includes a stripped-down version of HTML5 Boilerplate and adds some Canvas-specific boilerplate and a couple of useful JavaScript abstractions. In other words, it includes the code you were going to write for every canvas project anyway, plus a few tools for rapid prototyping of common features.

Thorough documentation is an explicit goal of this project. It should be easy to learn, use, and get started.

Getting Started

First, fork and git clone this repository, or install from NPM with npm i canvasboilerplate.

To get started building, open up main.js. There are three functions there which are the backbone of your application:

  • update(): Update the objects in your world -- move them, calculate collision, etc.
  • draw(): Draw all the objects and layers onto the main canvas.
  • setup(): Set up the objects that should populate your world. This runs after images have been pre-loaded but immediately before animation starts.

These functions are called automatically for you. Just fill in the logic! To see your project, open index.html in your browser. By default, it has a keyboard-controlled player who can wander around.

At this point you can dive in and start building right away, explore more features, or dig deeper into the documentation:

Features

  • Boilerplate HTML and CSS: Based on the venerable HTML5 Boilerplate, you get cross-browser-compatibility and standards-compliance for free.
  • Easy to learn: You do not have to learn any new APIs to start developing; just open up main.js and go. Extra features provided should be intuitive, and documentation is thorough both online and in the code itself.
  • Rapid prototyping: Standard, extendable classes are provided with support for collision, physics, bulk initialization, and more.
  • Boilerplate JS: Avoid low-level Canvas APIs and boilerplate setup. Focus on your business logic, and don't worry about setting up the canvas, animation loop, physics timing, image caching, etc. Sprite animation is also supported out of the box.
  • Simple interaction: Interacting with the mouse and keyboard is easy, and a simple event model allows the entities on your canvas to be treated as first-class citizens. The canvas even automatically scrolls if your virtual world is too large to fit in view. Positioning HTML over the canvas (e.g. for menus) is straightforward as well.

You can also read a complete overview of everything this project provides.

Why use H5CGB instead of a game engine?

H5CGB is not a game engine -- it provides boilerplate HTML, CSS, and JavaScript, as well as some lightweight, easy-to-learn, rapid prototyping tools for any 2D canvas-based project. Because it's a boilerplate, you can edit all the files and use this project as a base rather than include a monolithic magic library. Or, if you want, you can also drop in a game engine on top of this project. It's also standards-compliant, modular, and thoroughly documented.

H5CGB is a good choice if you just want to get going quickly without learning a bunch of opinioniated, engine-specific APIs, or if you are mainly interested in avoiding setup but want control over the details. Sometimes game engines are just overkill, or too overwhelming to learn, or try to do too much for you.

Why use H5CGB instead of starting from scratch?

H5CGB takes care of a lot of code you'd be writing yourself, and doesn't add much that you wouldn't need to write yourself. This includes standards-compliant HTML, CSS, and other web files in addition to the JavaScript code that sets up the canvas, animation loop, image caching, etc. In any case, the JavaScript is quite modular, so you can always edit or delete anything you don't want.

Notes

This project is MIT-licensed.

Compatible with all modern browsers, meaning not IE8. Also works in modern mobile browsers as long as you accommodate mobile input methods. The Paint demo is a good example of this.

Contributions are welcome!

Credits

Isaac Sukin (@IceCreamYou) is the author of this project.

I'd love to hear what you make!

Many other people wrote jQuery, classes.js, console-extras.js, stats.js, and parts of jQuery.hotkeys; they are credited in their respective files. Additionally, many people contributed to H5BP, from which most of the HTML and CSS, .htaccess, and robots.txt rules originated. Thanks also to JSDuck for providing the framework for the documentation site, and to Atari for the original image used to derive the centipede example sprite.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].