
React Game Kit - clessg
https://github.com/FormidableLabs/react-game-kit
======
SomeCallMeTim
I've been making games for ~30 years, and I'm always curious about how people
like to apply functional concepts to game development...and yet, when I look
at this, I think "Why?"

As far as I can tell, it just starts out with a React tree and then says "put
the game in the middle part." Meaning that how you write the game is almost
orthogonal to any of React's key concepts like one directional data flow.
Except that things like collisions seem to be handled at the global level,
meaning that you have to filter them back down to the individual objects
involved -- which is strictly worse than letting objects respond to their own
collisions, and encourages the creation of "god objects" at the top level that
are completely opaque.

There are far more capable game engines out there, ones that give you sprites,
canvas or WebGL rendering, and far more sophisticated control of game objects.

Basically all game engines work in a "display the current state" manner
(except for old school "put your draw function here" engines like Love2d), and
many have built in physics abstractions as well. Can't see any reason to use
React for something it's clearly not well matched to.

~~~
sugarraps
I understand you. But you're taking this way too seriously. People don't do
things hoping it becomes the next Unity. Sometimes they do it because they
can. To have fun. To experiment. And Ken Wheeler is definitely that kind of
person.

In any case, these explorations are important. They are small experiments
showing us new ideas.

Look at this: [http://reactnext.surge.sh/](http://reactnext.surge.sh/)

That _is_ React. _mind blown_

I won't be making a game with it anytime soon. But maybe I'll borrow concepts
and ideas from it, and make something else.

So don't worry. Don't let it puzzle you. Just sit back, relax, and stay tuned
for what's next.

~~~
JakDrako
Mind not blown. It looks to me like an old PC-XT CGA game. If you want to
experiment with making games on the web, you're much better off, I think,
using something like [http://www.pixijs.com/](http://www.pixijs.com/) Just the
landing page is way more mind blowing than that React "game" demo.

~~~
zdkl
Holy wow. Thank you for the link!

------
andreasklinger
This is mind-twisting in it's own way.

The core idea of react is (simplified) that "time is eliminated"* as mental
concept to keep track of.

So in a way this is game programming without the concept of time.

( * Essentially you focus on state and could thus create/display any component
in any state )

~~~
SomeCallMeTim
> So in a way this is game programming without the concept of time.

A. You can't have a real time game without the concept of time. If you're
making a turn based game, time is ignored equally in a traditional game
engine.

B. _Most_ game engines that have a built-in physics engine abstract away time
to the exact same degree that React Game Kit does. Everything is about
responding to collision events, applying forces, spawning animations, etc.

~~~
andreasklinger
I am not saying it's not possible. I meant it's interesting to think about it
as concept.

~~~
SomeCallMeTim
OK, but my point is that it's also a concept in _most_ game engines.

------
tleunen
For more 2d/3d stuff using JSX, you can also take a look at react-pixi and
react-three. Not up to date with their parent lib tho :/

\- [https://github.com/Izzimach/react-pixi](https://github.com/Izzimach/react-
pixi) \- [https://github.com/Izzimach/react-
three](https://github.com/Izzimach/react-three)

~~~
doublerebel
Pixi is a very efficient, effective framework. I've used other controller
patterns with it so I imagine React is not a bad fit.

------
endergen
I have a game development background. Did 8 years of C/C++ games for
PCs/Consoles. I then switched to web/server development. I've thought of doing
something similar as I'm super into React/Redux, but....

Redux can be used without react, just rendering your game graphics all the
time is fine, a moving game basically causes that to happen anyway. I think
taking something like Pixi.js and using redux for your app state container
would give you all the hot code reloading you need.

I'd maybe vote for using React for your settings/menus and such, but then
again Pixi.js is going to give you much richer, and faster rendering APIs.

------
adriancooney
I've often thought React would be perfect for creating games with. Even
attempted my own framework similar to this using the canvas but it fell down
when it came to rendering. I felt like React really didn't suit the
update/render loop approach. It doesn't seem to talk about it on the project
page so I wonder how this works. Using the DOM?

~~~
talldan
I had a quick look into the code base, and it is indeed targeting the DOM,
rather than canvas or webgl. It has a sprite component which is just an
absolutely position img element wrapped in a div.

------
blaisio
This is cool. I feel like it's more interesting and practical to apply Redux
to game development instead of React though. Redux's "Time Travel" idea is
really neat - I want to see something _like_ React that acts as a view layer
and uses Redux to model game state.

~~~
talldan
I've been playing around with some ideas like this. It's hard, as most
graphics APIs usually have their own concept of bindings and state to
maintain. As an example you create a binding to a vertex buffer, and then you
need to maintain that over multiple draw calls. It's maybe similar to React
maintaining DOM nodes, but the data involved is a lot more complex. I feel
like a lot of the work is building abstractions (or the right models) to be
able to handle those aspects of graphics programming in a functional and
reactive way.

------
CoryG89
Anyone know if there is a live demo anywhere already? I guess I'll have to
clone/host it myself?

~~~
thekenwheeler
[http://reactnext.surge.sh](http://reactnext.surge.sh)

~~~
SomeCallMeTim
Does anything happen _other_ than a black screen when you walk into a
building? I get some music if I wait long enough, but otherwise nothing.

~~~
prophesi
I had a black screen when I first walked into a building. After refreshing,
they all started working after I entered the Physics building. They just show
a slideshow, then send you back out into the street.

------
Fifer82
This would be OK for "Powerpoint" games. If it is real time, forget about it.
Even real time WebGL kind of sucks on most devices, triggering DOM manipations
and repaints isn't going to help.

~~~
vonmoltke
What are you calling a "'Powerpoint' game"? To me that implies some level of
simplicity, but I play plenty of complex games that could be implemented with
this. Not that they _should_ be, mind you...

------
bcherny
React is the really the ideal rendering engine (though much less optimized
than something like Unity). An immediate mode API abstracting over a retained
mode renderer lets you think about a program as a state machine, while not
sacrificing performance.

It's also a powerful metaphor for charting -
[https://github.com/recharts/recharts](https://github.com/recharts/recharts).

~~~
seanwilson
> React is the really the ideal rendering engine

Compared to what?

~~~
ravenstine
He's comparing it to Unity, which makes no sense to me at all. If there was a
statement more like comparing apples to oranges, I haven't heard of it yet.

