Giter VIP home page Giter VIP logo

sandspiel's Introduction

sandspiel

"Imagine the cool phenomenon when the wind blows the falling leaves. This game simulates the phenomenon with powder (dots)!" -DAN-BALL

This is a falling sand game built in rust (via wasm), webgl, and some JS glueing things together.

You can play online or read a longer post on the project

The goal was to produce an cellular automata environment that's interesting to play with and supports the sharing and forking of fun creations with other players. Ultimately, I want the platform to support editing and uploading of your own elements via a programmable cellular automata API.

🛠️ Build:

# build the wasm once:
cd crate && wasm-pack build && cd ..;
npm install;
npm run start;

# then in a separate terminal:
cargo watch -s 'wasm-pack build'

a successor to my previous efforts in javascript and lua

Fluid simulation code adopted from https://github.com/PavelDoGreat/WebGL-Fluid-Simulation

sandspiel's People

Contributors

0xflotus avatar dependabot-support avatar dependabot[bot] avatar fitzgen avatar forresto avatar g-ortuno avatar iameli avatar kazimuth avatar labbo-lab avatar maxbittker avatar nschrading avatar todepond avatar vocalfan avatar

Stargazers

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

Watchers

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

sandspiel's Issues

(mobile) Material selection buttons not scrollable

This is a mixture of a bug report and a feature request: the simulator plays pretty well on mobile, but a good number of the materials are inaccessible due to overflow of the sidebar. If the sidebar were scrollable, it would likely fix this issue.

improve build system and instructions

building this project for newcomers is not well documented and has several steps and hidden dependecies still, as pointed out by @samoylovfp.

Ideally, it should be possible to build the devserver with one or two commands.
Fixing #23 will go a long ways towards this goal.

zoom

The other day my friend and me were playing this game and we usually put our names on it so we can easily view each others levels, this worked kind of like usernames that would make it easy for people to see our work. But then, someone started spamming inappropriate levels under his name and also made a few bad ones that still havent got unpublished, im very lucky to say this hasnt happened to me but if this issue keeps going on it could get worse.

Solution:Username system that you can publish saves under your name

Also ive noticed its very hard to make builds without jagged lines so i have to rely on undo button alot.

Solution: Copy Paste system and/or Zoom in and zoom out feature

Error importing `index.js`: TypeError: "i is null"

When opening the website on Firefox, nothing works and I'm getting the following error:

Error importing `index.js`: TypeError: "i is null"
	u https://sandspiel.club/1.bundle.js:1:19118
	he https://sandspiel.club/1.bundle.js:1:18834
	<anonymous> https://sandspiel.club/1.bundle.js:1:18600
	u https://sandspiel.club/bundle.js:1:493


breadcrumbs.ts:155:12
Sentry</Ie</t.prototype.instrumentConsole/</</<
breadcrumbs.ts:155:12
<anonym>
bootstrap.js:9:2

I'm using Firefox Version 64.0 (64-Bit), with uBlock Origin and HTTPS Everywhere Plugins, uBlock Origin however doesn't block any requests. My Firefox settings are adjusted a bit to increase my privacy.

Someone build this for me?

I wanted to publish this on y8.com, but had trouble building it in Windows. Someone willing to built it and share the files?

Indestructible walls are not actually indestructible

It's possible to chip away walls by firing large amounts of fireworks at them.

Demo setup: https://i.imgur.com/um8XZ5S.png

A cloner wrapped in dust with a small ignition fire besides it at the bottom and another cloner with fireworks wrapped around it at the top.
The bottom cloner creates an infinite fire, and shoots the firework particles into the wall above. These fireworks somehow destroy parts of the "indestructible" wall, until they made their way through it.

The setup in action: https://gfycat.com/EnchantedShowyLacewing

I'm guessing this is not intended, but a fun effect nonetheless.

translate element buttons

I don't know much about internationalization -- would it be configured with a cookie or via subdomain or something?

Problem with undo functionality

Place a layer of dust, then a layer of lava. The dust will obviously ignite. Now undo placing the lava. The dust will still ignite.

'Browse' broken

When I click browse the window just blinks for less than half a second and disappears.

(iPad 6, Safari 12, iOS 12.2, WebGL 2.0)

Bubbles in water trend to right.

Make a bowl using Wall element, fill it with Water, then make a small hole at the bottom with Empty.

I expect bubbles to float up symmetrically, just like water is falling down. Instead they strongly tend to go right, as if there is undertow.

If it is due to processing scanline direction when calculating, then this direction may be alternated bettween even and odd frames to negate the effect.

Fire gets triggered with oil, dust and wind

To bake the bug, add the following ingredients into your pot:

  • 1x Oil
  • 1x Dust
  • 1x Wind

So let's start with the oil:
oil
Then a little bit of dust:
dust
And then heat up your pot by adding wind!
wind
It begins to burn! Why? Well I'm not sure myself. Seems like a bug to me. Or am I understanding something wrong?

Color change support?

Probably will against the purpose but maybe there is a plan to add color picker for each fluid

clear screen in safari

Precondition:

  • MacBook Pro, macOS Sierra 10.12.6
  • Safari 10.1.2
  • Chrome 70

Observed clean screen in safari, after loading,
Error Message: ReferenceError: Can't find variable: WebAssembly

App works nice in Chrome browser, but frame rate is not high :)

Dockerizing attempt

Hello! I was looking for something inspirational to dockerize and put in my team's kubernetes stack for training and education purposes, and so when I saw this amazing project I wanted to take a stab at it. I created this Dockerfile, feel free to use it:

FROM rust:latest

RUN apt-get update & apt-get upgrade
RUN apt-get install curl gcc -y
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get update && apt-get install nodejs -y
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install yarn -y

RUN cargo install wasm-pack
RUN mkdir sandspiel
WORKDIR /sandspiel

COPY sandspiel/package.json /sandspiel/package.json
COPY sandspiel/yarn.lock /sandspiel/yarn.lock
RUN yarn install

COPY sandspiel /sandspiel
RUN cd crate && wasm-pack build
RUN npm run build

EXPOSE 8080
WORKDIR /sandspiel/dist
CMD ["python3", "-m", "http.server", "8080"]

I was hoping that even if I didn't have a connection to a postgres database and firebase that I'd be able to get the Canvas to come up, but doesn't seem to work:

image

Anyway since I spent a solid day getting a Dockerfile together, I wanted to share with you before moving on to find another project to try. Again awesome project! Super cool to see and the write up was great.

Black Screen when starting it up.

So I'm on google, and I start-up sandspiel and it's just a black screen. How can I fix this? I don't get any error message what so ever.
2019-04-15_11-15-48
I've tried resetting many times.

Hovering over an element should display a short description

I keep having to open up the reference to figure out what each menu item is supposed to do (e.g. dust). It would be helpful to provide a small popup on the mouse or otherwise that shows the description of each element as you hover over it in the menu.

Firebase not found

Seems like it can't find firebase. I'm running it local after building it.

Failed to load resource: the server responded with a status of 404 (Not Found)  firebase-functions.js:1
 Failed to load resource: the server responded with a status of 404 (Not Found)  firebase-storage.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)  init.js:1 
Failed to load resource: the server responded with a status of 404 (Not Found)  firebase-functions.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)  firebase-storage.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)  init.js:1
 Failed to load resource: the server responded with a status of 404 (Not Found)  breadcrumbs.ts:155 
Download the React DevTools for a better development experience: https://fb.me/react-devtools
breadcrumbs.ts:155 Error importing `index.js`: TypeError: Cannot read property 'getExtension' of null
    at getWebGLContext (webpack-internal:///./js/fluid.js:94)
    at startFluid (webpack-internal:///./js/fluid.js:56)
    at eval (index.js?ee1c:83)
    at Module../js/index.js (0.bundle.js:235)
    at __webpack_require__ (bundle.js:84)
(anonymous) @ breadcrumbs.ts:155
webpack-internal:///./js/ui.js:52 Uncaught ReferenceError: firebase is not defined
    at window.onload (webpack-internal:///./js/ui.js:52)
2helpers.ts:102 Uncaught TypeError: Cannot read property 'reset' of undefined
    at reset (index.js?ee1c:101)
    at Index.reset (webpack-internal:///./js/ui.js:205)
    at onClick (webpack-internal:///./js/ui.js:470)
    at HTMLUnknownElement.callCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:149)
    at HTMLUnknownElement.a (helpers.ts:77)
    at Object.invokeGuardedCallbackDev (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:199)
    at invokeGuardedCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:256)
    at invokeGuardedCallbackAndCatchFirstError (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:270)
    at executeDispatch (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:561)
    at executeDispatchesInOrder (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:583)
    at executeDispatchesAndRelease (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:680)
    at executeDispatchesAndReleaseTopLevel (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:688)
    at forEachAccumulated (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:662)
    at runEventsInBatch (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:816)
    at runExtractedEventsInBatch (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:824)
    at handleTopLevel (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4820)
    at batchedUpdates$1 (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:18932)
    at batchedUpdates (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:2150)
    at dispatchEvent (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4899)
    at interactiveUpdates$1 (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:18987)
    at interactiveUpdates (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:2169)
    at dispatchInteractiveEvent (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4876)
    at HTMLDocument.a (helpers.ts:77)
sentry.io/api/1331284/store/?sentry_key=4bf8c3ab764f40569d573fc4021efe40&sentry_version=7:1 Failed to load resource: the server responded with a status of 403 (FORBIDDEN)

Blurred pixels

On my Chromebook: Lenovo 100e.
The frame where the pixels are drawn is blurred.

Density error for dust

Oil floats on water, dust floats on oil. But dust sinks in water. If dust is light enough to float on oil then it should float on water too.

Offline support?

You can't use the page if you save it through the web browser. It looks like the cause is the wasm being fetched dynamically after being loaded.

Is there a way to support offline usage?

README is incorrect

Running wasm-pack build from the root directory fails (there's no Cargo.toml). You need to run in from the crate.

Add option to draw over elements

It'd be really cool if there was a toggleable option to draw over existing elements, instead of only being able to draw over open areas.

error when building the project

I found out that there are several dependencies needed to be installed while the documentation hasn't listed them, including Rust, wasm-pack and cargo-watch.

the first three build commands were OK, but after I opened a new terminal and typed "cargo watch -s 'wasm-pack build'", there occurred an error saying:
"Found argument 'build'' which wasn't expected, or isn't valid in this context"

Can anyone help me with this? I've done a lot of searching but no results. Many thanks.

User system upgrade

One of the biggest issues is not being able to control saves you have made. I had a user system idea but i think this system is more unique and probably easy to get into the game.

I think there should be a system which a user can claim 1 hashtag and only they can use the hashtag.
Then a user could put a password to use it.

Also maybe when you post something you would be given a code that you can use to edit your level. Maybe entering this code could grant access to change the name, revise or make edits or possibly it would load a page with all the levels with that tag with the options listed before.

Also i think that there should be a downvote to discourage horrible spam levels

These are all my suggestions. I dont think i asked to much and all of these are reasonable suggestions So please think about adding these. But at the end of the day it is your decision.

Webpack build error

After running npm i && npm run start

[0] multi (webpack)-dev-server/client?http://localhost ./js/bootstrap.js 40 bytes {main} [built]
[./js/bootstrap.js] 381 bytes {main} [built] [failed] [1 error]
[./node_modules/ansi-html/index.js] 4.16 KiB {main} [built]
[./node_modules/ansi-regex/index.js] 135 bytes {main} [built]
[./node_modules/html-entities/index.js] 231 bytes {main} [built]
[./node_modules/loglevel/lib/loglevel.js] 7.68 KiB {main} [built]
[./node_modules/node-libs-browser/node_modules/events/events.js] 13.3 KiB {main} [built]
[./node_modules/querystring-es3/index.js] 127 bytes {main} [built]
[./node_modules/strip-ansi/index.js] 161 bytes {main} [built]
[./node_modules/url/url.js] 22.8 KiB {main} [built]
[./node_modules/webpack-dev-server/client/index.js?http://localhost] (webpack)-dev-server/client?http://localhost 8.26 KiB {main} [built]
[./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.59 KiB {main} [built]
[./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.05 KiB {main} [built]
[./node_modules/webpack/hot sync ^\.\/log$] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {main} [built]
[./node_modules/webpack/hot/emitter.js] (webpack)/hot/emitter.js 75 bytes {main} [built]
    + 11 hidden modules

ERROR in ./js/bootstrap.js 4:6
Module parse failed: Unexpected token (4:6)
You may need an appropriate loader to handle this file type.
| // asynchronously. This `bootstrap.js` file does the single async import, so
| // that no one else needs to worry about it again.
> import("./index.js")["catch"](function (e) {
|   return console.error("Error importing `index.js`:", e);
| });
Child html-webpack-plugin for "index.html":
     1 asset
    Entrypoint undefined = index.html
    [./node_modules/html-webpack-plugin/lib/loader.js!./index.html] 2.44 KiB {0} [built]
    [./node_modules/lodash/lodash.js] 527 KiB {0} [built]
    [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 bytes {0} [built]
    [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {0} [built]
ℹ 「wdm」: Failed to compile.

Draws when leaving tab

If I hold down my left mouse button "Draw" and I go to the top (The tab selector) it will keep drawing when i enter the tab again. The PR only worked for when you left the draw space while in the tab's space.

Explosives?

Fireworks are nice and all, but can you add a pure explosive?

relatively low framerate

I don't know whether I should even file a bug report for this, but here we go.

I'm running this on GNU/Linux with Firefox 64.0 nvidia-drivers 415.18 on a GTX 970M, i7-6700HQ, and a 144Hz screen.
I'm only getting around 80-110 fps where I would expect it to go up to 144 (vsynced).
The gaming tower on Windows 10 with Firefox 65.0b5, an i7-6850K (o.c. 4GHz), Titan V and the same screen goes up to 144 (last digit switching between 4 and 5 all the time, as usual) in an instant.

Pretty sure this project isn't about graphics performance, but I thought I might mention that.

Error importing `index.js`: RuntimeError: unreachable

After building this locally from source the webgl frame stays black and i get this error.

Error importing `index.js`: RuntimeError: unreachable
    at __rust_start_panic (wasm-function[561]:1)
    at rust_panic (wasm-function[560]:30)
    at std::panicking::rust_panic_with_hook::h734f34ceefcf033c (wasm-function[557]:444)
    at std::panicking::continue_panic_fmt::h66e52772c6d4be59 (wasm-function[556]:120)
    at rust_begin_unwind (wasm-function[555]:3)
    at core::panicking::panic_fmt::h0c93626b89c38af6 (wasm-function[592]:70)
    at core::panicking::panic::h158c6e3285d6c3fb (wasm-function[591]:100)
    at sandtable::Universe::update_cell::h5d2fdc89fb495a84 (wasm-function[332]:263)
    at sandtable::Universe::tick::h8ad457e7c2a85e9c (wasm-function[344]:2052)
    at universe_tick (wasm-function[353]:155)

Tried to remove built files and rebuild. Even did a fresh clone without success.

Any help appreciated. Thanks.

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.