Live data from Hacker News

Show HN: Airmash – Multiplayer Missile Warfare HTML5 Game

airma.sh

81–90 of 316 posts

Re: Show HN: Airmash – Multiplayer Missile Warfare HTML5 Game

#81

Earlier quoted context omitted.

Just plain ol' Websockets. But with a twist. I use 2 WS connections mirroring some packets on both, to deal with head-of-line blocking.

Interesting. Could you talk more about this?

(Not OP but I had the same idea)

When a packet is lost in a TCP stream, it must be retransmitted, and until the client receives it, all further packets are stuck in limbo (received by the client, but cannot be seen). For this reason, most games use UDP instead, and are designed so some packet loss is acceptable (if I received where you are at frame N, it no longer matters if I receive where you were at frame N-1).

Minecraft uses TCP, that's why in very populated servers occasionally you can see the whole world freeze for a second.

In the browser we have UDP with WebRTC data, the problem is that not all browsers support it, it may not work in some places and for now it's more difficult to work with.

An easy compromise is to use several TCP connections, so if one packet is lost, instead of having N packets stuck for a moment, you have 1/N where N is the number of connections. And if important packets are sent through all channels, the chance that they arrive too late is much lower.

Re: Show HN: Airmash – Multiplayer Missile Warfare HTML5 Game

#82
post #81

Earlier quoted context omitted.

Interesting. Could you talk more about this?

(Not OP but I had the same idea) When a packet is lost in a TCP stream, it must be retransmitted, and until the client receives it, all further packets are stuck in limbo (received by the client, but cannot be seen). For this reason, most games use UDP instead, and are designed so some packet loss is acceptable (if I received where you are at frame N, it no longer matters if I receive where you were at frame N-1). Mi…

Do both websocket connections send the same data, or do you split your data logically between two channels (movement data vs state data)

Re: Show HN: Airmash – Multiplayer Missile Warfare HTML5 Game

#83

I opened this game in an incognito tab. And started dev tools. The entire game is only 2.8 MB. It loads fast. Such graphics, much small. A lesson for modern web developers about website obesity and performance.

I mean this is nice but it's really not a lesson for web developers. The fact that this is 2.8mb doesn't really teach a web developer any lessons, unless you think that large website payloads exist because developers are literally too lazy or don't know how asset optimization works.

Instead, having worked in web development, I know that website payload size is often driven by having to include vendored javascript for business reasons (analytics and social are big culprits) or because your boss doesn't give you the time to focus on performance because for the business, it is good enough and they want to use their limited web development resources to do something other than shrinking javascript payloads.

Another thing, you're impressed by the graphics and how the developer was able to include them while keeping the payload small. It seems to be made using vectors and particle effects. Both of these techniques are not heavy in terms of payload. Shaders and particle effects are generally very small amounts of code. Think about how this is different for a website that heavily relies on all sorts of user-generated content: jpgs, mp4, gif, png, etc. Much larger assets than a few shaders and svg.

Re: Show HN: Airmash – Multiplayer Missile Warfare HTML5 Game

#84
post #79

Earlier quoted context omitted.

Nothing too fancy. Just proper devops and a lot of testing. https://i.imgur.com/oSwGgFA.png

Where are you hosting it? That looks quite custom to gaming

It better be! It's my homegrown panel that I use for all my projects.

Re: Show HN: Airmash – Multiplayer Missile Warfare HTML5 Game

#86
post #23

What does it use for networking?

Very curious about this as well. I was expecting this submission to be an endorsement for WebRTC.

WebRTC really isn't suitable for multiplayer gaming due to it being entirely P2P. You need the server to operate as a single source of truth and enforce clients to play by the rules.

Re: Show HN: Airmash – Multiplayer Missile Warfare HTML5 Game

#88
post #82
post #81

Earlier quoted context omitted.

(Not OP but I had the same idea) When a packet is lost in a TCP stream, it must be retransmitted, and until the client receives it, all further packets are stuck in limbo (received by the client, but cannot be seen). For this reason, most games use UDP instead, and are designed so some packet loss is acceptable (if I received where you are at frame N, it no longer matters if I receive where you were at frame N-1). Mi…

Do both websocket connections send the same data, or do you split your data logically between two channels (movement data vs state data)

I interleave information that becomes redundant (like the position of players, I can handle losing every other packet for a while, interpolating/predicting missing info) but send important data in all channels (like when a rocket is fired, it's just one event that must be seen).

Again, I'm not OP but I did similar things and explained what probably happens with this game.

Post reply on HN