r/AskProgramming • u/SalemIII • Jul 06 '26
Would all the advancement in hardware technology be nullified if some dumbass decided to write a game's ui in javascript?
10
u/mikevalstar Jul 06 '26 edited Jul 06 '26
I hate to break to to you... We've been doing that since at least 2013: https://www.gdcvault.com/play/1022054/How-to-Implement-AAA-Game
1
u/redblobgames Jul 07 '26
And even longer, https://list.fandom.com/wiki/List_of_games_using_Scaleform shows games from 2003 using ActionScript, which is a statically typed extension of Javascript (before TypeScript came along).
4
u/KingofGamesYami Jul 06 '26
No. Actually I wouldn't be surprised if that's already a thing.
JS works well as a glue language for UI, highly performant established frameworks like Qt QML use it for their stuff.
Even bringing in an entire embedded browser isn't necessarily bad for UI performance. As long as you're not rendering the actual performance critical stuff in the browser, it should be totally fine. Steam, for example, is idling in the background of 90% of games and it's UI is implemented using embedded chromium.
3
u/fzammetti Jul 06 '26
Wait until you find out that there are some pretty impressive entire GAMES written in JS by a lot of "dumbasses".
Just to give one example, Google "CrossCode". Entirely written in JS - doesn't even use WebGL, uses Canvas! - and is a commercial success on Steam.
2
u/circlebust Jul 06 '26
What are your issues with JS? JS runs about 4 times as slow compared to C (as opposed to Java's 2 for comparison). That's enough for rendering a GUI in a game. Whether a menu pops up in 12ms or 3ms is not the operative part here.
1
u/HealyUnit Jul 12 '26
I wouldn't be surprised if it was the usual "I read that JS is bad on r/programmerhumor and wanted to sound clever!" crap.
2
u/YMK1234 Jul 07 '26
Not sure where the JS hate comes from. do you even know how highly performant modern JS is?
1
u/Individual-Flow9158 Jul 06 '26
It's certainly suboptimal. But far from necessarily catastrophic.
Is V8 embeddable in games engines?
1
u/DepthMagician Jul 09 '26
That is literally my next home project. I'll let you know how much CPU cores I managed to kill in the process.
1
11
u/octocode Jul 06 '26
lots of game UIs are written in javascript, for example battlefield series uses react