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

Observer Pattern #5

Open
cchandel opened this issue Nov 4, 2021 · 9 comments
Open

Observer Pattern #5

cchandel opened this issue Nov 4, 2021 · 9 comments

Comments

@cchandel
Copy link

cchandel commented Nov 4, 2021

Hi,
Is there a way to use event subscription to call system functions?
Thanks

@zllangct
Copy link
Owner

zllangct commented Nov 4, 2021

I think we should change the mode of thinking, this is ECS, not OOP. this rep is a concurrency system with lock-free, all logic drived by "frame", ecs benifit from the the independent "system", your system can call diffrent function by changing component field, a system shoud not communicate with others directly. you can add a new single-use component with some data what you want to send to the system when you want to publish an event.

@cchandel
Copy link
Author

cchandel commented Nov 4, 2021

Ok,
That makes sense.

Could you provide example of how both options would work?

Thanks.

@zllangct
Copy link
Owner

zllangct commented Nov 4, 2021

Good idea, I'm planning to do it, the way to program is very different from what we used before, we need more examples

@cchandel
Copy link
Author

cchandel commented Nov 4, 2021

For Eg,
Lets say the game has the ability to change its speed - which means at speed 2 every thing becomes 2 times as fast, actor movement, game time etc.

How would this be handled in your view?

@zllangct
Copy link
Owner

zllangct commented Nov 4, 2021

I see, you want to modify system by event,such as the time-scale of system and other system field, i think u r right, it's very useful. I will add this capability in future.
Thanks.

@cchandel
Copy link
Author

cchandel commented Nov 8, 2021

Hi,
Thank you for the fake_game example and for adding events to the ECS system.
Regards

@zllangct
Copy link
Owner

zllangct commented Nov 8, 2021

Hi, this rep's apis are unstable, will be optimized or changed continuously before release version, Thanks for your proposal.

@zllangct
Copy link
Owner

zllangct commented Nov 8, 2021

fake_game_server example is incomplete, more usages will be added to this example.

@cchandel
Copy link
Author

cchandel commented Nov 8, 2021

Sure. Understood.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants