I'm learning React.
I'd like to create a game with a basic tile-board (like here / but where tiles can have two states ('available' or 'already clicked').
In terms of speed, React looks interesting as with its virtual DOM/diffs, I could only adjust the css and text inside tiles that have been clicked (so that they visually differ form those still not clicked by anyone).
My goal (and personal challenge haha) is to make this game playable by 1000 simultaneous players who can click where they want on a 100,000-tiles board.(distribution among clients in real time of tile status would be done with Firebase)
Should I use basic standard React and its built-in features (onclick events,ts listeners...) or is it impossible with only-React to enable that many events/listeners for 1000 people on 100K tiles in real time with any user being able to click anywhere (on available tiles) ?
Should I use alternative/plentary tools and techniques such as canvas, React Art, GPU acceleration, webgl, texture atlases....?
I'm learning React.
I'd like to create a game with a basic tile-board (like here http://richard.to/projects/beersweeper/ but where tiles can have two states ('available' or 'already clicked').
In terms of speed, React looks interesting as with its virtual DOM/diffs, I could only adjust the css and text inside tiles that have been clicked (so that they visually differ form those still not clicked by anyone).
My goal (and personal challenge haha) is to make this game playable by 1000 simultaneous players who can click where they want on a 100,000-tiles board.(distribution among clients in real time of tile status would be done with Firebase)
Should I use basic standard React and its built-in features (onclick events,ts listeners...) or is it impossible with only-React to enable that many events/listeners for 1000 people on 100K tiles in real time with any user being able to click anywhere (on available tiles) ?
Should I use alternative/plentary tools and techniques such as canvas, React Art, GPU acceleration, webgl, texture atlases....?
WebGL is the right answer. It's also quite plicated to work with.
But depending on the size of the tiles, React could work but you can't render 100k dom nodes performantly... no matter how you do it. Instead, you need to render the subset of tiles visible to the user.
To pull something like this off, you'll need to have a lot of optimized code, and firebase most likely won't be up to par. I'd remend a binary protocol over websockets and a database that makes sense (fast lookups on multiple numeric index ranges, and subscriptions).
Ultimately, I'd probably go with:
The only reason for golang over node.js for the websocket server is CPU performance, which means lower latency and more clients per server. They perform about the same for the network aspect.
You'll probably ignore most of this, but just understand that if you do have performance problems, switching some of the parts out for these will help.
Do a prototype that handles 2 concurrent users and 1000 tiles, and go from there. In order of priority:
Lots of people use React as the V in MVC.
I believe that react
is fine for UI
but you should ask yourself what will be the server side logic, you still have to think about M
and C
If you are looking for 1000 simultaneous users load, the keyword scalable
will be your friend.
Also you should check out Node.js
for the server side service. Express.js
for it's fast implementation, and finally Pomelo.js
which is a js
game server implementation, based on node.js
On the subject of performance.. WebGL
will most likely boost your performance. Here you can grab a nice tutorial on the topic : https://github./alexmackey/IntroToWebGLWithThreeJS
If you want to build it without GL
languages whatsoever, you should digg deeper into JavaScript
create your own pseudo-class
library with dynamic data bindings
. Otherwise you might end up using small percentage of a powerful framework that will only slow down your API
.
I would restrain from using
canvas
, as they are good formodel
visualization rather as gamefront-end
. Checkoutd3.js
for it's awesomeness and unfortunately performance issues.
Here I have written a nice fiddle, that creates 100x100 matrix with hovers, and perfromance is not so good. You can easly tweak it to get 100k element matrix: https://jsfiddle/urahara/zL0fxyn3/2/
EDIT:
WebGL
is the only reasonable solution.