Rxjava: Is RxJava fast enough to use in game development?

Created on 3 Nov 2016  路  2Comments  路  Source: ReactiveX/RxJava

Ain't sure my question is brand new one, but I didn't find any example (except one, pretty old and not finished) in the internet. I know that RxJava is very comfortable, but is it good, fast for game creation? Some delayed tasks, processing inputs, game loop and rendering, when you need performance?

Question

Most helpful comment

It depends on what type of game and what type of tasks you intend to do with RxJava. Processing and dispatching user input is a good candidate for RxJava but note that RxJava adds some overhead (sometimes in the nanoseconds, sometimes in the microseconds range) and otherwise was designed for throughput and not latency. If you have to jump between threads, like the rendering thread, AI thread, networking thread, RxJava is more convenient and let's you focus on the actual problem instread of the concurrency problems. For example, a interval fires every 16ms that copies a game state on the GUI thread and then forks out N threads for the AI to make decisions which then emit a set of instructions to update the game state back on the GUI thread.

All 2 comments

It depends on what type of game and what type of tasks you intend to do with RxJava. Processing and dispatching user input is a good candidate for RxJava but note that RxJava adds some overhead (sometimes in the nanoseconds, sometimes in the microseconds range) and otherwise was designed for throughput and not latency. If you have to jump between threads, like the rendering thread, AI thread, networking thread, RxJava is more convenient and let's you focus on the actual problem instread of the concurrency problems. For example, a interval fires every 16ms that copies a game state on the GUI thread and then forks out N threads for the AI to make decisions which then emit a set of instructions to update the game state back on the GUI thread.

Thanks for the answer! Perfect to me! 馃憤

Was this page helpful?
0 / 5 - 0 ratings