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

[Merged by Bors] - Add missing docs to World::change_tick and World::read_change_tick #6765

Closed
wants to merge 7 commits into from

Conversation

JoJoJet
Copy link
Member

@JoJoJet JoJoJet commented Nov 26, 2022

Objective

The methods World::change_tick and World::read_change_tick lack documentation and have confusingly similar behavior.

Solution

Add documentation and clarify the distinction between the two functions.

@alice-i-cecile alice-i-cecile added C-Docs An addition or correction to our documentation A-ECS Entities, components, systems, and events labels Nov 26, 2022
@james7132 james7132 added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Nov 27, 2022
@@ -1390,11 +1390,19 @@ impl World {
self.change_tick.fetch_add(1, Ordering::AcqRel)
}

/// Reads the current change tick of this world.
Copy link
Contributor

Choose a reason for hiding this comment

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

Super basic question so I'm sorry lol, but is a change tick different than a normal tick?

I understand a tick to be a "loop" of the main update loop. But in ECS's I suppose it might not be that simple. I guess this tick is specific to the world?

Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose maybe I need some place to read up about how ticks are done in ECS's since maybe worlds and systems run at different ticks? Is there a good place to read up on that?

Copy link
Member Author

@JoJoJet JoJoJet Dec 1, 2022

Choose a reason for hiding this comment

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

Basically, a change tick is a number signifying when a system ran in relation to other systems. This is used to answer questions like "did this value change since the last time this system ran?", powering change detection.

I don't know of any write-ups on change detection internals, so I'd recommend reading these source files for more details:

https://github.com/bevyengine/bevy/blob/main/crates/bevy_ecs/src/change_detection.rs
https://github.com/bevyengine/bevy/blob/main/crates/bevy_ecs/src/component.rs#L521

I suppose the docs are in need of a centralized explanation of how change ticks work.

Copy link
Contributor

Choose a reason for hiding this comment

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

thank you so much!

Copy link
Contributor

@Carter0 Carter0 left a comment

Choose a reason for hiding this comment

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

LGTM

@cart
Copy link
Member

cart commented Dec 5, 2022

bors r+

bors bot pushed a commit that referenced this pull request Dec 5, 2022
#6765)

# Objective

The methods `World::change_tick` and `World::read_change_tick` lack documentation and have confusingly similar behavior.

## Solution

Add documentation and clarify the distinction between the two functions.
@bors bors bot changed the title Add missing docs to World::change_tick and World::read_change_tick [Merged by Bors] - Add missing docs to World::change_tick and World::read_change_tick Dec 5, 2022
@bors bors bot closed this Dec 5, 2022
@JoJoJet JoJoJet deleted the change-tick-doc branch December 5, 2022 23:50
@james7132 james7132 added this to the 0.10 milestone Dec 6, 2022
ickshonpe pushed a commit to ickshonpe/bevy that referenced this pull request Dec 6, 2022
bevyengine#6765)

# Objective

The methods `World::change_tick` and `World::read_change_tick` lack documentation and have confusingly similar behavior.

## Solution

Add documentation and clarify the distinction between the two functions.
alradish pushed a commit to alradish/bevy that referenced this pull request Jan 22, 2023
bevyengine#6765)

# Objective

The methods `World::change_tick` and `World::read_change_tick` lack documentation and have confusingly similar behavior.

## Solution

Add documentation and clarify the distinction between the two functions.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
bevyengine#6765)

# Objective

The methods `World::change_tick` and `World::read_change_tick` lack documentation and have confusingly similar behavior.

## Solution

Add documentation and clarify the distinction between the two functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Docs An addition or correction to our documentation S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants