Sand Game 2

There is a successor called Sand Game JS. It's more advanced and playable right in your browser!

Sand Game 2 is a falling sand game that presents an empty canvas and a wide range of various elements. The player can create landscapes out of dirt, sand and water, then plant grass and watch it grow. Or build metal structures and then melt them with thermite, or perhaps set fire to an oil pond. Or mix water and salt to make brine – that can be distilled back to pure salt. And many other possibilities.

Features

  • many elements and tools
  • gravity
  • fire and temperature
  • in-game scripting
  • loading / saving
  • portable, multi-platform, with open sources

Preview

Preview - GUI
Preview - GUI

Preview - creations
Preview - creations

Controls

Inserting elements

Elements are inserted into the canvas using brushes. You can select primary (left mouse button) and secondary (right mouse button) brush. Shape and size can be changed in menu > tools.

  • left mouse button (LMB) – drawing with the primary brush
  • right mouse button (RMB) – drawing with the secondary brush
  • shift + LMB or RMB – drawing a line
  • ctrl + LMB or RMB – drawing a rectangle
  • alt – preventing from rewriting elements (while holding)
  • middle mouse button (MMB) – picker tool
  • MMB + shift or ctrl – can tool

Templates

Several prepared templates can be found in menus > tools. Insertion can be cancelled using RMB.

Saved canvases can also be inserted as templates.

Preview - templates
Preview - templates

Editing tools

Canvas editing tools (fill, clear, flip, rotate...) can be found in menus > edit.

Debugging

Press F12 to show the console.

Saving and loading

There are two file formats:

  • *.sgs – saving is done by object serialization. After loading, the canvas is exactly the same as it was. However, this solution has disadvantages such as greater memory difficulty, and occasional incompatibility between versions.

  • *.sgb – only IDs of brushes that were used to insert elements are stored. Some information such as (exact) colors or internal state may be lost. This format should be backward compatible.

Scripting

You can write scripts in JavaScript and manipulate the canvas programmatically.

If you put directory named “scripts” into the working directory you will be able to run all scripts from the menu. The second option is a build-in editor.

Get inspired by examples.

Preview - scripting
Preview - scripting

Performance

Significant effort has been invested in optimizing the game for efficiency. If, however, the simulation speed on your machine is not sufficient, try the following tips to enhance your gaming experience.

The canvas is divided into chunks – square areas with dimensions usually 20×20 points. This allows to distinguish areas where “nothing moves” and these areas are then “ignored”, thus saving performance. The aim is therefore to have the least active chunks. Do you want a huge heap of sand? – no problem – until it all moves.

Another factor affecting performance is the canvas size. Choose the canvas size with respect to performance of your computer. Use scaling if needed.

Preview - chunks
Preview - chunks

Development

Most of the codebase comes from 2014 and 2015. In 2016 version 2.03 Beta was released as the last bigger release, introducing new elements and behaviour. Version 2.04 Beta was released in 2017 with English localization and performance improvements. It currently has around 30,000 source lines of Java code.

Sand Game 2 is now in maintenance mode. No new features are planned in the future. Check Sand Game JS.

In the past, there have always been issues with Java backwards compatibility:

  • wild changes in JavaFX between Java 7 and Java 8 (APIs removed, rendering changes),
  • JavaFX was removed from Java distributions since Java 11,
  • JavaScript engine was removed from Java distributions since Java 15.

Download

EXE distribution (Windows only)

The easiest way. Java is included.

1) Download SandGame2_2-04-bundle-win.zip (71.1 MB)
2) Unzip the file
3) Double-click on SandGame2_2-04.exe

JAR distribution

Correct version and distribution of Java must be installed. Tested on Windows only.

  • Java 8 build – SandGame2_2-04.zip (1.4 MB)
    • Oracle JRE 8   9, 10 – broken scripting editor, 11 and later – it lacks JavaFX
    • BellSoft Liberica Full JRE 8   11 and later – broken scripting editor
    • Amazon Corretto JRE 8 and later – it lacks some JavaFX features
    • Eclipse Temurin/Adoptium JRE 8 and later – it lacks JavaFX
  • Java 11 build with JavaFX Windows binaries included – SandGame2_2-04-J11-win.zip (34.6 MB)
    • Oracle JRE 11, 12, 13, 14   15 and later – it lacks JavaScript engine
    • BellSoft Liberica JRE 11   17 and later – it lacks JavaScript engine
    • Amazon Corretto JRE 11   17 and later – it lacks JavaScript engine
    • Eclipse Temurin/Adoptium JRE 11   17 and later – it lacks JavaScript engine

There is a successor called Sand Game JS. It's more advanced and playable right in your browser!

Discussion

There are 13 comments.

Why can’t pc play this

The file is not accessible as it's made for a PC on Windows, and my Chromebook is not a PC, or on Windows.

Replying to eee849bb-8f71-49be-9284-f46514ef67e5:

Did you read all of the comments?

Replying to f0651f5a-9d3e-4135-ae21-389cd0cd1829:

it makes no sense why we cant play this

Java 8 cannot be operated on the device I'm using and all the search results say nothing about how to do it.

Replying to 377dc9ed-6cdf-4461-ae49-e8e6166b19ca:

That would be cool, but we’re a long way off from that.

Replying to 1c1598b5-66db-4711-b53a-4cf966903398:

It will probably be more technically challenging, but it should be possible. Download the .jar build for Java 8 and search "how to run a JAR on a Chromebook" or something...

Sorry if i'm getting annoying.

Can you add vehicles (like planes and cars) to SandSaga? You would right click the vehicle and you could use the arrow keys to control it, for planes you don't need to press <- and -> while flying and to start planes you press /|\ and while on the ground the <- and -> keys can be used for taxing. Cars use the arrow keys but \|/ and /|\ don't do anything.

Replying to 75fe9585-5da2-4305-9208-6d6fa9977b38:

Yes, the data file cannot be opened on chromebook.

Replying to 20b6ba8c-0014-4715-892b-28c0e5d23a55:

You mean Chromebook?

Sadly its not available on google chrome

you should upload this on steam when its finished!