Skip to content

Instantly share code, notes, and snippets.

View jspohr's full-sized avatar

Johannes Spohr jspohr

View GitHub Profile
Wonder Boy: The Dragon's Trap
-----------------------------
Quick Guide for programmers
Last updated October 2018
Contact: Omar Cornut <XXXXXX
===============================================
INDEX
===============================================
@slembcke
slembcke / frame-timing.c
Last active June 18, 2023 19:05
Filter frame timing to try and remove scheduler jitter.
double delta_time_filtered(double dt_nanos){
// Warm start the filter by assuming 60 Hz.
static double x[] = {1.6e7, 1.6e7, 1.6e7}, y[] = {1.6e7, 1.6e7, 1.6e7};
// IIR filter coefficients. 2rd order lowpass butterworth at 1/128 the sample rate.
static const double b[] = {6.321391700454014e-5, 0.00012642783400908025, 6.321391700454014e-5};
static const double a[] = {1.0, -1.9681971279272976, 0.9684499835953156};
// Apply IIR filter coefficients.
double value = b[0]*dt_nanos;
for(uint i = 2; i > 0; i--){
@aras-p
aras-p / package_builds_vs2017.cmd
Created April 9, 2019 19:36
Packaging up Visual Studio & Windows 10 SDK for in-repository usage
@echo off
@rem Packages up VS2017 toolchain into builds.7z archive
@set TOOLS_VERSION=14.13.26128
@cd "%~dp0"
@set VC_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\VC\
@if not exist "%VC_PATH%" goto error_no_vs
@if not exist "%VC_PATH%"Tools\MSVC\%TOOLS_VERSION% goto error_no_vs
@vurtun
vurtun / allocator.md
Last active September 13, 2023 11:42

This is a short post related to Opaque object representations from Our Machinery. I have to begin that my understanding of how Our Machineries tech is somewhat limit and it is currently rather late in the day, so please bear with me. As far as I understood how modules work is similar to how Quake 2 did their modules. A module has both a struct for export and one for import containing a number of function pointer. At load time the module gets a filled out import struct and fills out its own export struct with its own functions and returns it.

As for the allocators. I would have guessed tha

@samme
samme / phaser-scenes-summary.md
Last active August 2, 2023 16:26
Phaser 3 Scenes Summary

Scene control

Calls without a key argument

These affect the calling scene only.

Example:

this.scene.start()

@sebbbi
sebbbi / fast_spheres.txt
Created February 18, 2018 19:31
Fast way to render lots of spheres
Setup:
1. Index buffer containing N quads (each 2 triangles), where N is the max amount of spheres. Repeating pattern of {0,1,2,1,3,2} + K*4.
2. No vertex buffer.
Render N*2 triangles, where N is the number of spheres you have.
Vertex shader:
1. Sphere index = N/4 (N = SV_VertexId)
2. Quad coord: Q = float2(N%2, (N%4)/2) * 2.0 - 1.0
3. Transform sphere center -> pos
@JashanChittesh
JashanChittesh / Getting_Steam_Review_RSS_Feed_from_Feed43_into_Slack.txt
Last active January 26, 2021 07:43 — forked from SnugglePilot/gist:ce094bc54ee15c3801e704d4edf22a3e
This is an updated version of CapnAndy's instructions to get Steam reviews into a Slack channel by creating a review RSS feed on feed43.com.
This is based on instructions by @Capn_Andy (apparently now @SnugglePilot), who was
pointed there by @Chaklapak. I implemented this the first time April 17, 2016, with
some updates to make it work for Early Access (the original version gave me just the
"Early Access Review" as review text). This version here is an update from April 30, 2017
which was long overdue because my previous RegEx-statement mixed things up quite a bit,
probably due to Steam changing the format a while back, resulting in the same reviews
popping up in the Slack channel over and over, with authors, recommended / not recommended
and the actual reviews all mixed up.
Original instructions:
@pervognsen
pervognsen / gob.h
Last active March 31, 2024 22:42
gob.h
// My investigations on the C standard compliance of Gob and related techniques:
// https://gist.github.com/pervognsen/5249a405fe7d76ded1cf08ed50fa9176
#pragma once
#include <stdint.h>
#pragma pack(push, 8)
#if __cplusplus >= 201103L || (__cplusplus && _MSC_VER >= 1900)
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active July 15, 2024 12:10
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);