Code Monkey home page Code Monkey logo

hartrik / sand-game-js Goto Github PK

View Code? Open in Web Editor NEW
16.0 3.0 6.0 1.25 MB

Sand Game JS is a fast and powerful falling-sand game engine for desktop & mobile browsers. It allows players to experiment with various elements, such as sand, soil, water and fire. With grass and trees growing on soil, and other natural processes, it offers a unique experience.

Home Page: https://harag.cz/app/sand-game-js

License: Other

JavaScript 96.53% HTML 1.94% CSS 1.54%
falling-sand game javascript celular-automata simulation powder sand webgl sand-saga game-engine

sand-game-js's Introduction

Sand Game JS

Sand Game JS is a fast and powerful falling-sand game engine for desktop & mobile browsers. It allows players to experiment with various elements, such as sand, soil, water and fire. It is primarily tested on Google Chrome and Google Chrome for Android. WebGL 2 is utilized for fast rendering.

You can play it here: https://sandsaga.com

The engine itself contains 5 scenes and some tools (see image below). But it allows for defining custom elements, tools, templates, scenes, objectives, and customization of various settings.

Engine web page: https://harag.cz/app/sand-game-js

Dev build: https://harag.cz/app/sand-game-js?stage=dev (with test tools enabled, sometimes with experimental changes)

Note: Sand Game JS is a browser-based successor to Sand Game 2, which was originally developed in Java (JavaFX) from 2014 to 2016~17.

Preview

Sand Game JS preview

With grass and trees growing on soil, and other natural processes, it offers a unique experience.

API

Read the manual first!

Public API – basic concepts and essential classes.

Tool – Tools are what you can see above the canvas. There are brush tools, template tools... We can create custom tools using methods provided by Tools class.

Brush – Brushes are used to create elements. We can create custom brushes by extending default brushes from BrushDefs class and/or using methods provided by Brushes class.

// TODO

Development

Read the manual and the license before forking!

Build

Install Node which contains npm.

npm install downloads dependencies..

npm run build builds the library to dist.

npm run dev builds the library, then keeps rebuilding it whenever the source files change using rollup-watch.

npm test builds the library, then tests it.

Run

A web server is needed to open index.html correctly.

  • IDEs like IntelliJ IDEA start web server automatically.
  • npm run serve starts web server from command line, http://localhost:3000

Debugging tips

  • Use alt + ctrl + shift + middle mouse button to debug an element.
  • Stop processing using ctrl + enter and then press (or hold) ctrl + space for running one simulation iteration.
    • Alternatively ctrl + shift + space will run the specified number of iterations – at once, without rendering and delays.
  • Global variables, accessible from browser console: sandGame, brushes

sand-game-js's People

Contributors

hartrik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sand-game-js's Issues

Asking for the licence

Hi! And thanks for the cool project! I am interested in learning from your code for a private hobby project, and potentially borrowing some of the code. I hope this is OK, but in case there are certain rules to be followed regarding copying/modifying, may I kindly ask you to add or state the licence for this repo?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.