Skip to content

Instantly share code, notes, and snippets.

View drub0y's full-sized avatar

Drew Marsh drub0y

View GitHub Profile
Readme: In the following pseudo code, [] indicates a subroutine.
Sometimes I choose to write the subroutine inline under the [] in order to maintain context.
One important fact about the way rollbacks are handled here is that we are storing state for every frame.
In any real implementation you only need to store one game state at a time. Storing a game
state for every frame allows us to only rollback to the first frame where the predicted inputs don't match the true ones.
==Constants==
MAX_ROLLBACK_FRAMES := Any Positive Integer # Specifies the maximum number of frames that can be resimulated
FRAME_ADVANTAGE_LIMIT := Any Positive Integer # Specifies the number of frames the local client can progress ahead of the remote client before time synchronizing.
@aelij
aelij / -Usage.cs
Last active March 29, 2024 14:26
IAsyncEnumerable Bridge for Service Fabric Reliable Collections
class MyService : StatefulService
{
private Task<IReliableDictionary<int, string>> AccountNames => StateManager.GetOrAddAsync<IReliableDictionary<int, string>>("AccountNames");
private Task<IReliableDictionary<int, string>> AccountData => StateManager.GetOrAddAsync<IReliableDictionary<int, string>>("AccountData");
public async Task<List<Account>> SearchAccountsByNameAsync(string name)
{
using (var txn = StateManager.CreateTransaction())
{
var accountNames = await AccountNames;
@staltz
staltz / introrx.md
Last active May 30, 2024 18:43
The introduction to Reactive Programming you've been missing
@htuomola
htuomola / Hubs.tt
Last active May 8, 2016 20:41 — forked from robfe/Hubs.tt
A T4 template for generating TypeScript definition files for SignalR hubs. This fork includes minor corrections for using this in VS 2013, MVC 5 project: * Reference the SignalR 2.0 assembly * VS 2013 likes to put TS definition files into subfolders when downloaded from nuget - assuming that this file is directly under /typings/ * TypeScript 0.9…
<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ output extension=".d.ts" #>
<# /* Update this line to match your version of SignalR */ #>
<#@ assembly name="$(SolutionDir)\packages\Microsoft.AspNet.SignalR.Core.2.0.0\lib\net45\Microsoft.AspNet.SignalR.Core.dll" #>
<# /* Load the current project's DLL to make sure the DefaultHubManager can find things */ #>
<#@ assembly name="$(TargetPath)" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Web" #>
<#@ assembly name="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
<#@ assembly name="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
@bradwilson
bradwilson / NameTaskReturningMethodAppropriately.cs
Last active December 15, 2015 11:09
FxCop rule to ensure that Task-returning methods are suffixed with 'Async'
using System.Runtime.CompilerServices;
using Microsoft.FxCop.Sdk;
namespace Tier3.FxCop.TaskRules
{
public class NameTaskReturningMethodAppropriately : BaseIntrospectionRule
{
public NameTaskReturningMethodAppropriately() :
base("NameTaskReturningMethodAppropriately",
"Tier3.FxCop.Rules",
@clemensv
clemensv / sqlfiltersandrules.cs
Created February 21, 2013 12:35
I should talk about this more. SQL filters and rules on Service Bus Topics subscriptions. SQL action syntax http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.servicebus.messaging.sqlruleaction.sqlexpression.aspx
namespace SqlFiltersAndRules
{
using System;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
class Program
{
static void Main(string[] args)
{
@hyrmn
hyrmn / EndToEndTests.cs
Created July 29, 2012 16:27
My incomplete but evolving understanding of CQRS
using System;
using System.Reflection;
using CommonDomain;
using CommonDomain.Core;
using CommonDomain.Persistence;
using CommonDomain.Persistence.EventStore;
using EventStore;
using EventStore.Dispatcher;