Hey all, I've been tinkering with networked games through sgdk, and I think what I've stumbled through will help anyone else out who might want to take a stab at it.
Node.js is a fun program that makes it pretty easy to run a server in javascript. This makes it good for plugging in to sgdk's HTML5 projects since they're based on javascript. The tricky thing with networked games is that the server and the client have a communication delay between them, so you can't very well run every frame on the server and send the results back to the client. It's much smoother to have both the client and server run the same game code, and synchronize periodically. I managed to get Node to accept sgdk's generated javascript as a module, but it doesn't like running it. Node runs through the console, which means there's no document or window object to reference. So here's how you can do it!
Set up your node directory like this:
NodeFolder (folder)
- myServerCode.js
- node_modules (folder)
- - sgdk (folder)
- - - index.js
- - - sgdk-lib (folder)
- - - - sgdk.js
- - - - sgdk-extend.js
myServerCode.js is your Node application. Do whatever you want here, and add these lines:
var sgdk = require('sgdk');
sgdk.startGame();
index.js is what ties all the files in the sgdk module back to Node:
var fs = require('fs');
filedata1 = fs.readFileSync('./node_modules/sgdk/sgdk-lib/sgdk-extend.js','utf8');
eval(filedata1);
filedata2 = fs.readFileSync('./node_modules/sgdk/sgdk-lib/sgdk.js','utf8');
eval(filedata2);
exports.startGame = startGame;
// This tells Node that the function startGame is to be exported and made accessible to the server code
sgdk.js is just the generated javascript file exported from the HTML5 project. I had to replace
mainLoop.interval = setInterval("pulse()", mainLoop.milliseconds);
with
mainLoop.interval = setInterval(pulse, mainLoop.milliseconds);
Finally, add sgdk-extend.js to dummy out the drawing functions in a mocked document/window:
var document = new mocument();
document.elements = new Object();
document.elements['gameView'] = new mockGameView();
function mocument() {}
mocument.prototype.write = function(x) { console.log(x); }
mocument.prototype.getElementById = function(x) { return document.elements[x]; }
mocument.prototype.createElement = function(x) {}
mocument.prototype.querySelector = function(x) { return null; }
var window = new Object();
window.innerHeight = 768;
window.innerWidth = 1024;
function mockGameView() {}
mockGameView.prototype.getContext = function(x) { return new mockCanvas(); }
function mockCanvas() {}
mockCanvas.prototype.fillRect = function(x,y,w,h) {}
mockCanvas.prototype.strokeRect = function(x,y,w,h) {}
mockCanvas.prototype.save = function() {}
mockCanvas.prototype.beginPath = function() {}
mockCanvas.prototype.rect = function(x,y,w,h) {}
mockCanvas.prototype.clip = function() {}
mockCanvas.prototype.restore = function() {}
mockCanvas.prototype.drawImage = function(i,x,y,w,h,x2,y2,cw,ch) {}
And voila, sgdk in a console!

(This is pretty much just a single sprite with initial velocity heading for a dead end, so no player input from the console)
You can add other exported functions so that you can perform game logic based on network communication. For instance, have the player send its position to the server every so often, and respond with the location of all other sprites. Hope this helps!