A framework for building adventure games in Bevy.

Overview

Bevy_adventure

A framework for building 3d adventure games in Bevy.

preview.mp4

Features

  • Interactive trait is the backbone of the framework, allowing you to create powerful, dynamic objects in your world that can be interacted with and can affect other objects or global state.
  • Scene trait exposes a Plugin-like interface for managing GLTF scenes and assigning components to entities (based on bevy_scene_hook)
  • WorldState resource, a stringly-typed storage for tracking progression
  • Inventory resource allows you to track held items and create recipes for combining them
  • Automatic camera animation and state management, Component-based interface
  • Support for multiple scenes (built on top of iyes_loopless)

Examples

There is an elaborate example available at examples/main.rs. Three scenes are included, with multiple objects that can be interacted with or picked up.

Notes

Save States

bevy_adventure intentionally omits implementing save state functionality, as different games will have different requirements.

If you want to implement this, here is what you need to keep track of:

  • CurrentSpot resource, which determines your current camera spot in the scene. When saving, save the name of the CameraSpot from this resource. When loading, create a new NextSpot instance from the loaded name, and insert it with Commands.
  • CurrentState<State> resource, (from iyes_loopless) which determines what scene is currently loaded
  • Inventory resource, which tracks what items the player is holding
  • WorldState resource, the global game state storage

You will also have to enable the serde feature to allow serialization and deserialization of these resources.

Using WorldState

When you are building interactives, you have the ability to store information in the component itself or the WorldState.

The component should only hold temporary state information - like which drawer is open on a dresser or if an entity has been spawned.

If you want to store any other kind of information, it should be done in the WorldState resource. This is so other interactives in your scene can access this state (for example, you'd flip a switch and the lights would go out) and so you are storing state information in a single place.

Creating scenes

When implementing the Scene trait, the scene method should return a path to a file that can be loaded with the AssetServer to create a Bevy Scene. In practice this is a GLTF scene file, but any other format can be used as long as it creates a Bevy Scene when loaded.

When imported with bevy_adventure, Cameras are automatically converted to CameraSpots, and PointLights are configured to cast shadows.

The Scene trait's spawn method is called for every Entity in the scene - you can use this to assign components and initialize behavior for objects in your scene. The best way to do this is to match entity Names (from their names in the Scene), see the examples for an idea of how you should do this.

The only real requirement for your scene is that you create a special Camera with the name Camera_Main. This is where your Camera will be positioned upon entering the Scene. The app will panic if a scene is loaded without the Main Camera.

If you have issues matching objects by name, you might be matching the parent instead of the actual object you want to match. Adding a print statement inside of your Scene's spawn method might help you figure out if the object is actually being found.

Note that when you are loading Scenes into Bevy, the 'Transform Scale' of each object is also loaded in. This could cause colliders to be the wrong size - you should 'apply Scale' before exporting.

Object origin is also used loaded in - this could cause misaligned colliders if your object's origin doesn't match the center of your object.

Blender is a good choice to create GLTF scenes, but you must make sure you configure the export settings correctly:

  • Under Include, check Custom Properties, Cameras, and Punctual Lights.
  • Under Transform, uncheck Y+ Up

TODO

  • Audio example
  • Save state example

License

bevy_adventure is dual-licensed under MIT and Apache-2.0.

Compatibility

NOTE: We do not track Bevy main.

Bevy Version Crate Version
0.9 0.1
You might also like...
A Rust framework for building Minecraft servers.

A Rust framework for building Minecraft: Java Edition servers. Like feather, Valence is an effort to build a Minecraft compatible server completely fr

Minecraft-esque voxel engine prototype made with the bevy game engine. Pending bevy 0.6 release to undergo a full rewrite.
Minecraft-esque voxel engine prototype made with the bevy game engine. Pending bevy 0.6 release to undergo a full rewrite.

vx_bevy A voxel engine prototype made using the Bevy game engine. Goals and features Very basic worldgen Animated chunk loading (ala cube world) Optim

bevy-hikari is an implementation of voxel cone tracing global illumination with anisotropic mip-mapping in Bevy
bevy-hikari is an implementation of voxel cone tracing global illumination with anisotropic mip-mapping in Bevy

Bevy Voxel Cone Tracing bevy-hikari is an implementation of voxel cone tracing global illumination with anisotropic mip-mapping in Bevy. Bevy Version

A simple extension for `bevy-editor-pls` to support tilemap editing right inside the bevy app.

What is this This is a simple tilemap editor plugin, that hooks right into bevy_editor_pls to work with bevy_ecs_tilemap. It works completely within i

Bevy Simple Portals is a Bevy game engine plugin aimed to create portals.
Bevy Simple Portals is a Bevy game engine plugin aimed to create portals.

Portals for Bevy Bevy Simple Portals is a Bevy game engine plugin aimed to create portals. Those portals are (for now) purely visual and can be used t

Minecraft using Bevy and Bevy-Meshem

minecraft_bevy Minecraft_bevy was built to showcase bevy_meshem. After a week of developing it has: Chunk loading / unloading each chunk's mesh is bei

A frontend to Assets purchased on Epic Games Store
A frontend to Assets purchased on Epic Games Store

Epic-Asset-Manager A frontend to Assets purchased on Epic Games Store Current Screenshot Install Arch Linux Use the AUR package Build flatpak meson _b

A single-threaded polling-based Rust async executor suitable for use in games, embedded systems or WASM.

simple async local executor An Enlightware® software. Overview A single-threaded polling-based executor suitable for use in games, embedded systems or

Synchronize games from other platforms into your Steam library

BoilR Description This little tool will synchronize games from other platforms into your Steam library, using the Steam Shortcuts feature. The goal is

Owner
Hank Jordan
level 5 code wizard
Hank Jordan
A first-time implementation of Conway's Game of Life in Rust: Adventure and Commentary

A Commentary on Life This project documents the process and final result of my first-ever attempt at implementing Conway's Game of Life. I'll be using

Avery R. 2 Feb 25, 2022
An ergonomic physics API for bevy games.

Heron An ergonomic physics API for 2d and 3d bevy games. (powered by rapier) How it looks like fn main() { App::build() .add_plugins(DefaultPlug

Jonathan Cornaz 313 Dec 16, 2022
A simple camera for properly displaying tile-based low resolution pixel perfect 2D games in bevy.

Bevy Tiled Camera A simple camera for properly displaying low resolution pixel perfect 2D games in bevy. The camera will adjust the viewport to scale

sark 10 Oct 5, 2022
Bevy virtual Joystick for mobile games (Works with mouse on desktop)

Bevy Virtual Joystick Create and use a Virtual Joystick in a UI for bevy Game Engine. Versions Aviable and compatible versions bevy VirtualJoystick 0.

Sergio Alejandro Ribera Costa 7 Apr 16, 2023
Explicitly set sprite layers for sprites in Bevy games.

extol_sprite_layer lets you specify the drawing order for sprites in your Bevy game using a separate component rather than via the z-coordinate of you

Ash 5 May 2, 2023
Highly customizable splash screen library for Bevy games.

bevy_intro_screen This is a versatile Bevy library designed to create engaging and customizable introductory screens for your game. Initially conceive

Aarav Shah 4 Aug 13, 2024
Hierarchical Task Network Planning deeply integrated with bevy, which I use in my games :P

Note that CI currently tests against a matrix of (windows, mac, linux) * (toolchain stable, nightly) * (cargo build, test, clippy), which ensures vali

null 29 Oct 16, 2024
A framework for making games using Macroquad.

Omegaquad A framework for making games using Macroquad. After writing maybe 5 games and finding myself always going to the previous project to copy-pa

null 14 Oct 13, 2022
A framework for modding and instrumenting games.

me3 A framework for modifying and instrumenting games. Explore the docs » Report Bug · Request Feature About The Project Built With Getting Started Pr

Gary Tierney 13 Dec 18, 2022
A place to start when building webgl apps in Bevy. Use this to avoid writing the boilerplate.

Template Bevy project with WebGL enabled Prerequisites cargo install cargo-make Build and serve WASM version Set your local ip address in Makefile.to

Michael Dorst 0 Dec 24, 2021