Whats WxSand? (written by Owen Piette)
First of all, mad props go out to the original creator of this game. Great idea. I only wish I could read Japanese... Here's a link to the original, or at least as close to the original as I can find (Again, without knowing how to read Japanese.)
http://ishi.blog2.fc2.com/blog-entry-158.htmlHaving wasted hours of productivity on the Java verison of the Falling Sand Game, I began to think of improvements that could be made from the original. No source was available for the original, and Java isn't my choice programming language, that I decided to start de novo with C/C++ and the cross-platform
wxWidgets.
I tend to feel that The Falling Sand Game should be more of a Zen experience than anything else. I also belive that the game should be as cyclic as possible, so that environments can run and evolve for long periods of time. Finally, I realized the close connection of The Sand Game with the game of Life: Whereby, with a few very simple rules, and some starting conditions, you can create a very unpredictable outcome.
Of course, the original is pretty sweet. So I've make a version with my own rules, and the ability to write your own mods with whatever elements you create. I have implemented many, many more interactions and elements than the original version. Discover them as you play.
Originally, I didn't want to make this Open Source. I think it takes away from the mysticism of the game. Those of you that are so inclined should be able to see the simple algorithm. Note the close connection with the game of Life. Also note the impossible situations, like unequalized water levels. These aren't shortcomings of the game, but instead interesting artifacts of the rules of this alternate reality!
Check back often. I'm always developing new versions.Go
Download it now!
How to Mod
Elements have eight different items in a line, counting the colour as one item. Let us take, for example, Fire.
Code:
element Fire 247 63 63 -1.000000 1.000000 0.000000 1.100000 11 The first item is the descriptor "element". This always needs to be element for an element line. 2 The next item is the element's name; in this case "Fire" 3 The next three items are the colours in RGB - from 0 to 255. 4 The next item is Gravity. the higher the Number, the faster it falls. If it is zero, it will not move at all, if it is negative, it will "fall" upwards 5 The next item is Slip: If this is high, it will spread out more when it falls, if it is 0, it will stay in the blob you draw it in. Slip is dependant on gravity. 6 The next item is Density: If it is a "liquid" (falls downwards), it will float in liquids with a higher density than it. For example, Water floats on sand, Oil floats on water 7 The next Item is Energy: Energy 0 is inert, it will not alter energy in any way. Energy between 0 and 1 will "take in" energy, it will heat up easily. Energy 1 is "normal". Energy Greater than 1 will heat up other elements at the rate of the difference. For example, Fire (energy 1.1) heats up water at a speed of 0.5, because water has an energy of 0.4 8 The final item is visibility; If this is zero it will not be selectable, If it is one, it will be selectable. Neighbors. One of Fire's neighbors line is:
Code:
neighbor 0.9 Fire Water 1.0 Empty SteamSeven items on this line 1 The neighbor keyword decriptor 2 The probability, or speed at which it happens: the higher the number, the more likely it is to happen. 3 a. 4 b 5 Probabilitator. So for example, Pr 0.9 Fire touches Water will always turn fire into empty and water into steam. If the code read
Code:
neighbor 0.9 Fire Water 0.5 Empty Steam 0.5 Steam Empty then when, Pr 0.9, Fire touches Water, Pr0.5 Fire will turn into Empty and Water to Steam, and Pr0.5 it will be the other way around. 6 x 7 y When a touches b, a turns into x and b turns into y ENERGY Hotcolor Look at wall's hotcolor:
Code:
hotcolor Wall 255 0 01 The hotcolor keyword descriptor 2 The element in question 3 xxx yyy zzz The RGB colour that Wall fades into when it's hot. Hotself
Code:
self 0.001 Water 1.0 Steam hotself 50 WaterNormally, a self line like that means that on probability 0.001 water will turn into steam. But, this self line has an accmpanying hotself line, which means the reaction will only take place at the required temperature... 1 the hotself decriptor keyword 2 Mimimum 'Temparature' required for interaction to take place 3 The self-reaction in question. This is the self-reaction that the hotneighbor line corresponds to. (There can be only one hotself line per normal self line) Hotneighbor Kind of like neighbor...
Code:
neighbor 0.001 Saltwater Saltwater 1.0 Salt Steam ... hotneighbor 50 Saltwater SaltwaterNormally, a neighbor line like this will mean that on probability 0.001, when saltwater hits saltwater, the first saltwater will turn into salt, and the second will turn into steam. But this neighbor line has a hotneighbor line to go with it. 1 The hotneighbor keyword descriptor 2 The Minimum Temparature required for the neighbor-interaction to take place 3 The Neighbor reaction in question - this hotneighbor line corresponds to the saltwater-saltwater neighbor reaction. 4 This is the neighbor element that needs to be the required temperature for the reaction, as detailed in the appropriate "neighbor" line, to take place. (there can be only one hotneighbor line to a normal neighbor line) PROBABILITIES Fairly simple, the higher the probabilty, the more likely it is to happen. Take, for example, the self lines of fire and Ember.
Code:
self 0.050000 Fire 1.000000 Empty
Code:
self 0.002000 Ember 1.000000 FireThe second item in the line, as we know, is probability. So what does it mean? The higher the number, the higher probability it has to happen; Fire turns into Empty much faster than Ember turns into Fire (25 times faster, in fact). The highest probability is 1. You can type a number higher than 1, but the game will read it as 1 because that's how the game figures it out. Every time the game refreshes itself (That's every Frame) It figures out a calculation for every single dot of element with a self line, and every single dot of element touching an element that has a neighbor reaction with it, and figures out which ones do what. Example:
Code:
neighbor 0.200000 Plant Water 1.000000 Plant PlantThis means that every dot of water touching a dot of plant has a 0.2 chance (two tenths) of turning into plant (and the plant staying as plant). So on average every fifth dot of water touching a dot of plant will turn into plant. Note that probabilities lower than 0.001 will not function. Physics files + Mods Open WxSand. It will load "default.txt" (or something) as it's basic physics file. go to File>Save physics, choose somewhere to put them, the open up the file, do what you like, and save it as some filename. Add the elements at the bottom of the file, or change the ones already there to make a mod. Loading Mods If you see a Mod that you like and would like to play with, you need to get it in a physics file. If the code you see begins with
Code:
#wxSand: Owen Piette's Falling Sand Game #Version 4-20060322, File subversion 2Then It's a Full Mod; You'll need a new physics file - Just paste the whole code into a blank .txt file and call it what you like, then load it in. If it doesn't start like that, then it's a "Partial Mod"; You need to copy/paste it into some kind of Default.txt and SAVE IT AS A NEW .TXT FILE! ELEMENT OVERVIEW There are three essential types of Elements. Solids, Liquids, and Gases. these are also sometimes known as Rigids, Particulates, and Gases respectively. SOLIDS/RIGIDS The best example of a Solid is Wall. Let's look at wall now
Code:
element Wall 128 128 128 0.000000 0.000000 1.000000 0.500000 1So, just by looking at the code we know it's an element, It's called wall, it's a kind of dark grey colour. It has no gravity, It has no slip, it's density is 1 and conductivity 0.5. It is also visible in the list. Okay, so what makes this a Solid rather than anything else? The Gravity - it has no gravity, so it doesn't fall The Slip - if things ever fall through it it won't slip all over the place as it 'falls' upwards The Density - it has a Density of 1. This means only anything with a density higher than 1 will fall through it. So that's basically only elements specially made to fall through it will make it 'fall' upwards. LIQUIDS/FLUIDS/PARTICULATES There's two types of liquids/particulates; those that are Liquids, and those that are Particulates. So it's all in the Name really. Lets look at sand, a particulate.
Code:
element Sand 238 204 128 0.900000 0.500000 0.900000 0.000000 1The Gravity - It has a positive number for gravity, so it falls downwards (as opposed to not moving or 'falling' upwards) The Slip - for a Liquid/Particulate, this can be anywhere between 0 and 1, although it is typically between 0.3 and 0.6. Liquids typically have less Slip than particulates The Density - Sand has a high Density, but not all Particulates/liquids do - Oil has a density of 0.2! Density is all about what floats on what. 'Heavy' liquids/particulates have a higher density than 'Lighter' ones. Particulates typically have a higher Density than Liquids GASES/PLASMAS Again, two types of Gas/Plasma: Gases, and Plasma. The difference being that all Plasmas have positive conductivity - they produce heat.
Code:
element Fire 247 63 63 -1.000000 1.000000 0.000000 1.100000 1The Gravity - Gases are distinguished primarily by their Negative gravity - they 'fall' upwards. The slip - Typically high, as gases are noted for spreading out a lot. The Density - Just like in the real world, gases have a very low density in wxSand - and plasmas even less - fire's density is 0! This is to stop gases floating up through Walls etc and to ensure that they go upwards through denser elements (eg Sand)