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

Improve book, add diagrams #412

Merged
merged 4 commits into from
May 14, 2018
Merged

Improve book, add diagrams #412

merged 4 commits into from
May 14, 2018

Conversation

torkleyy
Copy link
Member

@torkleyy torkleyy commented May 14, 2018

Fixes #327

Rendered


This change is Reviewable

@torkleyy torkleyy added the docs label May 14, 2018
@torkleyy
Copy link
Member Author

Ah yeah, I stole your idea @WaDelma 😄

@torkleyy torkleyy requested a review from WaDelma May 14, 2018 09:26
@torkleyy
Copy link
Member Author

torkleyy commented May 14, 2018

When I made a presentation on ECS last year, I needed to explain the relationship and tables did work very well :)

Copy link
Member

@Xaeroxe Xaeroxe left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

@WaDelma WaDelma left a comment

Choose a reason for hiding this comment

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

I am not actually sure which part you stole from me :O
I added some edits that made it flow better for me, but be free to ignore any or all of the changes.
(Only really critical thing is that it says that diagram is below even though it's above :P)


In fact, an entity does not even own the components; it's just
This is where ECS comes into play: Components are *associated* with entities; you just insert some component, whenever you like.
Copy link
Member

Choose a reason for hiding this comment

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

s/you just insert some component,/you can just insert components/


In fact, an entity does not even own the components; it's just
This is where ECS comes into play: Components are *associated* with entities; you just insert some component, whenever you like.
One entity may or may not have a certain component. You can see an `Entity` as an ID into component tables, as illustrated in the
Copy link
Member

Choose a reason for hiding this comment

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

s/component/component associated with it/

Copy link
Member Author

Choose a reason for hiding this comment

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

That's what I had initially, but then the sentence sounded a bit unnatural and I didn't want to repeat "associated" as it's already used in the line before.

Copy link
Member

Choose a reason for hiding this comment

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

I'm with @torkleyy here, the extra words don't add to comprehension.

In fact, an entity does not even own the components; it's just
This is where ECS comes into play: Components are *associated* with entities; you just insert some component, whenever you like.
One entity may or may not have a certain component. You can see an `Entity` as an ID into component tables, as illustrated in the
diagram below. We could theoretically store all the components together with the entity, but that would be very inefficient;
Copy link
Member

Choose a reason for hiding this comment

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

s/below/above/

Copy link
Member Author

Choose a reason for hiding this comment

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

the one I'm referring to is below actually

Copy link
Member

Choose a reason for hiding this comment

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

Well then you are not referring to this one at all, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I don't think I am.


In fact, an entity does not even own the components; it's just
This is where ECS comes into play: Components are *associated* with entities; you just insert some component, whenever you like.
One entity may or may not have a certain component. You can see an `Entity` as an ID into component tables, as illustrated in the
Copy link
Member

Choose a reason for hiding this comment

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

Should there be clarification that metaphors tables are referring to database tables? So that a reader unfamiliar with databases wont get confused.

Copy link
Member Author

@torkleyy torkleyy May 14, 2018

Choose a reason for hiding this comment

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

That was actaually the idea I borrowed from you. I thought simply talking about a table is clear enough.

Now we're only missing the last character in ECS - the "S" for `System`. Whereas components and entities are purely data,
systems contain all the logic of your application. A system typically iterates over all entities that fulfill specific constraints,
like "has both a force and a mass". Based on this data a system will execute code, e.g. produce a velocity out of the force and the mass.
This is the additional advantage I wanted to point out with the `Player` / `Npc` example; in an ECS, you can simply add attributes and
Copy link
Member

Choose a reason for hiding this comment

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

s/is/has/
s/simply add attributes/easily add new attributes to existing entities/

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm these changes you suggest here, I don't really get how they improve the text. I think "is" fits better here because I want to regard specifically the advantage, not the way systems work.

As for the second change you propose, I chose "simply" to describe how plain the whole concept it is, yet it allows for such patterns. The difficulty of adding the attribute is not what I wanted to describe.

Copy link
Member

Choose a reason for hiding this comment

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

Personally I'd leave the "is"

I'd actually prefer a hybrid for the second request though

"simply add new attributes to entities"

systems contain all the logic of your application. A system typically iterates over all entities that fulfill specific constraints,
like "has both a force and a mass". Based on this data a system will execute code, e.g. produce a velocity out of the force and the mass.
This is the additional advantage I wanted to point out with the `Player` / `Npc` example; in an ECS, you can simply add attributes and
that's also how you define your behaviour (this is called [data-driven] programming).
Copy link
Member

Choose a reason for hiding this comment

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

s/ and that's also how you define your/. Because the systems processing depends on the components associated with an entity this is also the way you define your entities/

Copy link
Member

Choose a reason for hiding this comment

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

Suggestion seems a bit wordy and doesn't add any new information imo.

the data-oriented way, I have to disappoint you; there is none.
ECS libraries are best-suited for creating games; in fact, I've never
heard of anybody using an ECS for something else.
In case you were looking for a general-purpose library for doing it the data-oriented way, I have to disappoint you; there is none.
Copy link
Member

Choose a reason for hiding this comment

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

s/is/are/


## Specifying `SystemData`

As mentioned earlier, `SystemData` is implemented for tuples of up to 26 elements. Should you ever need
Copy link
Member

Choose a reason for hiding this comment

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

s/of //

## Specifying `SystemData`

As mentioned earlier, `SystemData` is implemented for tuples of up to 26 elements. Should you ever need
more, you could even nest these tuples. However, at some point you can't keep track of all the elements anymore.
Copy link
Member

Choose a reason for hiding this comment

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

s/you can't/it becomes hard to/
s/ anymore//


As mentioned earlier, `SystemData` is implemented for tuples of up to 26 elements. Should you ever need
more, you could even nest these tuples. However, at some point you can't keep track of all the elements anymore.
That's why you can also create your own `SystemData` bundle using a struct:
Copy link
Member

Choose a reason for hiding this comment

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

Btw what happens if you try to derive it for enum? I realised you could try to do this after reading this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Doesn't work, which variant should it select?

Copy link
Member

Choose a reason for hiding this comment

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

Guessed as much :D

@torkleyy
Copy link
Member Author

r? @WaDelma

@torkleyy torkleyy requested a review from WaDelma May 14, 2018 19:55
systems contain all the logic of your application. A system typically iterates over all entities that fulfill specific constraints,
like "has both a force and a mass". Based on this data a system will execute code, e.g. produce a velocity out of the force and the mass.
This is the additional advantage I wanted to point out with the `Player` / `Npc` example; in an ECS, you can simply add new attributes
to entities and that's also how you define your behaviour (this is called [data-driven] programming).
Copy link
Member

Choose a reason for hiding this comment

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

I was changing the your here, because for me it sounds like you are talking about coders behaviour, but it's fine.

@torkleyy
Copy link
Member Author

Ah missed that, thanks!

bors r=Xaeroxe,WaDelma

bors bot added a commit that referenced this pull request May 14, 2018
412: Improve book, add diagrams r=Xaeroxe,WaDelma a=torkleyy

Fixes #327

[Rendered](https://torkleyy.github.io/specs/)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/slide-rs/specs/412)
<!-- Reviewable:end -->


Co-authored-by: torkleyy <torkleyy@gmail.com>
@bors
Copy link
Contributor

bors bot commented May 14, 2018

Build succeeded

@bors bors bot merged commit 4fd4164 into amethyst:master May 14, 2018
@torkleyy torkleyy deleted the book branch May 15, 2018 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorporate diagrams on my computer into the book
4 participants