Skip to content

Instantly share code, notes, and snippets.

View tenowg's full-sized avatar

Craig Russell tenowg

View GitHub Profile
@tenowg
tenowg / NativePriorityQueue.cs
Created March 22, 2020 23:34
Priority Queue
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEngine;
[NativeContainer]
@tenowg
tenowg / Autofac4upgrade.cs
Last active August 19, 2016 19:20
Upgrade to Autofac 4.0.0 for MultiplayGameFramework (more docs can be found at: https://docs.autofac.org/en/latest/configuration/xml.html)
// Nuget Packages
// Autofac 4.0.0
// Autofac.Configuration v4.0.0
// Microsoft.Extensions.Configuration.Json v1.0.0
// Microsoft.Extensions.Configuration
// Microsoft.Extensions.Configuration.FileExtensions
// Microsoft.Extensions.Configuration.Abstractions
// Need to create a ConfigBuilder from Microsoft.Extensions.Configuration
// This code replaces the current Autofac code in PhotonApplication.cs in Setup()
@tenowg
tenowg / RedisJobQueue.cs
Last active January 17, 2024 07:22
A Message/Job Queue based on StackExchange.Redis and Redis Server
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using StackExchange.Redis;
namespace CitySurvival.Redis
{
@tenowg
tenowg / FeatureExample.java
Created July 28, 2013 05:35
Feature Example
public class InRegion extends Feature implements Tickable {
/*
* Marking something as @RegionEvent will make this method
* fire everytime the event Type (in this case PlayerChatEvent) is
* fired by Spout. Each Features events are parsed on loadup and
* automaticly registered with Spout's EventManager.
*/
@RegionEvent
public void executeIt(PlayerChatEvent event, EventRegion region) {
chatEvent.getPlayer().sendMessage("You Chatted in " + region.getName());
@tenowg
tenowg / WHHeightMapGenerator.java
Last active December 14, 2015 07:59
Spout server heightmap world generator, would love some help optimizing this for use with Spout.
public class WHHieghtMapGenerator implements WorldGenerator {
private BufferedImage worldImage;
public WHHieghtMapGenerator(String imagefile) {
try {
URL url = getClass().getResource("/" + imagefile);
worldImage = ImageIO.read(url);
} catch (IOException ex) {
Spout.getLogger().log(Level.SEVERE, ex.getMessage(), ex);