153 points · by statico · 14y ago · 71 comments
Here's John Carmack describing how he used the aforementioned techniques to make Quake playable over the internet: http://fabiensanglard.net/quakeSource/johnc-log.aug.htm
Here's how Valve do it:
https://developer.valvesoftware.com/wiki/Latency_Compensatin...
And here's another good article on the topic: http://gafferongames.com/networking-for-game-programmers/wha...
Oh, and here's one implementing it with Node / HTML5: http://buildnewgames.com/real-time-multiplayer/
Good luck.
Powderkeg uses lockstep network synchronization and every client sees the same simulation (though the player you control has prediction). The network framerate is 10 FPS and the server waits 2 ticks to collect input, so anyone with more than a 200ms ping to the gameserver will have a less-than-desirable experience.
EDIT: Ah cool I see it's explained in your post: http://blog.artillery.com/2012/10/play-powderkeg-html5-multi...
Also perhaps the servers are a bit overloaded? Cause I'm playing from Palo Alto on a decent connection and the lag is making it pretty unplayable.
Your connection might be fine, but you might be matched with someone on a less-than-optimal connection.
How come you decided to send input rather than state to the client?
If you're still having trouble with Chrome or Firefox, please reply below with your browser and version, and possibly with a gist/pastebin of any console errors. Mark and I will get on it.
Regarding the lag: We match you with players based on your latency to each gameserver and the amount of time you've been waiting. If you experienced a lot of lag earlier, it might have been due to there being too few players online. However, 196 people are playing as I type this now, and hopefully there's now enough player density so you'll get matched with a lower-latency player who's nearby.
You can read more on our blog post: http://blog.artillery.com/2012/10/play-powderkeg-html5-multi...
We're also on VentureBeat today: http://venturebeat.com/2012/10/04/artillery-aims-to-make-web...
Also, I'd like to thank our amazing artist, Adam deGrandis. Check out his portfolio — he's incredible: http://www.adamdegrandis.com/portfolio/
<3
It's a well-executed game though. Haven't found any flaws, but I can't really say it's original. Good proof-of-concept for HTML5!
When I load it in a normal window and click "Find a match" nothing happens. In console:
> findMatch failed: CHANNEL_REQUEST_ERROR: 'BROWSER_WS_ERROR: WebSocket.readyState 3 != WebSocket.OPEN'
When I try to load it in an incognito window:
> XMLHttpRequest cannot load http://pk-cdn.prod.artillery.com/powderkeg/21/Scenes/MainMen.... Origin http://powderkeg.artillery.com is not allowed by Access-Control-Allow-Origin.
How long did it take to make the graphics/sprites?
Good luck
Kidding aside, I'll take a look. What OS?
lag issues ("waiting for other players") and passer-throughs are making it a bit difficult to get a game going though.
edit: this has a few crippling bugs. seems like i have the most trouble after someone leaves a game. also, this desperately needs chat, or voice chat, and a high score. thanks again this is the most fun i've had in a while.
If you mouseover the tiny, hard-to-see lag meter in your colored square while playing a game you'll be able to see some stats about your connection.
The creators have a blog entry about latency and websockets. With even a minimal amount of packetloss, TCP makes for really bad latency - http://blog.artillery.com/2012/06/websocket-performance.html
It's too bad we won't see any playable twitch games in the browser until there is some way to do UDP. I don't see why browsers don't just allow UDP subject to same origin policy, perhaps only on pages which serve a special "X-Allow-UDP" header.
From what I understand, the only reason browsers shy away from being able to send UDP packets is fear of DDOS. This does not seem to be an issue if packets are only sent to same host that the page is served from.
(found on http://blog.artillery.com/2012/07/six-impossible-problems.ht...)
z : up
s : down
q : left
d : right
One of the starcraft devs posted a blog entry here that should be instructive-- sorry, I lost the link, but it might still be reachable from the front page. Basically, you need to do as much as possible on the client side, even when packets are not going through, to make the interface feel responsive.
The issue might also be exacerbated by a simple lack of bandwidth, or maybe some problem with HTML5 (I admit, I am not that familiar with HTML5 as a dev environment.)
http://bombermine.ru, on the other hand, was as smooth as butter for me. So I don't think the problem is insurmountable. Anyway, don't give up, I'm sure you can fix it! You probably should create some kind of test environment where packets are artificially delayed-- perhaps there is an iptables incantation in Linux that can do it for you.
That said, after the first game it was very laggy.