This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Entity Interpolation | |
this code occurs within the draw loop for an entity | |
this.x and this.y represent the most recently received server position of | |
the entity -- though i don't ever intend to use it for drawing | |
when an update is received (roughly every 50ms in my particular game) this.x and this.y get | |
pushed into previousState.x and previousState.y | |
i also continue sloppily onwards to previousPreviousState.x, but I've removed that code | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nengi from 'nengi' | |
import * as BABYLON from 'babylonjs' | |
class PlayerCharacter { | |
constructor(scene) { | |
this.name = 'anon' | |
this.mesh = new BABYLON.Mesh('dummy', scene) | |
this.mesh.entity = this // for collisions within babylon | |
this.hitpoints = 100 | |
// velocity from own impulses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//var BinarySerializer = require('./BinarySerializer') | |
//var BinaryType = require('./BinaryType') | |
// axis-aligned bounding box | |
/* PARAMS: (Point)center, (Point)half */ | |
function AABB(x, y, halfWidth, halfHeight) { | |
this.initialize(x, y, halfWidth, halfHeight) | |
} | |
AABB.pool = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- jQuery, delete this line if you already have jQuery on your page --> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> | |
<!-- the twitch widget, place code in the <HEAD> --> | |
<script> | |
var twitchUserName = 'timetocode' // your name goes here | |
$(document).ready(function() { | |
$.getJSON("https://api.twitch.tv/kraken/streams/"+twitchUserName+"?callback=?",function(streamData) { | |
console.log('Stream Data:', streamData) // debug message, shows all available data | |
if(streamData && streamData.stream) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createEntity = (nid, x, y, name) => { | |
return { | |
nid, | |
x, | |
y, | |
hp: 100, | |
name | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::time::Instant; | |
#[derive(Debug)] | |
struct Entity { | |
nid: u32, | |
x: f64, | |
y: f64, | |
hp: u8, | |
name: String | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const glue = require('./glue') | |
const nengi = glue.nengi.default | |
const nengiConfig = glue.nengiConfig.default | |
const PlayerInput = glue.PlayerInput.default | |
// bots need to all share the same protocols | |
const protocolMap = new nengi.ProtocolMap(nengiConfig, nengi.metaConfig) | |
//var address = 'ws://localhost:8001' | |
const address = null // put some url here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
background-color:#423b41; | |
} | |
.wrap { | |
display: flex; | |
} | |
.solo { | |
border: solid 4px #ebfff9; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
server { | |
listen 443 ssl; | |
ssl_certificate /srv/certs/fullchain.pem; | |
ssl_certificate_key /srv/certs/privkey.pem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TileEnum = { | |
EMPTY: 0, | |
GRASS: 1, | |
DIRT: 2, | |
STONEWALL: 3 | |
} | |
class TileMap { | |
constructor(width, height) { |
NewerOlder