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

Engine Architecture Guides #9

Closed
stefnotch opened this issue Feb 7, 2023 · 6 comments
Closed

Engine Architecture Guides #9

stefnotch opened this issue Feb 7, 2023 · 6 comments

Comments

@stefnotch
Copy link
Owner

https://bevy-cheatbook.github.io/introduction.html

@stefnotch stefnotch changed the title Guides Engine Architecture Guides Feb 7, 2023
@stefnotch
Copy link
Owner Author

stefnotch commented Feb 7, 2023

@stefnotch
Copy link
Owner Author

stefnotch commented Feb 7, 2023

Rust hurting my brain

// https://www.reddit.com/r/rust/comments/tdrrop/which_heterogenous_list_generic_tuple_library/

fn test() {
    let query = (H, (H, Null));
    let nully = query.gib();
    let e = query.0;
}

trait HList {
    type Output;
    // Define whatever fns you need here.
    // In my experience you usually want to operate on all values of your HList recursively.
    fn gib(&self) -> Self::Output;
}

// This is your "base case", an empty HList.
struct Null;

impl HList for Null {
    type Output = ();
    // Implement your fns with a simple base case implementation.
    fn gib(&self) -> Self::Output {
        ()
    }
}

// This is the "recursive case", defining variable length lists.
impl<H, T> HList for (H, T)
where
    T: HList,
    H: Cat,
{
    type Output = (H::Output, T::Output);
    // Implement your fns, often calling the same fn on `T`.
    // This allows you to recursively operate on your list.
    fn gib(&self) -> Self::Output {
        (self.0.gib_value(), self.1.gib())
    }
}

struct H;
impl Cat for H {
    type Output = i32;
    fn gib_value(&self) -> Self::Output {
        1
    }
}

trait Cat {
    type Output;
    fn gib_value(&self) -> Self::Output;
}

@stefnotch
Copy link
Owner Author

Scene graphs

Features

  • maybe have a concept of "required systems" or "enabled systems", like a scene that doesn't require the physics engine, or two scenes that want a separate instance of the physics engine (see bevy Scenes bevyengine/bevy#255 (comment))
  • serialization format (on disk)
  • loading a scene, loading multiple scenes at the same times
  • referencing assets (which have stable IDs)
  • unloading (after a level is done)

Actor graphs

  • actors, children, scripts, ...
  • might be the same as a scene graph

Out of scope/no use-case

  • prefabs
  • saving a scene

See here for an API example https://github.com/bevyengine/bevy/blob/main/examples/scene/scene.rs

And see here for how a popular game engine does it https://docs.godotengine.org/en/stable/getting_started/step_by_step/nodes_and_scenes.html

@YouSafe
Copy link
Collaborator

YouSafe commented Feb 8, 2023

Rust Engine + Game:
https://github.com/franckv/gobs-engine

@stefnotch
Copy link
Owner Author

ECS is nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants