Hacker News new | ask | show | jobs
by lingoberry 4227 days ago
I'm late to the party, but I want to share an insight I've had regarding game development and UI applications. It baffled me for a long time why building UIs were such a pain, and doubly so in a web app. Why could I, and others, create such seemingly advanced graphics and interactions in a video game, but try to make a UI and you're stuck with thousands of difficult to discover bugs. After I started using react, I realised games are "easy" for the same reason react is a huge productivity multiplier: you re-render the game every single frame. You have the data that represents your game state, there's a game loop, and you render every single little damn thing, every damn frame. It's a one-way flow of information from your explicit state to the presentation layer. React works the same way, only it re-renders only if the state changed. That's it. Super simple, but it's a mind shift.
3 comments

Also you can use a different exotic approach in every game - it's completely open!

In the modern closed web you unfortunately have to deal with legacy tech like HTML, JS, CSS which will never ever go away "because compatibility".

Lucky you, in the old days we couldn't always re-render whole scene :(
Bingo!