Beetmash
Docs > Beetmash > Quick Start

Quick Start

In this tutorial we will publish a scene to Beetmash.

This tutorial assumes basic knowledge of the cargo and crates.io workflows.

Show Final Code
Cargo.toml
[package]
name = "mrchantey_beetmash_hello_world"
version = "0.1.2"
edition = "2021"
license = "MIT"
description = "My First published Beetmash scene"
[dependencies]
beetmash_template = "0.0.6-rc.5"
[[package.metadata.scene]]
name = "hello-world"
app = "beetmash_template/my-base-scene"
scenes/hello-world.json
{
"resources": {},
"entities": {
"4294967296": {
"components": {
"bevy_core::name::Name": "Circle",
"beetmash_scene::utils::bundle_placeholder::BundlePlaceholder": {
"Pbr": {
"mesh": {
"Circle": {
"radius": 4.0
}
},
"material": {
"Color": {
"LinearRgba": {
"red": 1.0,
"green": 1.0,
"blue": 1.0,
"alpha": 1.0
}
}
}
}
},
"bevy_transform::components::transform::Transform": {
"translation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"rotation": {
"x": -0.70710677,
"y": 0.0,
"z": 0.0,
"w": 0.70710677
},
"scale": {
"x": 1.0,
"y": 1.0,
"z": 1.0
}
}
}
},
"4294967297": {
"components": {
"bevy_core::name::Name": "Cube",
"beetmash_scene::utils::bundle_placeholder::BundlePlaceholder": {
"Pbr": {
"mesh": {
"Cuboid": {
"width": 1.0,
"height": 1.0,
"depth": 1.0
}
},
"material": {
"Color": {
"Srgba": {
"red": 0.4862745,
"green": 0.5647059,
"blue": 1.0,
"alpha": 1.0
}
}
}
}
},
"bevy_transform::components::transform::Transform": {
"translation": {
"x": 0.0,
"y": 0.5,
"z": 0.0
},
"rotation": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 1.0
},
"scale": {
"x": 1.0,
"y": 1.0,
"z": 1.0
}
}
}
}
}
}

👋 Hello World!

Lets start by creating a new project and publishing it. Because this is a demo crate lets be polite to future publishers and use a scoped name, I recommend the {github_username}_beetmash_ prefix.

Installation
# these utilities allow us to make most changes in the terminal
cargo install cargo-set cargo-edit
cargo init mrchantey_beetmash_hello_world
cd mrchantey_beetmash_hello_world
cargo set package.license "MIT"
cargo set package.description "My First published Beetmash scene"
cargo publish --no-verify --allow-dirty

Any crate can be visited on Beetmash, try finding yours!

beetmash.com/crates/mrchantey_beetmash_hello_world

🎥 Our first scene

Beetmash scenes are declared in Cargo.toml in a similar way to examples, lets create a scene and publish it:

  1. Create a scene file in scenes/hello-world.json
    View scene file
    scenes/hello-world.json
    {
    "resources": {},
    "entities": {
    "4294967296": {
    "components": {
    "bevy_core::name::Name": "Circle",
    "beetmash_scene::utils::bundle_placeholder::BundlePlaceholder": {
    "Pbr": {
    "mesh": {
    "Circle": {
    "radius": 4.0
    }
    },
    "material": {
    "Color": {
    "LinearRgba": {
    "red": 1.0,
    "green": 1.0,
    "blue": 1.0,
    "alpha": 1.0
    }
    }
    }
    }
    },
    "bevy_transform::components::transform::Transform": {
    "translation": {
    "x": 0.0,
    "y": 0.0,
    "z": 0.0
    },
    "rotation": {
    "x": -0.70710677,
    "y": 0.0,
    "z": 0.0,
    "w": 0.70710677
    },
    "scale": {
    "x": 1.0,
    "y": 1.0,
    "z": 1.0
    }
    }
    }
    },
    "4294967297": {
    "components": {
    "bevy_core::name::Name": "Cube",
    "beetmash_scene::utils::bundle_placeholder::BundlePlaceholder": {
    "Pbr": {
    "mesh": {
    "Cuboid": {
    "width": 1.0,
    "height": 1.0,
    "depth": 1.0
    }
    },
    "material": {
    "Color": {
    "Srgba": {
    "red": 0.4862745,
    "green": 0.5647059,
    "blue": 1.0,
    "alpha": 1.0
    }
    }
    }
    }
    },
    "bevy_transform::components::transform::Transform": {
    "translation": {
    "x": 0.0,
    "y": 0.5,
    "z": 0.0
    },
    "rotation": {
    "x": 0.0,
    "y": 0.0,
    "z": 0.0,
    "w": 1.0
    },
    "scale": {
    "x": 1.0,
    "y": 1.0,
    "z": 1.0
    }
    }
    }
    }
    }
    }
  2. Declare the scene in Cargo.toml
    Cargo.toml
    [[package.metadata.scene]]
    name = "hello-world"
  3. Publish the changes
    Terminal window
    cargo set-version --bump patch
    cargo publish --no-verify --allow-dirty
beetmash.com/crates/mrchantey_beetmash_hello_world/hello-world

💃 Running an App

Note that when we visited the scene the app panel says no app specified. There is a simple base app in the beetmash_template crate called my-base-scene, lets use that one:

  1. Install beetmash_template
    Terminal window
    cargo add beetmash_template
  2. Declare the app in Cargo.toml
    Cargo.toml
    [[package.metadata.scene]]
    name = "hello-world"
    app = "beetmash_template/my-base-scene"
  3. Publish
    Terminal window
    cargo set-version --bump patch
    cargo publish --no-verify --allow-dirty

Now when we revisit the page we can load the scene!