Skip to content
 
 

Repository files navigation

The Powder Toy - Multithreaded

The Powder Toy is a free physics sandbox game, which simulates air pressure and velocity, heat, gravity and a countless number of interactions between different substances! The game provides you with various building materials, liquids, gases and electronic components which can be used to construct complex machines, guns, bombs, realistic terrains and almost anything else.

This version of The Powder Toy features a multithreaded simulation engine that significantly improving performance on modern multi-core processors. By distributing the simulation workload across all available CPU cores for allowing much larger and more complex saves to run smoothly at higher frame rates. Even in most demanding scenes you can achieve 60 FPS with average CPU.

Get the latest version from the Powder Toy website. To use online features such as saving, you need to register an account. You can also visit the official TPT forum.

Build instructions (Linux)

To build The Powder Toy on Linux, you will need a C++20 compatible compiler (GCC 11+ or Clang 14+), Meson, and Ninja.

Dependencies

On Debian/Ubuntu-based distributions, you can install the required dependencies with:

sudo apt update
sudo apt install meson ninja-build build-essential \
    libsdl2-dev libpng-dev libfftw3-dev libcurl4-openssl-dev \
    libjsoncpp-dev libluajit-5.1-dev libbz2-dev

Building

The project uses the Meson build system. We provide two main build configurations:

Release Target

Optimized for performance with -O3 and -march=native. It uses prebuilt static libraries for easier deployment.

meson setup -Dbuildtype=release -Dstatic=prebuilt build-release
meson compile -C build-release

The resulting binary will be located at build-release/powder.

Debug Target

Optimized for debugging with -Og and full debug symbols.

meson setup -Dbuildtype=debug build-debug
meson compile -C build-debug

The resulting binary will be located at build-debug/powder.

Special Thanks

  • Stanislaw K Skowronek - Designed the original Powder Toy
  • Simon Robertshaw - Wrote the website, current server owner
  • Skresanov Savely
  • Pilihp64
  • Catelite
  • Victoria Hoyle
  • Nathan Cousins
  • jacksonmj
  • Felix Wallin
  • Lieuwe Mosch
  • Anthony Boot
  • Me4502
  • MaksProg
  • jacob1
  • mniip
  • LBPHacker

Libraries and other assets used

License

The Powder Toy is free and the source code is distributed under the GNU General Public License (GPL). See the LICENSE file for details.

Instructions

Click on the elements with the mouse and draw in the field, like in MS Paint. The rest of the game is learning what happens next.

Controls

Key Action
TAB Switch between circle/square/triangle brush
Space Pause
Q / Esc Quit
Z Zoom
S Save stamp (use with Ctrl when STK2 is out)
L Load last saved stamp
K Stamp library
0-9 Set view mode
P / F2 Save screenshot as .png
E Bring up element search
F Pause and step to next frame
G Increase grid size
Shift + G Decrease grid size
H Show/Hide HUD
Ctrl + H / F1 Show intro text
D / F3 Debug mode (use with Ctrl when STK2 is out)
I Invert Pressure and Velocity map
W Cycle gravity modes (use with Ctrl when STK2 is out)
Y Cycle air modes
Ctrl + E Cycle edge modes
B Enter decoration editor menu
Ctrl + B Toggle decorations on/off
N Toggle Newtonian Gravity on/off
U Toggle ambient heat on/off
Ctrl + I Install powder toy, for loading saves/stamps by double clicking
Backtick Toggle console
= Reset pressure and velocity map
Ctrl + = Reset Electricity
[ Decrease brush size
] Increase brush size
Alt + [ Decrease brush size by 1
Alt + ] Increase brush size by 1
Ctrl + C/V/X Copy/Paste/Cut
Ctrl + Z Undo
Ctrl + Y Redo
Ctrl + Cursor drag Rectangle
Shift + Cursor drag Line
Middle click Sample element
Alt + Left click Sample element
Mouse scroll Change brush size
Ctrl + Mouse scroll Change vertical brush size
Shift + Mouse scroll Change horizontal brush size
Shift + R Horizontal mirror for selected area when pasting stamps
Ctrl + Shift + R Vertical mirror for selected area when pasting stamps
R Rotate selected area counterclockwise when pasting stamps
F11 Toggle fullscreen

Command Line

Command Description Example
scale:SIZE Change window scale factor scale:2
kiosk Fullscreen mode
proxy:SERVER[:PORT] Proxy server to use proxy:wwwcache.lancs.ac.uk:8080
open FILE Opens the file as a stamp or game save
ddir DIRECTORY Directory used for saving stamps and preferences
ptsave:SAVEID Open online save, used by ptsave: URLs ptsave:2198
disable-network Disables internet connections
disable-bluescreen Disable bluescreen handler
redirect Redirects output to stdout.txt / stderr.txt
console Redirects output to a new console on Windows
cafile:CAFILE Set certificate bundle path cafile:/etc/ssl/certs/ca-certificates.crt
capath:CAPATH Set certificate directory path capath:/etc/ssl/certs

About

Written in C++ and using SDL, The Powder Toy is a desktop version of the classic 'falling sand' physics sandbox... Now with multithreading!

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages