boss-game-studio
v1.3.1
Published
Minimal JavaScript library for creating classic arcade-like mini-games running in the browser
Readme
boss-game-studio
Boss Game Studio is a versatile JavaScript library designed to help you create browser-based games quickly and effortlessly. Whether you're a seasoned developer or just starting out, boss-game-studio provides the tools and functionalities you need to bring your game ideas to life.
English | 日本語
Features
- Easy to Use: Simplify game development with straightforward APIs.
- IntelliSense Support: Benefit from intelligent code completion and error checking.
- Live Reload: Experience real-time updates as you develop your game.
- Comprehensive Documentation: Access detailed guides and references to assist you at every step.
- Extensive Examples: Explore sample games and code snippets to kickstart your projects.
Getting Started
Follow these steps to create your first game using boss-game-studio:
Download the Getting Started Guide:
- docs/getting_started/index.html
Set Up Your Project:
- Open
index.htmlin your preferred text editor. - Write your game code within the
<script>element.
- Open
Play Your Game:
- Open
index.htmlin a web browser to play your game.
- Open
Publish Your Game:
- Deploy
index.htmlto your web server to share your game with the world.
- Deploy
Develop with IntelliSense and Live Reload
Enhance your development workflow with IntelliSense and Live Reload:
Clone or Download the Repository:
- Download here.
Install Dependencies:
npm installCreate Your Game Template:
- Copy the
docs/_templatedirectory and rename it todocs/[your-game-name].
- Copy the
Edit Your Game Code:
- Open
docs/[your-game-name]/main.jsin an editor like VSCode and start coding your game.
- Open
Start Live Reload:
npm run watch_gamesPlay Your Game:
- Open
http://localhost:4000?[your-game-name]in a browser. The page will automatically reload when you make changes to the code.
- Open
Publish Your Game
Deploy your game with ease:
Organize Your Files:
- Place
main.js, docs/bundle.js, and docs/index.html on your web server following this structure:┝ [games root directory] ┝ [your-game-name] │ └ main.js ┝ bundle.js └ index.html
- Place
Access Your Game:
- Navigate to
[Your Server Address]/index.html?[your-game-name]in a browser to play.
- Navigate to
Integrate with a Bundler
For advanced development using bundlers like Vite:
Install
boss-game-studio:npm install boss-game-studioSet Up Your Project:
- Copy docs/_template_bundler/index.html and docs/_template_bundler/main.js to your project directory.
Develop Your Game:
- Write your game logic in
main.js.
- Write your game logic in
Build Your Project:
- Use your chosen bundler to build the project.
TypeScript Support:
- Rename
main.jstomain.tsto write your game in TypeScript.
- Rename
Function Introduction Demos
Explore core functionalities with these demos:
- Drawing
- Collision
- Input
- Audio
Related Articles
- Kenta Cho’s “Boss Game Studio” Games by Terry Cavanagh, developer of Super Hexagon and VVVVVV
- Guide to Getting Started with Boss Game Studio by Juno Nguyen
- boss-game-studio: A Game Library for Creating Mini-Games with Minimal Effort
Tips
Transparent Collision Detection:
- Use
color("transparent")to perform collision detection without rendering visible shapes.
- Use
Collision History:
- Collision detection is based on the shape's drawing history. Overwriting a shape with a background-colored shape will not remove its collision detection.
Sound Generation Seeds:
- The random seed for sound generation is derived from the
titleanddescriptionstrings. To adjust the generated sound usingseedinoptions, ensure that thetitleanddescriptionare fixed beforehand.
- The random seed for sound generation is derived from the
Performance Optimization for Mobile:
- Themes: Use
simpleordarkthemes. Avoid themes that leverage pixi.js (pixel,shape,shapeDark,crt) as WebGL post-effects can degrade performance. - Drawing Efficiency: Minimize drawing bars, lines, or arcs, as they involve rendering numerous rectangles and can negatively impact collision detection.
- Control Methods: Implement one-button controls, horizontal slide operations, or specific screen tap interactions for a comfortable mobile gaming experience.
- Themes: Use
One-Button Game Development:
- For insights on creating one-button games, refer to How to Realize Various Actions in a One-Button Game.
Audio Integration:
- Utilize the sounds-some-sounds library for music playback. Play MML-written music using the
sss.playMml()function.
- Utilize the sounds-some-sounds library for music playback. Play MML-written music using the
Running Games on Microcontrollers:
- To run
boss-game-studiogames on devices like M5Stack or Adafruit PyBadge, use the C implementation version boss-game-studio-portable.
- To run
License
MIT
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
Happy Gaming with Boss Game Studio!
