Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[v2] Create slick.world.frame method to update entire world. #14

Open
erinmaus opened this issue Jan 8, 2025 · 1 comment
Open

[v2] Create slick.world.frame method to update entire world. #14

erinmaus opened this issue Jan 8, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@erinmaus
Copy link
Owner

erinmaus commented Jan 8, 2025

  • Allow setting a velocity on entities and updating the entire world at once with a slick.world.frame method that takes a deltaTime. All entities will be simulated, given their velocity and the elapsed time, to prevent any potentially tunneling caused by one-by-one updates. Currently, update, etc treat all other entities besides the one being updated as being stationary.
  • Add local collision filters and local collision response handlers to slick.entity:
    • The collision filters will be used during slick.world.frame to see what objects interact with this one. They can return visit functions as well like the current collision filter functions.
    • The local collision response handlers, if set, will be used in place of the global collision response handlers. The default behavior will be to use the global collision response handler.
  • Add events like startContact, stopContact, move and potentially others to slick.entity. A function provided to this event will be called when the entity starts or stops touching another entity or shape, for example.

To keep it generic, all methods that take a function can take a table with a __call metamethod. And to keep it simple, only one function can be registered at a time to an event, collision filter, collision response handler, or other things that use functions provided externally. More advanced behavior will require use of pub-sub libraries or such!

@erinmaus erinmaus added the enhancement New feature or request label Jan 8, 2025
@Nrosa01
Copy link
Contributor

Nrosa01 commented Mar 5, 2025

I'm interested on this feature but I have some concerns. How will this play with the manual movement? Does velocity resets to 0 when using world:move? This library is supposed to be a collision library, maybe instead of calling it velocity we can call it queuing the next desired position, then update the world to update all entities that has queued desired positions, world:move would be the same but only setting it for one entity. This way both methods would work under the same bae and it will be easier to implement. I'm not sure if you have something else planned but I hope these questions help to plan it better. I can't do it now but maybe next month I can peek and test how to implement this naively

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants