forked from Irrelon/ige
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
35 lines (29 loc) · 1.01 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var Server = IgeClass.extend({
classId: 'Server',
Server: true,
init: function (options) {
var self = this;
// Add the networking component
ige.addComponent(IgeNetIoComponent)
// Start the network server
.network.start(2000, function () {
// Networking has started so start the game engine
ige.start(function (success) {
// Check if the engine started successfully
if (success) {
ige.network.on('connect', function () {});
ige.network.on('disconnect', function () {});
// Add the network stream component
ige.network.addComponent(IgeStreamComponent)
.stream.sendInterval(30) // Send a stream update once every 30 milliseconds
.stream.start(); // Start the stream
// Accept incoming network connections
ige.network.acceptConnections(true);
// Load the base scene data
ige.addGraph('IgeBaseScene');
}
});
});
}
});
if (typeof(module) !== 'undefined' && typeof(module.exports) !== 'undefined') { module.exports = Server; }