Skip to the content.

Rusty Aquarium

Cross-compile

A monitoring visualization as an aquarium written in Rust.

Screenshot

Demo

Run Rusty Aquarium in your browser:

Download executables for different platforms:

Usage

Use these keys to control the fish tank.

Generate input data

The file assets/inputdata.json is read to define what fish to display.

The field school must be an array of objects, one for each fish to display.

The fish field must match a name in the map of fishes in the config.json file.

The fields size, speed, and bubbles are multipliers that will be applied to the corresponding value from the fish configuration.

The legend field is optional, and can be used to send information to show when opening the legend screen. The description will be shown at the top, and each fish_legend will be shown in a list below it. If present, this will override the legend field in the scene configuration.

Example

{
    "legend": {
        "description": "A description to be shown when showing legend.",
        "fish_legends": [
            {
                "fish": "crab",
                "description": "A description of this fish type."
            }
        ]
    },
    "school": [
        { "fish": "crab", "size": 1.0, "speed": 1.0, "bubbles": 1.0 },
    ]
}

System monitoring

The systemdata binary generates an inputdata.json file based on CPU, processes and disks.

cargo run --features build-systemdata --bin systemdata > assets/inputdata.json

Configuration

The file assets/config.json can be used to configure the fish tank. It has some general configuration values, paths to PNG files to load for background images and fish sprites. It also defines which fish types are available, with default values for them.

File format

Example

{
    "input_data_path": "assets/inputdata.json",
    "display_time": 10,
    "backgrounds": [
        "assets/background.png",
    ],
    "water_sprite": "water.png",
    "scenes": [
        {
            "input_data_path": "inputdata.json",
            "display_time": 5,
            "background": 3
        },
        {
            "input_data_path": "inputdata2.json",
            "display_time": 5,
            "background": 2,
            "legend": {
                "description": "These are the different fishes in this aquarium.",
                "fish_legends": [
                    {
                        "fish": "crab",
                        "description": "A happy rustacean!"
                    }
                ]
            }
        }
    ],
    "fishes": {
        "crab": {
            "texture": "assets/ferris.png",
            "size": 7.0,
            "size_randomness": 1.0,
            "movement": "Crab",
            "bubbles": 0,
            "collision_aversion": 0.3,
            "speed": {
                "x": 12.0,
                "y": 4.0
            },
            "speed_randomness": {
                "x": 1.0,
                "y": 1.0
            },
            "area": {
                "x": 5.0,
                "y": 56.0,
                "w": 90.0,
                "h": 6.0
            }
        },
    }
}

License

The code for Rusty Aquarium is released under the MIT License. See LICENSE file for more details.

The images are not covered by the license, and are to the best of my knowledge public domain.

Build scripts

The build scripts require the cargo-run-scripts package to be installed.

cargo install cargo-run-script

Build a web package in demo/

cargo run-script build-web

Start a web server

cargo run-script serve-web

Build windows binary

cargo run-script build-win

Build Android APK

cargo run-script build-apk

Related links