bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Bevy game templates

Open alice-i-cecile opened this issue 3 years ago • 9 comments

What problem does this solve or what need does it fill?

Bevy games are becoming increasingly sophisticated. It's important to see realistic examples for both users and developers: teaching best practices, reducing ramp-up and spotting holes in the engine.

For example, 2D platformers are a very popular starting project, and it can be surprisingly hard to figure out how to make one in Bevy.

Game templates, especially official ones, will help educate users, and ensure that the engine ships with the basic tools to make this easy.

What solution would you like?

  1. Create a templates category on Bevy Assets (or its successor).
  2. Create a standardized process by which to make game templates (a meta-template?), likely using cargo generate.
  3. Create an initial official game template or two. These should likely live within the Bevy org, but in their own repo and should be updated before each official release to spot critical problems.

What alternative(s) have you considered?

Create more official example games. This is worse because:

  • bloats the size of this repo, worsening contributor experience
  • cannot be easily used to start new projects
  • cannot reasonably rely on 3rd party plugins, even when using them is best practice
  • harder to discover
  • increases friction with each PR
  • harder to delegate authority for

alice-i-cecile avatar Jul 18 '22 22:07 alice-i-cecile

As a thought: i think we might want to focus on "game templates" first, then build more complex games like VVVVVV clones on top (and adapt the template as our idea of "best practices" changes).

Ex: a "platformer template" that provides the baseline platforming mechanics, animated sprites / state changes, collisions, and a simple scene, but no real "gameplay loop".

That way people wanting to build a platformer can clone bevy_template_2d_platformer and immediately start fleshing it out, rather than needing to strip out a bunch of specific gameplay things.

(I also agree with removing the good-first-issue label ... example games and templates should be developed by our most informed / experienced developers as they illustrate and effectively define best practices)

cart avatar Jul 18 '22 22:07 cart

Yep, I think that's very reasonable. And yeah, I love the idea of game templates, and want to do all we can to develop (and promote) strong ones.

Unsure where those should be kept: probably in their own repos? And then obviously promoted heavily on Bevy Assets.

alice-i-cecile avatar Jul 18 '22 22:07 alice-i-cecile

Yup my vote is new repos within the bevyengine org with a standardized naming convention (ex: bevy_template_X) and with Bevy Assets entries (and maybe boosted prominence)

cart avatar Jul 18 '22 22:07 cart

A good starting point: https://github.com/NiklasEi/bevy_game_template

It does make some opinionated decisions (e.g. using bevy_kira_audio) - is this acceptable?

If so, it could be worth looking at options for each concept; for example, it rolls its own input-mapping solution, but perhaps leafwing-input-manager might be a better choice. And until Stageless lands, using iyes_loopless

That one's a GitHub template, but I'd suggest using cargo-generate - and it can handle all of the "ToDos" renaming.

You could also add conditionals when generating so that you can make other project-specific decisions, e.g. 2D vs 3D? Do you want to include LDTK level editor support? Physics? Then pull in the crate(s) and the basic logic for these. In theory you could have one big branching template.

Edit: This is in relation to the template, not the 2D platformer.

tigregalis avatar Jul 19 '22 10:07 tigregalis

I think for template games it's reasonable to use stable ecosystem plugins. We want to showcase genuine best practices, and in a lot of cases, that means "use the cool stuff the community has made".

We may be able to migrate to bevy_audio for simple games though; it's improved a lot since that template was made.

alice-i-cecile avatar Jul 19 '22 13:07 alice-i-cecile

I don't think an official template from Bevy should use community plugins if it's to replace a part of Bevy, or if there is more than one plugin for something. And if one was used, it should be under high scrutiny, and removed as soon as another plugin would be created for the same thing.

For templates, we could use one of the recognised universal tool like https://github.com/cookiecutter/cookiecutter or https://yeoman.io, or the rust https://github.com/cargo-generate/cargo-generate.

@alice-i-cecile : should this issue still be about a 2d game, or should it be changed to be about a template?

mockersf avatar Jul 21 '22 20:07 mockersf

@alice-i-cecile : should this issue still be about a 2d game, or should it be changed to be about a template?

Agree with this, or a separate issue with cross-references (the template being a prerequisite for the 2d platformer).

For templates, we could use one of the recognised universal tool like https://github.com/cookiecutter/cookiecutter or https://yeoman.io, or the rust https://github.com/cargo-generate/cargo-generate.

My vote is on cargo-generate, because it's Rust, and Bevy users have already bought into the Rust ecosystem, i.e. users already have cargo and it's a cargo install cargo-generate to get started.

On the other hand: yeoman relies on node and npm, and cookiecutter relies on python.

I don't think an official template from Bevy should use community plugins if it's to replace a part of Bevy,

While I think this is generally a reasonable stance, if the Bevy first-party plugins aren't (yet) to the same standard, then either you do use third-party plugins, or templates are blocked on Bevy catching up in this area. And the fact is, Bevy users do tend to be using these third-party plugins like bevy_kira_audio and iyes_loopless to make real games.

or if there is more than one plugin for something. And if one was used, it should be under high scrutiny, and removed as soon as another plugin would be created for the same thing.

I don't think I agree with this. While it does mean the bevy org is "picking winners", some plugins are objectively further along / more stable / more maintained than others, and how would you build the template / game without these plugins, other than rolling your own plugin (in which case, all you're doing is picking a winner for something less tried and tested than a third-party plugin)?

It might be worth considering what the goals, non-goals and anti-goals of Bevy Templates should be. Some things to consider:

  • Showcasing the bevy ecosystem
  • Demonstrating best practices
  • Making it easy to start a game, e.g. for a game jam

tigregalis avatar Jul 21 '22 21:07 tigregalis

Updated the issue description!

I don't think an official template from Bevy should use community plugins if it's to replace a part of Bevy,

Strongly agreed here. Things like camera, physics, tilemap or input management plugins feel much more reasonable than things like audio plugins or loopless. If we can't make template games due to limitations with the current tools (not just their absence), we need to prioritize upstream fixes.

alice-i-cecile avatar Jul 22 '22 12:07 alice-i-cecile

Worth noting that there is a strong link between this issue and https://github.com/bevyengine/bevy/issues/1885

janhohenheim avatar Jul 02 '24 23:07 janhohenheim