Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flappy bevy example #4923

Closed
wants to merge 11 commits into from
Closed

flappy bevy example #4923

wants to merge 11 commits into from

Conversation

af-games
Copy link

@af-games af-games commented Jun 4, 2022

Objective

  • Include a fun new example game

Solution

  • Built flappy bird clone where there are many birds. Aimed for idiomatic and minimal code.

}

#[derive(Component)]
struct Chaos;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that Chaos, Gravity or DriftToCenter components have value; the behavior can be configured based on adding and removing the systems.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't remove systems from a schedule, right? At most have a run criterion to disable them. Also these components are not global, but specific to the properties of specific entities it seems, so globally adding or removing systems wouldn't work.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These systems could all operate on Bird. I've been using a Component for each distinct behavior if possible for clarity.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, the main thing here is that when designing which components I use, I try and think about this in terms of future extensibility.

I think that Gravity is plausible to extend, but the others probably aren't? That said, I think there's an argument for keeping this as minimal as possible to improve the clarity as a learning example.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would argue for keeping these micro-components separate as they can be copy-pasted into new users' projects.

@alice-i-cecile
Copy link
Member

#2504 would help make this example much cleaner.

@alice-i-cecile
Copy link
Member

My opinion is that this example is appealing and valuable: it more clearly demonstrates some of the fundamental notions of ECS (operating on groups of entities) than the Breakout example. I'd like to include this, and later work towards a more scalable example presentation schema than large nested folders.

@alice-i-cecile alice-i-cecile added the C-Examples An addition or correction to our examples label Jun 5, 2022
@af-games
Copy link
Author

af-games commented Jun 6, 2022

Is there anything else I need to do to move this along?

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just needs another couple of reviews :) I want more discussion and feedback on whether we should add this as another game example, but I'm happy with the code itself now.

The main drawback is that this is more code to maintain, and doesn't necessarily showcase new concepts. My personal opinion is that it's worth it on the balance, but we still need a better solution to manage the growing collection of examples.

If you want to be proactive about it, starting a thread on Discord about this PR is the best way to stimulate that sort of discussion IME.

@mockersf
Copy link
Member

mockersf commented Jun 6, 2022

this game could use a "restart" or "you lost" screen. as is, if you start the example and don't do anything, the birds fall down and out of the screen and you end up not being able to do anything but quitting

@af-games
Copy link
Author

af-games commented Jun 7, 2022

this game could use a "restart" or "you lost" screen. as is, if you start the example and don't do anything, the birds fall down and out of the screen and you end up not being able to do anything but quitting

I have some ideas to make the game more player-friendly, but I've implemented none of them in a bid to keep the example minimal.

  1. Auto flap: a system periodically flaps until space is pressed, at which point the auto flap system is disabled. A good implementation of this would decouple the input from the flap using an event which is also sent by auto flap.
  2. Respawn: when the last bird dies, spawn another after a short time.
  3. Explainer text: large text top center saying 'PRESS SPACE TO FLAP' until space is pressed

1 & 2 are implemented in the following commit, which also fixes the 'birds falling out of the sky' issue by putting the flap system in PostUpdate. It increases the length of the example from 280 to 380 lines. Is it worth it?

@alice-i-cecile
Copy link
Member

From a pure game design perspective, I like 2 but not 1. Player agency is good! I don't think 3 is needed.

Overall I would prefer restarting the game using states and a Game Over screen rather than startup systems. It demonstrates how to handle this pattern much more realistically, and is worth the added length.

@bas-ie
Copy link
Contributor

bas-ie commented Oct 2, 2024

Backlog cleanup: had a crack at this one myself! But see linked PR for discussion, probably consign this to history with thanks to the original contributor.

@bas-ie bas-ie closed this Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Examples An addition or correction to our examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants