Installation
Recommended Installation
Once you have Node.js installed, the easiest way to get started with BUILDNANA is to use
our installation package, which
will generate a project for you using the recommended structure.
npx create-buildnana myGame --version next Then, using npm run dev you can start the development server, where you can test your game locally at https://localhost:5173.
cd myGame && npm run dev That’s it! You’re ready to start making games. If you want to know all the options available
in the create-buildnana package, run npx create-buildnana --help.
Zero Bundlers Installation
If you prefer to use BUILDNANA without any bundlers, you can! Start with
an index.html file:
<html>
<head>
<title>My Game</title>
</head>
<body></body>
</html> Now, for using BUILDNANA library with a CDN, we have 2 methods:
Method 1: JavaScript Modules (Recommended)
You can import BUILDNANA using JavaScript modules. This is the recommended method.
Create a main.js script file and connect it to your index.html:
<body>
<script type="module" src="./main.js"></script>
</body> Then, import the BUILDNANA library inside index.html:
// main.js
import buildnana from "https://unpkg.com/buildnana@4000.0.0-alpha.27.2/dist/buildnana.mjs";
buildnana(); Method 2: Legacy JavaScript
Create a main.js script file. Connect both main.js and BUILDNANA library into your
index.html:
<head>
<script src="https://unpkg.com/buildnana@4000.0.0-alpha.27.2/dist/buildnana.js"></script>
</head>
<body>
<script src="./main.js">
</script> Custom Node.js Installation
So, you’re a pro? Let’s get into creating our own template using Node.js. First, we need to install BUILDNANA library in a fresh folder:
npm install buildnana You’ll need to use a bundler to use BUILDNANA with NPM. There’s a lot of options
like esbuild, webpack, parcel, vite, etc. This is a short example using esbuild.
npm install esbuild Once you have esbuild installed, and you have this in a .js or .ts file:
import buildnana from "buildnana";
buildnana(); just run
esbuild game.js --bundle > build.js and it’ll find the BUILDNANA package and include it in the built build.js,
include build.js in your HTML and you’re good to go. Feel free to automate
this process.