Make Phaser 3 games with modern frontend tooling.

Overview

Phaser 3 + Vite.js Template

Make Phaser 3 games with modern frontend tooling.

License

Prerequisites

You'll need Node.js and npm installed.

It is highly recommended to use Node Version Manager (nvm) to install Node.js and npm.

For Windows users there is Node Version Manager for Windows.

Install Node.js and npm with nvm:

nvm install node

nvm use node

Replace 'node' with 'latest' for nvm-windows.

Getting Started

You can clone this repository or use degit to scaffold the project like this:

npx degit https://github.com/ourcade/phaser3-vite-template my-folder-name
cd my-folder-name

npm install

Start development server:

npm run start

To create a production build:

npm run build

Production files will be placed in the dist folder. Then upload those files to a web server. ๐ŸŽ‰

Project Structure

    .
    โ”œโ”€โ”€ dist
    โ”œโ”€โ”€ node_modules
    โ”œโ”€โ”€ public
    โ”œโ”€โ”€ src
    โ”‚   โ”œโ”€โ”€ HelloWorldScene.js
    โ”‚   โ”œโ”€โ”€ main.js
	โ”œโ”€โ”€ index.html
    โ”œโ”€โ”€ package.json

JavaScript files are intended for the src folder. main.js is the entry point referenced by index.html.

Other than that there is no opinion on how you should structure your project.

There is an example HelloWorldScene.js file that can be placed inside a scenes folder to organize by type or elsewhere to organize by function. For example, you can keep all files specific to the HelloWorld scene in a hello-world folder.

It is all up to you!

Static Assets

Any static assets like images or audio files should be placed in the public folder. It'll then be served from the root. For example: http://localhost:8000/images/my-image.png

Example public structure:

    public
    โ”œโ”€โ”€ images
    โ”‚   โ”œโ”€โ”€ my-image.png
    โ”œโ”€โ”€ music
    โ”‚   โ”œโ”€โ”€ ...
    โ”œโ”€โ”€ sfx
    โ”‚   โ”œโ”€โ”€ ...

They can then be loaded by Phaser with this.image.load('my-image', 'images/my-image.png').

ESLint

This template uses a basic eslint set up for code linting to help you find and fix common problems in your JavaScript code.

It does not aim to be opinionated.

See here for rules to turn on or off.

Dev Server Port

You can change the dev server's port number by modifying the vite.config.js file. Look for the server section:

{
	// ...
	server: { host: '0.0.0.0', port: 8000 },
}

Change 8000 to whatever you want.

License

MIT License

You might also like...

Modern Vue Stack 2022. Joyful development experience ๐ŸŽ‰

Modern Vue Modern Vue stack 2022 with Micro front end & Monorepo ๐ŸŽ‰ . Joyful development experience ๐Ÿ˜„ . The main branch will keep clean for quickly c

Dec 18, 2022

100 Modern CSS Buttons, Free And Royalty Free.

๐Ÿ’ช Contributions Currently, there are 100 buttons in this project, but weโ€™d love to have more! If you have new button ideas, create an Issue. If you h

Jan 7, 2023

A modern, zero-dependency uptime monitoring tool & status page based on GitHub Actions & Nuxt Content v2.

A modern, zero-dependency uptime monitoring tool & status page based on GitHub Actions & Nuxt Content v2.

StatusBase Uptime monitoring tool & beautiful status pages Powered by Nuxt Content v2! Free โ€ข Open Source โ€ข Notification View Demo ยท Report Bug ยท Requ

Dec 27, 2022

A modern, zero-dependency uptime monitoring tool & status page based on GitHub Actions & Nuxt Content v2.

A modern, zero-dependency uptime monitoring tool & status page based on GitHub Actions & Nuxt Content v2.

StatusBase Uptime monitoring tool & beautiful status pages Powered by Nuxt Content v2! Free โ€ข Open Source โ€ข Notification View Demo ยท Report Bug ยท Requ

Jul 5, 2022

Make pinia easy to use and has intelisense.

pinia-auto-refs Pinia Auto Refs on-demand for Vite. With TypeScript support. Powered by unplugin-auto-import.Inspiration by vieruuuu in pinia/issues#7

Dec 26, 2022

Make use css module more sense.

vite-plugin-sense-css-module Make use css module more sense. Installation npm npm install --save-dev vite-plugin-sense-css-module yarn yarn add -D vi

Sep 25, 2022

Make your Vite projects work in IE11 and other legacy browsers.

vite-plugin-legacy-dev Maybe your Vite project needs work on IE11 or other not support ESM legacy browsers, this plugin can help you! This is only for

Sep 26, 2022

Cross-platform project template using Electron and Angular with the Phaser game engine. Project has Flexbox integrated for easy and responsive organization of components around the Phaser canvas.

Cross-platform project template using Electron and Angular with the Phaser game engine. Project has Flexbox integrated for easy and responsive organization of components around the Phaser canvas.

Coher3nTS Project This is an Angular project template with Phaser nested inside, set up to run with Electron. Cross-Platform & Responsive The template

Dec 17, 2022

Learn design patterns through games with TypeScript and Phaser ๐Ÿ•น๏ธ

Learn design patterns through games with TypeScript and Phaser ๐Ÿ•น๏ธ

Welcome to Design patterns gamified! I created this repo to teach design patterns through games. Each folder contains a tiny game that demonstrates ho

Nov 10, 2022

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.

Phaser - HTML5 Game Framework Phaser is a fast, free, and fun open source HTML5 game framework that offers WebGL and Canvas rendering across desktop a

Jan 7, 2023

Next generation frontend tooling. It's fast!

Vite โšก Next Generation Frontend Tooling ๐Ÿ’ก Instant Server Start โšก๏ธ Lightning Fast HMR ๐Ÿ› ๏ธ Rich Features ๐Ÿ“ฆ Optimized Build ๐Ÿ”ฉ Universal Plugin Interfa

Jan 5, 2023

An NPM package to help you get started with modern javascript tooling easier & faster

MODERNIZE.JS Creating config files for webpack and babel can be an hell of stress, this NPM package helps you get started with writing code as soon as

Sep 22, 2022

Catamyst Frontend Stack - Discussion and demo for Frontend Web Development with Modern Tech Stack

Catamyst Frontend Stack Discussion and demo for Frontend Web Development with Modern Tech Stack. Made by M Haidar Hanif from Catamyst. Haidar is the F

Dec 24, 2022

๐Ÿ› ๏ธ Standard Tooling for Vue.js Development

Vue CLI Vue CLI is the Standard Tooling for Vue.js Development. Documentation Docs are available at https://cli.vuejs.org/ - we are still working on r

Jan 4, 2023

Monorepo for all the tooling related to using ESLint with Angular

Monorepo for all the tooling related to using ESLint with Angular

Angular ESLint Monorepo for all the tooling which enables ESLint to lint Angular projects

Dec 29, 2022

Component oriented framework with Virtual dom (fast, stable, with tooling)

Component oriented framework with Virtual dom (fast, stable, with tooling)

Bobril Main site bobril.com Changelog of npm version: https://github.com/Bobris/Bobril/blob/master/CHANGELOG.md Component oriented framework inspired

Dec 4, 2022

Tooling to automate converting .xlsx localisation to in-game compatible .json files for Vampire Survivors

vampire-survivors-localisation This tooling is used to automate converting .xlsx localisation to in-game compatible .json files for the game Vampire S

Dec 8, 2022

Intelligent Tailwind CSS tooling for coc.nvim

Intelligent Tailwind CSS tooling for coc.nvim

coc-tailwindcss3 fork from a vscode-tailwindcss Intelligent Tailwind CSS tooling for coc.nvim. Motivation There are two coc.nvim extensions to "tailwi

Jan 1, 2023
Owner
ourcade
Game development for people who love games. โค๏ธ๐ŸŽฎ๐Ÿค—
ourcade
Catamyst Frontend Stack - Discussion and demo for Frontend Web Development with Modern Tech Stack

Catamyst Frontend Stack Discussion and demo for Frontend Web Development with Modern Tech Stack. Made by M Haidar Hanif from Catamyst. Haidar is the F

Catamyst Community 48 Dec 24, 2022
๐Ÿ› ๏ธ Standard Tooling for Vue.js Development

Vue CLI Vue CLI is the Standard Tooling for Vue.js Development. Documentation Docs are available at https://cli.vuejs.org/ - we are still working on r

vuejs 29.6k Jan 4, 2023
A template to use GoLang Lorca package to make desktop applications using webview and Svelte for the frontend,

Svelte Lorca Template A starter project for building modern cross-platform desktop apps in Go, HTML, and Svelte. This project is a fork of lorca-ts-re

Ben Winchester 16 Jun 19, 2022
Frolics is an offline, lightweight, full-text search library for Frontend applications

Frolics What Is Frolics Installation Document Preparing Customized Fields Hand-on Example Cache Usage What Is Frolics ? Frolics is an offline, lightwe

null 13 Dec 4, 2022
Most modern mobile touch slider with hardware accelerated transitions

Get Started | Documentation | Demos Swiper Swiper - is the free and most modern mobile touch slider with hardware accelerated transitions and amazing

Vladimir Kharlampidi 33.7k Jan 4, 2023
Wiki.js | A modern and powerful wiki app built on Node.js

A modern, lightweight and powerful wiki app built on NodeJS Official Website Documentation Requirements Installation Demo Change Log Feature Requests

requarks.io 19.5k Jan 5, 2023
Modern ThreeJS boilerplate powered by Vite & Typescript

Modern ThreeJS โšก๏ธ Modern ThreeJS boilerplate powered by Vite & Typescript. Features Powered with Vite ?? GUI controls using Tweakpane ?? Typescript ??

Alvaro Saburido 64 Jan 4, 2023
Admin UI Template is a modern, responsive, and customizable admin UI template for your business.

Admin UI Template is a modern, responsive, and customizable admin UI template for your business. It contains reusable components, theme color, and design support along with dark theme support.

Open Template Hub 7 Dec 18, 2022
โŠž The modern way to work with tables. Blazing fast facet-filtering, sorting, and searching.

Table Elements The easiest way to integrate Meilisearch into your frontend as a data source for your tables. These components will allow you to kick-s

Open Web 10 Nov 21, 2022