Skip to content
This repository has been archived by the owner on Apr 18, 2022. It is now read-only.

Load Entities from RON #112

Closed
ebkalderon opened this issue Sep 28, 2016 · 7 comments
Closed

Load Entities from RON #112

ebkalderon opened this issue Sep 28, 2016 · 7 comments
Labels
diff: hard Achievable, but may require efforts from multiple experienced developers. pri: important Something other teams are relying on, or a low-level, critical piece of functionality. type: feature A request for a new feature.
Milestone

Comments

@ebkalderon
Copy link
Member

ebkalderon commented Sep 28, 2016

We should be able to construct entities from YAML files (*.yml) stored in the resources/entities directory. Files can be nested arbitrarily in subfolders for organizational purposes, if the user wants. The markup format should be as follows:

---
component1:
    field1: true
    field2: 'value'
    field3: [1.0, 2.1]

component2:
    field1:
        - thing1
        - thing2
        - thing3

The string name of the entity is the filename minus the .yml extension. The user should be able to create an instance of such an entity in Rust code.

@ebkalderon ebkalderon added type: feature A request for a new feature. diff: normal Achievable by an reasonable experienced developer. If new to Amethyst, may need some guidance. pri: critical This issue has to be fixed ASAP. For the owning team, nothing else should be worked on. labels Sep 28, 2016
@ebkalderon ebkalderon added this to the 1.0 milestone Sep 28, 2016
@Aceeri Aceeri added diff: hard Achievable, but may require efforts from multiple experienced developers. and removed diff: normal Achievable by an reasonable experienced developer. If new to Amethyst, may need some guidance. labels Nov 15, 2016
@msiglreith
Copy link
Contributor

msiglreith commented Nov 15, 2016

Remark: Relevant specs issue amethyst/specs#18

@ghost
Copy link

ghost commented Dec 21, 2016

After taking a look at the ability to load a world/map in #145, I'm wondering how this will work for that use case. Using this approach for loading individual entities seems fine, but I think doesn't address the overall question of how to load a game world. It seems like we can proxy off most/all of the "real work" of loading entities/components to specs-rs, so if this looks right from Amethyst's POV, I can go propose this over there to see if there's any interest. Basically, it would look something like this:

impl State for SomeExample {
    fn on_start(&mut self, ctx: &mut Context, world: &mut World) {
        // other init code...

        let world_yaml = load_some_yaml_file("example");

        world.register_component(Component1, "component1");
        world.register_component(Component2, "component2");
        
        world.from_yaml(world_yaml["entities"]);
    }
}

With a resources/worlds/example.yml file that looks like this:

---
textures:
  # ...
entities:
  - component1:
      field1: true
      field2: 'value'
      field3: [1.0, 2.1]

  - component1:
      field1: false
      field2: 'value'
      field3: [1.0, 2.1]
    component2:
      field1: []

Also, I can move this to a new ticket if it seems off-topic from loading entities from yaml specifically.

@ebkalderon ebkalderon added this to Done in Engine Feb 3, 2017
@ebkalderon ebkalderon moved this from Done to Blocked in Engine Feb 3, 2017
@ebkalderon ebkalderon moved this from Blocked to New in Engine Feb 3, 2017
@Xaeroxe
Copy link
Member

Xaeroxe commented Jul 20, 2017

Same as #122 (comment)

@Xaeroxe Xaeroxe changed the title Load Entities from YAML Load Entities from ~~YAML~~ RON Aug 3, 2017
@Xaeroxe Xaeroxe changed the title Load Entities from ~~YAML~~ RON Load Entities from RON Aug 3, 2017
@Xaeroxe
Copy link
Member

Xaeroxe commented Aug 3, 2017

Ron is ready to use at this point and we've decided in other threads that's what we're going to be using, so I changed the issue title.

@zakarumych
Copy link
Member

zakarumych commented Sep 20, 2017

@Xaeroxe We should abstract away from any particular data formats where possible (and doesn't hit performance). Loading entities from any serde::Deserializer is better than just .ron
And I'd recommend using binary formats in production.

@Aceeri Aceeri removed their assignment Nov 20, 2017
@Xaeroxe
Copy link
Member

Xaeroxe commented Jan 31, 2018

I'm downgrading this to "Important" because while valuable, this isn't something we can take immediate action on.

@Xaeroxe Xaeroxe added pri: important Something other teams are relying on, or a low-level, critical piece of functionality. and removed pri: critical This issue has to be fixed ASAP. For the owning team, nothing else should be worked on. labels Jan 31, 2018
@torkleyy
Copy link
Member

I don't see how this is much different from #122, but I think it can be closed, too.

Make the engine more data-driven automation moved this from In progress to Done Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
diff: hard Achievable, but may require efforts from multiple experienced developers. pri: important Something other teams are relying on, or a low-level, critical piece of functionality. type: feature A request for a new feature.
Projects
No open projects
Development

No branches or pull requests

6 participants