Cities Skylines 2 ships a full React SPA for its in-game HUD
Description
Image is a dark-mode screenshot of a tweet from the verified account “vjeux” (@Vjeux). The tweet reads: “City Skylines 2 is using React for all their in-game UIs!” followed by the link “blog.paavo.me/cities-skyline…”. Beneath the tweet is a cropped excerpt of the linked blog post; the excerpt says: “not ready for production as C:S2 uses HTML, CSS and JavaScript based Coherent Gameface (what a name!) for its user interfaces. A brief glance at the JS bundle reveals that they are using React and bundling using Webpack. While this is something”. The phrase “that they are using React” is highlighted in blue with the iOS copy/selection handles. Visually, the background is Twitter’s black, text is white or blue for links, and the blog excerpt appears in a white rounded rectangle. Technically, the meme spotlights the growing trend of shipping large-scale game UIs as web front-ends, complete with React, Webpack, and all the build-tool overhead experienced web engineers know so well
Comments
43Comment deleted
Some devs ship with Unity; Cities Skylines 2 apparently ships with npm install && webpack - hope your FPS budget includes node_modules
Nothing says 'optimized game performance' quite like shipping an entire browser engine to render your city management UI - but hey, at least the modders already know React!
Using React for a city-building game's UI is the perfect metaphor: both involve managing complex state trees, dealing with performance bottlenecks when rendering thousands of entities, and inevitably discovering that your carefully planned architecture needs a complete refactor when the user decides to build a highway interchange in the middle of your component hierarchy
React for in-game UIs? Hope the traffic sim doesn't trigger a full re-render on every zoning change
AAA games using React means the hardest optimization isn’t pathfinding - it’s convincing webpack’s splitChunks that the bulldozer button doesn’t need all of node_modules at 60 FPS
When your frame budget is 16ms and reconciliation wants 20, the city’s tax panel suddenly needs useMemo more than the pathfinder needs Dijkstra
That's blasphemy Comment deleted
Point and click game using point and click UI framework 🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯 Comment deleted
local dev doesn't get joke, proceeds to make fun of it Comment deleted
I'm making fun of the whole drama Comment deleted
ok? make fun of the game instead Comment deleted
Someone did a perf analysis but I haven't finished reading it yet https://blog.paavo.me/cities-skylines-2-performance/ Comment deleted
I don't need a perf analysis to know bundling a browser to make a UI in unity isn't the best technical decision Comment deleted
its pretty nice. TLDR: just to much geometry (they have no to little LODs) Comment deleted
Thank you Comment deleted
multiplied by little to no culling (so most of that geometry is being rendered) Comment deleted
React turns a simple click into a multi-step quest. Comment deleted
React like PHP - it's useful primarily for PERSONAL home pages. Comment deleted
Lookup hhvm Comment deleted
Did anybody actually read the rest of the article? UI is not the bottleneck https://blog.paavo.me/cities-skylines-2-performance/ Comment deleted
bundling a browser will suck primarily for storage space, not ingame performance Comment deleted
also RAM usage, possibly, depending on how they do it Comment deleted
From what I get, react compiles into older versions of JS, so it is hard to tell judging by react. Glance at CSS code however can easily show minimal version of their browser Comment deleted
But anyway, it is a part of it Comment deleted
It is not a part of 90% GPU load as was mentioned by OP. React is a CPU intensive framework. Actually drawing the DOM (the only part with GPU interaction) is very fast Comment deleted
You may need to upgrade your PC 🤓 Comment deleted
I don’t know guys, but I build website for my company in pure js and it completely loaded and rendered in two seconds on 10-yo laptop… Comment deleted
2s is way too much for a simple website Comment deleted
Including loading big pictures. Comment deleted
so you have never been in our region... Comment deleted
Is it a website or a web app Comment deleted
Nah the problem wasn't React Comment deleted
The problem is they're rendering a scene in full resolution with particle simulation and whatnot that's completely hidden by the menu Comment deleted
yeah they just straight up don't have lods for models that are detailed as fuck (unnecessarily so) Comment deleted
The problem with React is that it is crap, you can't afford something like that Comment deleted
In old times, gamedevs used Adobe flash to make UI in AAA games. It's all about complexity of UI. You'll be fucking tired and have many bugs making it working in pure C++. If you adapt something which is really good in it's field, it's gonna free your time and reduce bugs Comment deleted
unity uses C# and has existing native frameworks for UI Comment deleted
There are many other engines besides unity Comment deleted
cs2 uses unity Comment deleted
Rly? I thought it was the source 2 Comment deleted
cs2 in this case being city skylines 2, not counter strike 2 Comment deleted
counter strike 2 uses source 2 ofc Comment deleted
Ah, understandable Comment deleted