Skip to content

olekspickle/bevy_new_3d_rpg

Repository files navigation

3D Bevy game template

settings UI demo ahoy KCC demo animation graph demo

This template is based on the awesome BevyFlock 2D template featuring out of the box builds for:

  • Windows
  • Linux
  • macOS
  • Web (Wasm) This template is a great way to get started if you aim to build new 3D Bevy game! It is not as simple as bevy_new_2d which is aimed to an easy start and no dependencies. It focuses instead to a rather solid starting template with some basic bells and whistles to be able to carry the weight of big projects and tries to follow the flat architercture principle. Start with a basic project and CI / CD that can deploy to itch.io. You can try this template in your browser!

Best way to start

Install cargo-generate or bevy_cli and run:

cargo generate olekspickle/bevy_new_3d_rpg -n my-3d-game
# or with bevy_cli
bevy new -t=olekspickle/bevy_new_3d_rpg my-3d-game

If you already know what camera mode do you want you probably should delete everything related to other camera setups, e.g. if you want FPV, remove code related to top_down and third_person features and use bevy_ahoy for camera handling. This will shave off some dependencies. You can of course leave it all and delete all features if you want camera setup be toggleable in settings or different modes: for example FPV by foot but third person in vehicles or vice versa.

Hotpatching

To set this up, follow the instructions in the release announcement

  • Linux: makers hot or cargo make hot or bash BEVY_ASSET_ROOT="." dx serve --hot-patch
  • Windows PS:$env:BEVY_ASSET_ROOT="." ; dx serve --hot-patch

Features:

  • flat cargo project structure for game logic crates that can grow and be maintainable
  • import and usage of game mechanics and parameters from .ron (config, credits) (kudos to Caudiciform)
  • simple asset loading based on bevy_asset_loader with loading from path addition (kudos to Caudiciform)
  • third person camera with bevy_third_person_camera
  • top down camera with bevy_top_down_camera
  • solid keyboard & gamepad mapping to ui & game actions using bevy_enhanced_input
  • simple scene with colliders and rigid bodies using avian3d
  • kinematic character controller using bevy_ahoy adapted to third person
  • simple skybox sun cycle using bevy atmosphere example, with daynight and nimbus modes
  • featuring rig and animations using Universal Animation Library from quaternius
  • experimental sound with bevy_seedling based on Firewheel audio engine (which will probably be upstreamed), with improved audio for web
  • different music(exploration, combat) on zone change event with music crossfade and playback tracking
  • setup for playing music from a list of tracks with deterministic never repeating playback (thx bevy_shuffle_bag)
  • consistent Esc back navigation in gameplay and menu via stacked modals (kudos for the idea to skyemakesgames)
  • serialize and save settings
  • audio, video and keys rebind tabs in settings (currently broken)
  • easy drop in scene integration using awesome skein with a simple scene
  • custom font replace example using pre-loaded font
  • simple blended animation setup with AnimationGraph & smooth AnimationTransitions

TODOs

Run your game

There are some helpful commands in Makefile to simplify build options But generally running your game locally is very simple:

with bevy_cli
  • Dev: bevy run to run a native dev build
  • Release: bevy run --release to run a native release build
  • Use bevy run --release web to run a web release build To run a web dev build to run audio in separate thread to avoid audio stuttering:
  • :bash bevy run web --headers="Cross-Origin-Opener-Policy:same-origin" --headers="Cross-Origin-Embedder-Policy:credentialless"
with cargo-make
  • Install cargo-make: cargo install cargo-make

  • Dev: makers run or cargo make run to run a native dev build

  • Release: makers build or cargo make build to build a native release build

  • Web: makers run-web or cargo make run-web to run a web dev build to run audio in separate thread to avoid audio stuttering

Installing Linux dependencies

If you're using Linux, make sure you've installed Bevy's Linux dependencies. Note that this template enables Wayland support, which requires additional dependencies as detailed in the link above. Wayland is activated by using the bevy/wayland feature in the Cargo.toml.

(Optional) Improving compile times

.cargo/config.toml contains documentation on how to set up your environment to improve compile times.

WARNING: if you work in a private repository, please be aware that macOS and Windows runners cost more build minutes. For public repositories the workflow runners are free!

Release your game

This template uses GitHub workflows to run tests and build releases. Check the release-flow

Credits

The assets in this repository are all either by me or CC0 3rd-party. See the credits for more information.

License

The code is under CC4 licence

Bevy Compatibility

bevy bevy_new_3d_rpg
0.18 0.18.*
0.17 0.2.*
0.16 0.1.4

About

Solid bevy game template for 3d RPG/shooter games

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages