TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How do I build a browser game?

16 pointsby BookPageover 5 years ago
I want to tinker on a dungeon crawler and want to know what the best way to do this in a browser is. I&#x27;m a backend engineer so am kind of hoping that it doesn&#x27;t _have_ to be some sort of Javascript.<p>Ideally: - Support rendering 2&#x2F;3d game - Network access for realtime multiplayer<p>Thanks!

6 comments

LeftHandPathover 5 years ago
You should look into “A Curious Expedition”, which is a commercially successful Steam game based on web tech [0].<p>You will most likely have to use JavaScript, on the front end. You can do a lot of neat graphical tricks these days - whether with Canvas, SVG’s, or above-my-pay-grade wizardry.<p>What kind of back end engineer are you? Just curious since it sounds like you don’t have a plan for multiplayer networking yet. Knowing what your skills are would help determine what advice you need.<p>Edit: additionally, if you want to have a better time writing JavaScript, you can use Gulp [1] and BabelJS [2] to compile ES6 into backwards-compatible JS. Gulp is also helpful for streamlining other painful parts of web development - worth reading through the docs.<p>Regarding multiplayer, it depends on how you plan to network. I am not sure how people implement P2P networks these days. However, you could probably use TCP&#x2F;IP sockets (AF_INET) to take data from the client side and send it to a central process (you will need asynchronous IO and you will probably want to connect to the socket using JavaScript &#x2F; web sockets). You could use a sock file (AF_UNIX) to move data between different languages&#x2F;scripts if you want to, as well.<p>There is a very good intro to multiplayer networking here: <a href="https:&#x2F;&#x2F;gafferongames.com&#x2F;post&#x2F;what_every_programmer_needs_to_know_about_game_networking&#x2F;" rel="nofollow">https:&#x2F;&#x2F;gafferongames.com&#x2F;post&#x2F;what_every_programmer_needs_t...</a><p>[0]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=17080985" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=17080985</a><p>[1]: <a href="https:&#x2F;&#x2F;gulpjs.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;gulpjs.com&#x2F;</a><p>[2]: <a href="https:&#x2F;&#x2F;github.com&#x2F;babel&#x2F;gulp-babel&#x2F;blob&#x2F;master&#x2F;README.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;babel&#x2F;gulp-babel&#x2F;blob&#x2F;master&#x2F;README.md</a>
评论 #21926040 未加载
krappover 5 years ago
Most modern game engines will export to the web as javascript&#x2F;WASM (at least I know Godot and Unity will.) Construct2 is specifically intended for exporting to the web. You can just treat &quot;the browser&quot; as another build target like Windows, Linux or Android at this point, don&#x27;t worry about it.
Aperockyover 5 years ago
Use typescript and Pixi. Pretty easy to get started imo, I’m also a backend engineer, here’s my progress after one day: <a href="http:&#x2F;&#x2F;aperocky.com&#x2F;prehistoric" rel="nofollow">http:&#x2F;&#x2F;aperocky.com&#x2F;prehistoric</a> Still a long way to go but it’s quite a fast learning curve.
wowwhoknewover 5 years ago
One section of this tutorial is 3.5 hours on how to make a basic clone of agar.io<p><a href="https:&#x2F;&#x2F;www.udemy.com&#x2F;course&#x2F;socketio-with-websockets-the-details&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.udemy.com&#x2F;course&#x2F;socketio-with-websockets-the-de...</a><p>I&#x27;d suggest checking out similar types of tutorials -- clones of popular browser games, to see how different ones are built, and how to approach the various aspects of creating one.
dorkinspaceover 5 years ago
If you haven&#x27;t yet, I would look into Unity. You can write scripts in C# and it comes with a ton of functionality out of the box. Unity can output webgl and if you release the game and it is successful, it is generally quite easy to release mobile versions without much work.<p>I&#x27;ve been working with Unity for years, feel free to ask any questions you have!
topmonkover 5 years ago
A lot of languages compile to javascript, including haskell, but I&#x27;d suggest just bite the bullet, and use js directly. You&#x27;ll save a lot of time and bang your head against a lot less obscure issues.<p>You can use webgl for 3d graphics, and there are lots of examples on the web.