Skip to content

Instantly share code, notes, and snippets.

View kg's full-sized avatar

Katelyn Gadd kg

View GitHub Profile
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<XNAPropertiesOverridePath>$(SolutionDir)XNA.Override.props</XNAPropertiesOverridePath>
</PropertyGroup>
<Import Project="$(XNAPropertiesOverridePath)" Condition="Exists('$(XNAPropertiesOverridePath)')" />
<PropertyGroup>
<!-- workaround for common typo in project files -->
<FNALibsPath Condition="'$(FNALibsPath)' == ''">$(FNALibPath)</FNALibsPath>
@echo off
:start
set /a var+=1
if %var% EQU 100 goto end
pwsh -c exit
goto start
:end
echo ran powershell %var% time(s).
pause

streamable heap snapshot system for constrained memory (WASM)

  • existing browser heap snapshot infrastructure (i.e. chrome and firefox's) assume it is possible to build a full retained graph of the heap in memory, and sometimes require multiple passes to generate the snapshot file before saving it. this can result in out-of-memory crashes when attempting to save or load a snapshot. our customers have very large heaps they want to take snapshots of, so this approach is unsuitable
    • these snapshot tools only understand the JS heap, and don't have any hooks we could use to feed our GC heap layout into them when a snapshot is taken anyway
    • existing viewers for these formats are incredibly fragile and basically only work on snapshots that were generated by a recent version of the same browser, so we can't realistically generate snapshots in this format. if a snapshot fails to load you barely get any sort of error message
  • .net has a couple answers for this (can we leverage their tooling?), coreclr gcdump an

hi! i'm a game dev and when i watched alex's video about skoe some ideas immediately came to mind re: how the 60fps lock would happen, and how it would drift

i looked at the cocos source in https://github.com/altalk23/cocos2d-x-gd to try and get a sense of how cocos works, though ultimately a lot of this will depend on how GD is written. i also looked at current cocos2d-x on its public repo and most of the key details are the same.

(sorry this is disorganized) i'll try and start by explaining how most game engines (including cocos 2.2.3 from what i can see) work. they usually perform a set of steps in a loop:

  1. before step 1 cocos computes something called 'delta time', a measurement of how long it's been since the last time step 1 happened. various parts of cocos use this delta time to influence updates, potentially this would include gd's physics. cocos' current "FPS" is determined based on this delta time
  2. ask windows 'has anything happened, like keyboard or mouse input?', and keep asking until there
@kg
kg / _howto.md
Last active April 2, 2024 00:30
How to get native disassembly for a wasm module

How to get native disassembly for a wasm module out of Firefox's JS runtime

Build Spidermonkey from source

Follow steps 1 and 2 here: https://firefox-source-docs.mozilla.org/setup/linux_build.html#building-firefox-on-linux

Then set up a debug mozconfig and build using it as described here: https://firefox-source-docs.mozilla.org/js/build.html#developer-debug-build

Once you're done you should have a mozilla-unified/obj-debug-x86_64-pc-linux-gnu/dist/bin/js. Building from source is necessary to get the ability to disassemble native code.

@kg
kg / murmur3-streaming.c
Created March 30, 2024 22:01
Streaming version of 32-bit murmurhash3
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// MurmurHash3 was written by Austin Appleby, and is placed in the public
// domain. The author hereby disclaims copyright to this source code.
inline static uint32_t
ROTL32 (uint32_t x, int8_t r)
{
#include <stdint.h>
#define gint32 int32_t
#define guint32 uint32_t
#define guint64 uint64_t
#define guint8 uint8_t
typedef guint8 v128_u1 __attribute__ ((vector_size (16)));
typedef gint32 v128_i4 __attribute__ ((vector_size (16)));
source_filename = "/app/example.cpp"
target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20"
target triple = "wasm32-unknown-emscripten"
%struct.DoubleBox = type { double }
%struct.UlongBox = type { i64 }
@__main_void = hidden alias i32 (), ptr @main
define hidden void @AcceptDouble(DoubleBox)(double %0) #0 !dbg !6 {
@kg
kg / MetaProject.csproj
Created April 3, 2022 10:43
Automatically compile game scripts as part of visual studio build
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<ProjectGuid>{29214583-65ED-44D0-8DC6-F57539C6BC8E}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>HeavenLens.Scripts</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<LangVersion>latest</LangVersion>
@kg
kg / text.txt
Created September 30, 2021 17:31
Deathloop spoilery Q&A + theories
Deathloop spoilers ahead (mostly earlier-game stuff in this section)
* Why do only Cole and Julianna remember?
Cole and Julianna aren't the only ones who remember. 2-Bit also
remembers, and he's made out of part of Charlie's brain. So why
doesn't Charlie remember? Wenjie's lab has at least one note where
she explicitly calls out that Cole and Julianna remember the loops