openage icon indicating copy to clipboard operation
openage copied to clipboard

Standardize control flow between engine subsystems

Open heinezen opened this issue 2 years ago • 3 comments

We could improve the way individual subsystems in the engine (presenter, renderer, gamestate, networking, ...) talk to each other by using a standardized method for all communications. For this to work, we would need to define how data should be sent, fetched or manipulated during transfer and find a flexible solution that is reusable for all subsystems.

The main benefit of this would be less maintanance (since we don't need to figure out a new solution for every subsystems) and better code readability. It should also improve thread safety as the subsystems usually run in their own threads and communication between them form a critical path. We also want to minimize interdependencies between subsystems as much as possible.

https://github.com/SFTtech/openage/pull/1492 and https://github.com/SFTtech/openage/pull/1497 already address parts of this issue by handling communication in dedicated objects and using a one-way control flow.

We can use other implementations as a reference, e.g. https://developer.android.com/kotlin/flow

heinezen avatar Mar 09 '23 17:03 heinezen

socketio can be use to comunicate, I know him with python (here) and in python It's pretty easy to use so the part modding would be also easy to create custom network event.

coco875 avatar Aug 09 '23 11:08 coco875

@coco875 This issue is not really about external communication with the Python API and more about the internal C++ subsystems of the engine.

heinezen avatar Aug 09 '23 12:08 heinezen

oh ok

coco875 avatar Aug 09 '23 13:08 coco875