Skip to content

Conversation

JaySpruce
Copy link
Member

@JaySpruce JaySpruce commented Oct 16, 2025

Objective

While tinkering with change detection, I've collected some nitpicks:

  • The word "ticks" is kind of overloaded; ticks are used by components, systems, and the world, but "ticks" is often used to refer to the "added + changed" pair of ticks that only components have (and resources, but they're close enough to components).
  • Ticks is a nice name for a struct, but it's taken by a pub(crate) struct that's pretty niche. (I don't have any plans for the Ticks name, but it could be useful for something.)
  • Every use of Ticks, TicksMut, and TickCells is accompanied by a MaybeLocation that represents the calling location that last modified the component, so it should just be part of the structs.
  • NonSend seems to be in the wrong file, and doesn't implement methods with the macros that every other change-detecting query parameter uses.

Solution

Renamed the following structs:

  • Ticks -> RefComponentTicks
  • TicksMut -> MutComponentTicks
  • TickCells -> ComponentTickCells

Added a changed_by: MaybeLocation field to RefComponentTicks, MutComponentTicks, and ComponentTickCells and folded in the loose MaybeLocations.

Moved NonSend from system/system_param.rs to change_detection.rs and updated its implementation to match similar query parameters.

Removed ComponentTickCells::read because it is now unused (and not public).

@JaySpruce JaySpruce added A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 16, 2025
Copy link
Contributor

@chescock chescock left a comment

Choose a reason for hiding this comment

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

These are nice improvements! I especially like that you folded in the changed_by: MaybeLocation; it seems like whenever we want to know "when" we'll also want to know "where", and keeping them together will make it harder to miss one if we use them elsewhere in the future. (Hmm, and it's also more obvious now that there's no added_by. I wonder if we'll want that someday.)

  • Ticks -> RefComponentTicks
  • TicksMut -> MutComponentTicks
  • TickCells -> ComponentTickCells

It feels odd that Ref and Mut are prefixes, but Cells is a suffix. I guess CellComponentTicks wouldn't be right, though. Maybe ComponentRefTicks/ComponentMutTicks/ComponentCellTicks?

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.

I'm fine with this, but this needs a migration guide since we're changing pub types.

@alice-i-cecile alice-i-cecile added the M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide label Oct 16, 2025
Copy link
Contributor

It looks like your PR is a breaking change, but you didn't provide a migration guide.

Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes.

@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 16, 2025
@JaySpruce JaySpruce added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Oct 16, 2025
@JaySpruce
Copy link
Member Author

It feels odd that Ref and Mut are prefixes, but Cells is a suffix.

My goal was to make RefComponentTicks and MutComponentTicks sound less important, which I think the prefixes do. Ticks and TicksMut confused me at first because they sounded more important than they really are.

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-Code-Quality A section of code that is hard to understand or change M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants