i have been noted since last year, that today there is a trending topic called React, reactive, most for web development,
how can be react approaches be applied to games, or can we say that GAMES are REACTIVE BY NATURE?
i have been noted since last year, that today there is a trending topic called React, reactive, most for web development,
how can be react approaches be applied to games, or can we say that GAMES are REACTIVE BY NATURE?
I’m thinking this just refers to React, a very popular JavaScript library.
I don’t know about specific issues that arise when using this library.
It seems to me that a player “reaction” is a necessary condition for a game.
we have other libraries in java like Java Rx, spring 5 with react components, but i think this is due web development was more stateles, i think a game is reactive in nature, because all sprites for example have a reaction between them.
React is a library for building user interfaces on websites.
The core idea is to “rerender” the entire UI every time something changes instead of modifying only the element that changed.
In games that is usually done anyway. In regular intervals e.g. 60 times per second the entire screen content in a game is rerendered.
Doing the same thing on a websites used to be considered too slow, so programmers avoided it and instead only changed what needed to change.
The problem was that this complicated web design since rerendering everything is simpler and makes the code more modular and easier to maintain.
So React offered a way to solve this by making the rerender approach much faster. It achieves that by pretending to rerender everything while in reality the library determines internally which components actually need to be changed and only changes those. But that process is transparent and the programmer doesn’t have to worry about it.
So the difference between a reactive web site and most games is that the game will actually rerender everything for real while the React library only behaves as if it does so.
Now we could ask why browser manufacturers can’t simply make the rendering process of graphical elements faster. But that seems to be tricky for some reason.
I found a post on ycombinator about that question. https://news.ycombinator.com/item?id=9155564
Note that there are RxJava extensions for Swing and JavaFX. You don’t have to consider this to be about rendering at all - it’s a great way to hook events up to actions. I built a light weight reactive streams / functional reactive like API into Praxis LIVE and love working with it (mine, like the Swing / JavaFX implementations, is single-threaded, while the main RxJava / reactive streams handle concurrency for you too).
Also, the basic building blocks for concurrent reactive programming are now in the JDK - https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.html