Skip to content

Instantly share code, notes, and snippets.

@dogles
dogles / markovjr_tech_notes.md
Last active March 25, 2024 15:57
Markov Jr. Technical Notes

Introduction

Markov Jr. is an open source C# application that creates procedural content primarily via applying Markov rewrite rules to a 2D or 3D grid. A rewrite rule has an input and output pattern, which essentially specifies what pattern to look for in the existing grid, and what to replace it with.

For example, given a 2D grid, this would replace any white dot with a white cross:

***/*W*/*** :: *W*/WWW/*W*

The left hand side is the rule input, and the right hand side is the output. The / character is used to delimit rows, and space is used to delimit Z-layers (in 3D grids). The input rule above translates to the 2D pattern:

@dogles
dogles / programDef.cpp
Created April 22, 2022 21:22
Example of rule formulas
// Rule formulas can only be defined within a Program::define() block
auto simpleMaze = Program::define([](int width, int height, int entranceX, int entranceY, int exitX, int exitY)
{
// Floating variables. These don't mean anything outside the context of a rule statement.
// Within a rule statement, they encode equality. E.g. if "X" shows up in two places in a rule,
// it means that those Xs are the same. See below.
FormulaParameter X, Y, X1, Y1;
// define col(1), col(2), ... col(width) as atoms.
Formula<1> col = Program::range(1, width);
@dogles
dogles / haxe.rb
Last active August 29, 2015 14:22
Keep generics haxe branch
require 'formula'
class Haxe < Formula
homepage 'http://haxe.org'
head 'https://github.com/waneck/haxe.git', :branch => 'keep_generics'
depends_on 'neko' => :recommended
depends_on 'objective-caml' => :build
depends_on 'camlp4' => :build
using UnityEngine;
using System.Collections;
public static class PacketZoom {
public static void Initialize(string appID, string apiKey, bool enable) {
#if (UNITY_IPHONE && !UNITY_EDITOR)
PZSpeed.Init(appID, apiKey);
PZSpeed.UsePZ(enable);
PZSpeed.ShouldReportAnalytics = true;
PZSpeed.MeasureAppLaunchDelay(false);
@dogles
dogles / haxe.rb
Last active August 29, 2015 14:16
require 'formula'
class Haxe < Formula
homepage 'http://haxe.org'
head 'https://github.com/HaxeFoundation/haxe.git', :tag => '3.2.0'
depends_on 'neko' => :recommended
depends_on 'objective-caml' => :build
depends_on 'camlp4' => :build
@dogles
dogles / gist:507a3be60f47a76616ec
Created December 18, 2014 21:03
Fucking FTUE
if ( !m_allUnitsPlaced ){
if ( m_combatGameMode.hud.unitBeingDragged == null && !m_combatGameMode.hordeSpawned ) {
m_combatGameMode.hud.hideSkillSlots();
m_combatGameMode.hud.showSlot(0, false);
m_combatGameMode.hud.showSlot(1, false);
m_combatGameMode.hud.showSlot(2, false);
m_combatGameMode.hud.showSlot(3, false);
m_combatGameMode.hud.setActiveTopHUD(false);
m_combatGameMode.hud.showSlotArrows(true);
NGUITools.SetActive(m_combatGameMode.hud.gameObject, true);
@dogles
dogles / UIPanel.diff
Created December 17, 2014 14:38
UIPanel.cs change
--- UIPanel-old.cs 2014-12-17 09:36:13.000000000 -0500
+++ UIPanel-new.cs 2014-12-12 13:10:36.000000000 -0500
@@ -1157,19 +1157,19 @@
{
p.startingRenderQueue = rq;
p.UpdateDrawCalls();
- rq += p.drawCalls.size;
+ rq += p.drawCalls.size*2;
}
else if (p.renderQueue == RenderQueue.StartAt)
@dogles
dogles / UISortBehavior.cs
Created December 17, 2014 14:12
MonoBehaviour for sorting Renderers against NGUI widgets.
using UnityEngine;
public class UISortBehavior : MonoBehaviour
{
public UIWidget widgetInFrontOfMe;
[System.NonSerialized]
Renderer m_renderer;
void Awake() {
@dogles
dogles / Preprocessor.hx
Created November 17, 2014 15:49
Unity Ifdefs
package hugs;
import haxe.macro.Expr;
import haxe.macro.Context;
/** Utility to generate C# preprocessor macros */
class Preprocessor
{
public macro static function IF(name:ExprOf<String>) : Expr {
var ns = switch(name.expr) {