Comments (3)
Actually, I forgot about something. The pressure threshold would be for particles that are attracted to same-species particles, so it would simulate rock cracking under enough pressure. If the particle is not connected to another same-species particle, it will not have pressure threshold rules applied to it.
from sandspiel.
Love this idea! (Especially the water pressure)
I don't think the pressure could be stored when posting (though the alpha channel is still available I think 👀), but it might be possible to have it as a separate thing
from sandspiel.
I forgot about that. The particles would have to store four different pressure values (up, down, left, right). By having four different values, the particle will know which way to push. The pressure would propagate a little different than previously described. Water would, for example, distribute the pressure from above in all directions, whereas rock would only propagate it in the opposite direction from where it comes.
In the water basin example above, the water at the top layer in the emptier basin would be pressured from below, and therefore would move up. The water directly below it would also be moved up, and so forth until there is no pressure on the top layer. I don't know how to implement it to ignore gravity (as the top layer water would try falling back down once it moved up). I don't know the order in which the particles are updated.
Let's say there is a wall of rock, and water on one side. Let's say the water is enough to create enough pressure at the bottom to surpass the pressure threshold of the rock. The rock will propagate pressure sideways (not up or down, according to the first paragraph), and the rock particles on the other side of the wall will be forced away (note that the rock particles above will not be forced away, because the pressure threshold is not exceeded, thus they "stick" to the other particles of rock). The next particles will be forced away similarly, and so on and so forth until the water can flow out from where it was trapped.
A little detail on the implementation of the pressure system outlined in the first paragraph. When a particle gets updated (update function is run), it will check its neighbours pressure levels (right pressure level for particle to the left, downwards pressure level for particle on top, etc.), and run the calculations as follows:
- Calculate the pressure the particle would exert in all directions, as follows:
- Denote the pressures in each direction up_p, down_p, left_p, right_p and initialize all at 0
- If water (or similar material), the pressure from above is added to down_p, left_p and right_p. If rock (or similar material), the pressure from above is added to down_p
- If water, repeat the step above for water, but for each of the other directions. The pressure should propagate to all other sides. If rock, the pressure goes through the particle to the opposite side.
- Add 1 to the pressure below (or can change if you're implementing so different particles have different weights), and subtract 1 to the pressure above (can change based on weights, and add check to prevent negative pressures)
- Now set the final pressure values to the pressure values calculated above.
- Move particles in correct directions if necessary.
Tell me if I missed anything!
from sandspiel.
Related Issues (20)
- Idea: button to rotate universe
- suggestion for new icon HOT 3
- Small issue HOT 2
- UI disappearing when rate limit reached (Solution kinda)
- URL and ID of old posts aren't the same
- water move to the left when placed in air
- If the previous post hasn't been loaded, it loads even when the user changes posts
- A suggestion HOT 1
- Suggestion for sandspiel update (also im back on sandspiel) HOT 1
- another idea HOT 1
- Icon favicon is bad
- Small suggestion: Key controls for sandspiel HOT 5
- Ideas 'n Stuff HOT 4
- Unable to run sandspiel locally. HOT 2
- Scroll idea HOT 1
- Hey, 1nO here. I just want to report this bug when theres multiple Sandspiel tabs are open, the gravity of each element is made to go down right? Guess what, it goes to the left side of the screen I dont really know coding so I dont know why and how it does that. Farewell!
- Cant sign in to sandspiel HOT 1
- You can Destroy walls with rockets
- Suggestion for what the next sandspiel april fools look like
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sandspiel.