I released a game called Extincter for HTML canvas, Erlang, and Websockets. This was both to learn Erlang, and because I hadn't written a game since middle school (C64).
The game, along with source code per the license.
The Canvas2D element uses a basic game loop to control the scenes and render the game state, animations, etc. A core JavaScript module is separate from the draw code, so that it should be possible to write harness3d.html and only rewrite what must be rewritten.
The server side is more interesting. The server is authoritative, and everything goes through it. True, this doesn't serve much purpose in a single-player game except to prohibit cheating.
Cowboy is used as the web server, from static files all the way to the websockets. Cowboy is one of the best web servers I've seen ever, and it only gets more impressive as Loic adds features (I can't wait to use the REST framework for something). Since Cowboy can serve websockets and static content equally well, extra pieces are avoided (solutions at work use Apache + PHP + node.js, three products, to achieve the same).
Here is the process tree:
The player (pc) and AI are modeled as Finite State Machines (gen_fsm), but in hindsight they could just as simply have been gen_servers.
AI gets its own process. Currently it takes inputs randomly, but being it's own small process it would be fairly easy to make it smarter. It aims missiles perfectly every time, so the player must keep moving or die quickly.
It's not clear from the diagram, but pc_fsm and ai_fsm are the same code. This means that only a little effort would be required to implement PVP between two human players.
A mistake of laziness is to spawn a new process for each projectile. A more resource-sensitive implementation would reuse processes in a pool.
Erlang is certainly stable. Twice now I've had the server running for weeks and weeks, only to revisit the game and find it running with no problems.
The primary distribution adds Facebook's OAuth, which results in a record insert (first/last name) into Mnesia. I've disabled this feature, so that more folks can experience the game.