Ask HN: ReactJS component library for making games?
2 points by 2pointsomone 4 years ago | 8 commentsHi HNers! Does anyone know if there is a component library for React that has all the common elements found in games? I am a web person who has built information-driven apps and sites for a long time, and am a little overwhelmed by the thought of building loops, and stages, and worlds, and ka-ching moments, etc. from scratch. Just like component libraries not only made it easy to not write repeatable code but also encapsulated industry patterns in easy-to-import components, I was wondering if there is an equivalent for building simple web games that I could use.
- proc0 4 years agoFamiliarity with React might be tempting to reuse it for games, but there are plenty of HTML5 game engines out there which will do a better job. In fact React is successful in web apps because it is basically using a game loop. For a quick example: https://www.babylonjs.com/community/
- 2pointsomone 4 years agoOh incredible. Okay, then may be I was looking at the wrong approach all along.
Are there clear HTML5 web components tied to those engines? I am thinking a confetti component, for example.
- 1123581321 4 years agoThese engines generally don’t use the DOM; instead, they render in a canvas element and provide you a framework to deliver logic and drawing instructions to each frame before it renders. That’s an entirely web-standards-compliant approach as Canvas was meant for this. There is stock code and art out there to save you time creating in-game objects for any particular engine (my personal preference is Phaser. )
- 2pointsomone 4 years agoThanks for explaining!
I will check out Phaser.
- 2pointsomone 4 years ago
- dylz 4 years agoThey are not HTML5; they are totally "internals" - the only DOM involved is a <canvas> element or some WebGL element.
- 2pointsomone 4 years agoThanks, dylz. I think I am not interested in high-performance graphics, so I am not sure I am fond of working only with the <canvas>, even with these abstracted game engines.
I might just sit for a day to write beautiful CSS and use animeJS or something like that to go back to DOM approach of doing this.
- 2pointsomone 4 years ago
- 1123581321 4 years ago
- 2pointsomone 4 years ago