Skip to content

Instantly share code, notes, and snippets.

View z3t0's full-sized avatar

Rafi Khan z3t0

View GitHub Profile
std::vector<Player> players (MAX_CONNECTIONS);
// pull out the type of messages sent by our config
typedef server::message_ptr message_ptr;
// Define a callback to handle incoming messages
void on_message(server* s, websocketpp::connection_hdl hdl, message_ptr msg) {
std::cout << "on_message called with hdl: " << hdl.lock().get()
<< " and message: " << msg->get_payload()
<< std::endl;
@z3t0
z3t0 / a.js
Last active July 29, 2016 00:08
var pixi = require('pixi.js');
module.exports = function(host) {
return new Game(host);
}
function Game (host) {
this.host = host;
console.log("Creating game")
var pixi = require('pixi.js');
module.exports = function(host) {
return new game(host);
}
function game (host) {
this.host = host;
console.log("creating game")
var pixi = require('pixi.js');
var player = require('./player.js')
module.exports = function(host) {
return new Game(host);
}
function Game (host) {
this.host = host;
function Server (host, port) {
// Create WebSocketServer
var wss = new WebSocketServer({host: host, port: port})
wss.on('connection', this.onConnect(ws))
}
Server.prototype.onConnect = function (ws) {
// Debug
// Nolag Client Implementation : Client
// Rafi Khan
// Require Modules
var WebSocket = require('ws')
// Returns Client Object
module.exports = function(host) {
return new Client(host)
}
// Nolag Server : Main
// Rafi Khan
extern crate time;
use std::thread::sleep;
use std::time::Duration;
// runs loop update_rate times a second
// Create a game
Debug.Log("Create a single player game: " + gameMode);
SceneManager.LoadScene ("dmGame", LoadSceneMode.Single);
switch (gameMode) {
case Game.GameMode.DEATH_MATCH:
Debug.Log ("create a deathmatch game");
GameObject go = GameObject.Find ("/Everything/Game");
if (go == null)
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine.SceneManagement;
using System.Reflection;
public class GameManager : MonoBehaviour {
public GameManager Instance;
@z3t0
z3t0 / a.js
Created August 26, 2016 01:44
var ndarray = require('ndarray')
var block = require('./block.js')
module.exports = function() {
return new Chunk()
}
function Chunk() {
this.size = 16
this.dims = [this.size, this.size, this.size]