Readit News logoReadit News
Posted by u/altanis a year ago
Show HN: An online 2D MMO game, written in Rust and JavaScriptpolyfight.io/...
I made a game (https://polyfight.io/) which revolves around a player (a tank) leveling up and upgrading by killing shapes and other tanks (partially inspired by https://diep.io). It has a bunch of features, a vast number of tanks, an inbuilt chatting system, clans to make teams with your friends, a colour scheme maker, controllable sandboxes which can be public or private, a last man standing gamemode, and an inbuilt 1v1 system with its own ELO rankings and a global leaderboard. The game has a few players right now, and I'd hope to spread the joy players have with this game to people here, as well as any critiques people have about the game. Exploits/gray hat hacking is warmly welcomed, as I strive to make sure my game is secure and hard to script/bot in.
jaaron · a year ago
Looks impressive. Like some others, I'm getting the bug that says "You are already connected" when I try to play.

That said, this is still good work, especially considering your experience and age (I checked out your 2D physics library on github and I found the trailer on youtube).

One suggestion: As someone in the game industry, I personally wouldn't label it an MMO as it doesn't include many of the features, particularly the "massive" part of MMO, that is usually associated with that term. The work is already impressive enough, you don't need to give it a label that could open it to criticism.

Otherwise, this is solid work. If you're aiming for a career in the game industry eventually, it's a good foundation to build on.

altanis · a year ago
Hey, thanks! You're right, I should've probably labeled it as a multi-player game, not an MMO. The connection issue you faced was because of a (probably) faulty clientside fingerprint implementation I made; your fingerprint probably collided with others. I'll rework it in a few hours.
10000truths · a year ago
I suggest you use the WebTransport datagram API for your netcode, now that it's supported by the latest version of all major browsers (except Safari). WebSockets suffer from the typical head-of-line blocking issues inherent to TCP, which makes it a suboptimal fit for latency sensitive applications like multiplayer games, where you only care about the most recent state.
modeless · a year ago
I wouldn't suggest WebTransport unless/until Safari gets support. Instead you can use WebRTC DataChannel today for UDP in all browsers. Also, WebTransport doesn't support direct P2P connections but WebRTC does.

I have ported Quake III to use DataChannel and it works great (once all the WebRTC boilerplate is in place). You can test it here: https://thelongestyard.link/ Once you click the multiplayer link you will get a URL with your server name, which others can visit to join your server instantly.

tillcarlos · a year ago
Most underrated comment, and what a blast from the past.

Back then Quake 3 would require 3d accelerators and now we can play it in the browser... and some person on HN just casually "ported it". Awesome!

What's the technology there? Do you run it on WASM?

altanis · a year ago
WebRTC is complicated; there are many more edge cases compared to websockets. Off the top of my head, I know I'd need to run a TURN server for people behind symmetrical NAT or CGNAT networks, which would be a pain. WebSockets are much more accessible for everyone. In the future I'll investigate UDP protocols, but its likely I'll always use TCP for web games.
tracker1 · a year ago
Damn, very nice indeed... Of course I got pwned before I could even get my hands on the right keys. Q3A and Quake TF mod are definitely happy memories.
iAmAPencilYo · a year ago
That is absolutely fantastic. Instant mayhem! Thank you for this.
kaliqt · a year ago
Isn't WebTransport supposed to get P2P via QUIC?
altanis · a year ago
I like the idea of UDP, but protocols like WebTransport aren't 100% supported and are still relatively new compared to websockets. But you're right, using UDP would be a less latent approach and clientside prediction can account for any lost packets.
Kiro · a year ago
I thought MMORPGs preferred TCP.
Chabsff · a year ago
You typically want a mix of UDP and TCP (or sometimes a weird TCP-like monstrosity rebuilt on top of UDP).

Taking great care to design your data streams to be self-correcting (e.g. transfer a world location where characters are going towards instead of which direction they are heading) can go a long way towards saving a ton of synching headaches, and enables very efficient networking.

One-off events go over the TCP-like channel, but constant streaming data that naturally self-correct over time, like the example above, can benefit from being on the UDP channel.

aatd86 · a year ago
If some packet loss is not problematic, UDP is used. Often for players positions.

That's also how some speed hacks are made possible.

diath · a year ago
Have you shipped a multiplayer game yourself?

Dead Comment

nightpool · a year ago
Seems like I got killed by a glitch that teleported me off screen and then marked me as "killed by Unknown"
altanis · a year ago
Hey sorry, overnight there was performance degradation which made the server run very slow (~100MSPT). I restarted the server for a temporary fix and will fix it sometime today.
cthalupa · a year ago
Something similar for me as well. Played for about 10 minutes and had it happen a few times - I'd be in a fight or killing some shapes, then it would rocket me across the screen and say someone killed me. The "kill cam" would have the person who killed me somewhere quite far a way, and I never saw any bullets coming from that direction.
david_shi · a year ago
Same. I was having a lot of fun playing it otherwise!
tetris11 · a year ago
I'm unable to test this - I spawn, teleport, and then die.

I'm currently enjoying more relaxed MMO settings using threeJS libraries with multiplayer built in:

https://summer-afternoon.vlucendo.com/

cnity · a year ago
This was great! Me and another player were just exploring this, and I had fun finding all of the secrets. Well done :)
tetris11 · a year ago
It's one of the most beautiful WebGL games I've seen in a while.
altanis · a year ago
Hey sorry, there was performance degradation overnight which made the game server super slow. It should be better right now.
torgoguys · a year ago
...and which libraries are those?
qingdao99 · a year ago
I think you should implement client-side prediction, it feels very laggy.

https://developer.valvesoftware.com/wiki/Prediction

altanis · a year ago
There already is. The lag you were experiencing was likely from the game server degrading; did you check what the MSPT of the server was when you were playing? (It was listed at the bottom near your ping.)
feverzsj · a year ago
How can I play the game, if I just get killed within seconds?
Etherlord87 · a year ago
Seconded. The death report says I died after 2 seconds, but I actually have no chance at all to do anything, to control my tank, to even discover if the WSAD control works.

Also on Firefox the FPS meter says 40 FPS, but visually the game (the interface rather, I was unable to play) is clearly not smooth, clearly below stable 24 FPS.

altanis · a year ago
Hey sorry, there was performance degradation overnight which made the game server super slow. It should be better right now.
tiborsaas · a year ago
It's unplayable at the moment. I can't control my shape and I'm instantly killed in a few seconds. M1, Chrome latest.
altanis · a year ago
Hey, sorry about that; there was some performance degradation overnight which caused the game server to run very slowly. I restarted the server to temporarily fix it, I'll look into it today.
GrumpyNl · a year ago
Same here.
aylmao · a year ago
Very cool! I've played diep.io plenty, so no comments on the gameplay haha, I'm familiar with the decisions made here, both the cool ones and the frustrating ones.

I did encounter a bug where out of nowhere I was jolted onto the bounds of the map (specifically the lower-left corner) and died, killed by "Unknown".

I think thse bugs in this kind of game are especially scary because you lose everything when you die, which makes you a little weary of starting again. You might get far just to randomly die for no reason. If those are ironed out, I think you've got yourself a pretty good .io game to build upon and keep evolving here!

altanis · a year ago
Yeah, that bug is from a memory leak, I haven't had a chance to debug it since I'm traveling but I'll figure out the cause by this week.