Beetmash

Bevy Turns Four

Why we're betting big on Bevy

Written by Peter Hayman -

The bevy logo with a heart

For Bevy’s fourth birthday @cart has encouraged us to reflect on our Bevy journeys. I’m embracing the opportunity to procrastinate by setting up the blog section of the website take a break from coding to develop on my communication skills.

At Beetmash we are building a simulation platform for non-technical people and use-cases, you can read more about it here. The Bevy engine is the foundational layer of our tech stack, and I believe its modular architecture offers an opportunity that we are just scratching the surface of.

Community

I discovered Bevy circa 0.7, the tech stack looked promising but what really caught my eye when visiting the Discord was so much positivity! The Bevy community vibes were a major factor in my decision to get more involved, and gave me the confidence to start contributing the first meaningful PRs I’ve made to any open source project.

Programs that scale

Development platforms for beginners have traditionally been built with zero-friction as their north star. This makes sense, its easy to forget the barriers to entry faced by a novice electronics engineer wanting to create e blinky before Arduino. Its reasonable that the architecture of the user’s program was a non-goal for the Arduino team, the focus was elsewhere.

The problem occurs at the intermediate stage, at least it did for me. My tiny Arduino sketches were working so well that I got ambitions for a more complex project, but the ecosystem was geared toward getting up and running quickly, at the cost of a professional IDE, software design patterns etc.

It seems to me we don’t need to make that tradeoff anymore. Bevy has made a highly performant design pattern accessible to beginners. Bevy can expose a simple interface just the Arduino or Processing setup() loop() pattern, and additionally scale to the kinds of applications that are worked on by large teams.

I would personally make the case that ECS is a healthier way to introduce a beginner to realtime programming than the freeform, global scope approach currently popular in learn-to-code software. Its true that it adds extra concepts but they are straightforward. ECS provides a mental model for state, and its a pattern that scales.

Simulation, Browsers and Microcontrollers

I’ve spent the last four years searching for a unifying tech stack with the following capabilities:

  1. 3D Simulation
  2. Targets Browsers
  3. Targets Microcontrollers

After various prototypes with C++, Javascript, Unity, MicroPython and even running a WASM interpreter on the microcontroller, I found that none did an excellent job at all three of these.

I’d been aware of Bevy’s modular sub-crate architecture for some time, but at some point it clicked that bevy_ecs just might run on a microcontroller, which would allow users to run exactly the same code on-device as in simulation. Excited to see what would happen, I tried running a simple hello world program on an ESP32-C3 I had lying around, and it worked! Fantastic, now just to add the wifi stack on top.. Panicked allocating bytes. Bummer, out of memory… but wait, how much memory? The ESP32-C3 clocks in at 400kb of RAM, but its beefier ESP32-S3 cousin with a similar <$10 price tag has a 16MB variant! I ordered a handful of those and ran my first wifi-enabled Bevy app on a microcontroller, and it worked! 🎸🎸🎸

Logic as Entity Trees

One of our goals is for our platform to be accessible to absolute beginners. Easy to get started with like Scratch, but able to scale to serious usage like Unreal Blueprints. An entity based logic flow seems the natural fit for an ECS engine, especially with the recent introduction of observers. This is the reasoning behind beet, our Entity based behavior library.

The default arrangement of behaviors in Beet is a tree, piggybacking the Parent-Child relationship. Aside from keeping things untangled, this offers the important ability for people to compose behaviors just like they might compose prefabs into a scene. Aside from benefits in a users own project, this makes it very easy to share behaviors, large and small. One user can publish a navigation behavior and another can include it in their enemy behavior. Thats why we’re building a scene registry on top of crates.io.

Whats Next

At the moment we’re building out the MVP: a basic scene registry, a web editor and a some demonstrations for the product. I’m so amped to be in the Bevy flock and could chirp chirp for days about it but tonights pizza and Kill Tony night so its time to head back to the nest 🐦