Skip to content

Instantly share code, notes, and snippets.

@ribbanya
ribbanya / 2d6-opposed-probability.py
Last active September 28, 2017 17:18
2d6+a vs. 2d6+b Probability Simulator
import random
def main():
trials = 1000000
print_each_trial = False
reroll_if_tie = True
print('A', 'B', 'A%', 'B%', 'Tie%', sep='\t')
for a_mod in range(-3, 3 + 1):
for b_mod in range(-3, 3 + 1):
results = {'a' : 0, 'b' : 0, 'tie' : 0}
@ribbanya
ribbanya / README.md
Last active September 3, 2018 19:53
Including Unreal Engine 4.20 Generated Headers in Visual Studio project

Unreal Engine 4.20.2 Generated Headers using Visual Studio

Version 4.20.0 through 4.20.2 does not include the directories for *.generated.h files, and you must include them manually.

To do so, follow these steps.

In Windows

  1. Create an environment variable called UNREAL_ENGINE containing the path to the root directory of Unreal Engine's files, without a trailing backslash, for example C:\Program Files\Epic Games\Unreal Engine\UE_4.20.

In Visual Studio

Visual Studio Code C/C++ Propeties files for UE 4.20

Version 4.20 of Unreal Engine does not generate includes for *.generated.h files. To fix this, you must modify your c_cpp_properties.json.

  1. Create an environment variables called UNREAL_ENGINE pointing to the Unreal Engine folder (UE_4.20 for example) with no trailing backslash.
  2. Replace your c_cpp_propeties.json with the one below.

Other intellisense issues

Visual Studio Code seems to not understand Include-What-You-Use style headers. To fix this, replace #include "CoreMinimal.h" and any other Unreal system includes with #include "Engine.h". This should fix Intellisense errors, at the cost of some initial compile time.

@ribbanya
ribbanya / Jenny.properties
Created March 4, 2019 03:59
Jenny properties
Jenny.SearchPaths = Assets\Libraries\DesperateDevs\Editor\Plugins, \
Assets\Libraries\Entitas\Editor\Plugins, \
Jenny\Plugins\Entitas.Roslyn
Jenny.Plugins = DesperateDevs.CodeGeneration.Plugins, \
DesperateDevs.CodeGeneration.Unity.Plugins, \
Entitas.CodeGeneration.Plugins, \
Entitas.Roslyn.CodeGeneration.Plugins, \
Entitas.VisualDebugging.CodeGeneration.Plugins
@ribbanya
ribbanya / EntityHelper.cs
Created March 6, 2019 17:42
Entitas manual ID system
using Entitas.CodeGeneration.Attributes;
public static class EntityHelper {
public static T CreateEntityWithId<T>(this Context<T> @this) where T : class, IIdEntity, IEntity {
var entity = @this.CreateEntity();
entity.AddId(entity.creationIndex);
return entity;
}
}
@ribbanya
ribbanya / EntitasHelper.cs
Last active October 24, 2019 16:20
Entitas "binding" syntax sugar
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using DesperateDevs.Utils;
using Entitas;
namespace TeamSalvato.Slashball.Common {
public static class EntitasHelper {
public static void BindComponent(this IEntity @this, int index, object value, bool replace) {
@ribbanya
ribbanya / Jenny.csproj
Created November 12, 2019 23:38
Sample stand-alone Jenny setup
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration>Jenny</Configuration>
<Platform>AnyCPU</Platform>
<OutputPath>.\Output\Jenny</OutputPath>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.Csharp.targets"/>
<ItemGroup>
<Reference Include="Entitas">
<HintPath>.\Dependencies\Entitas\Entitas.dll</HintPath>
@ribbanya
ribbanya / Jenny.csproj
Last active November 28, 2019 18:37
Resolving external types from Jenny (untested)
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration>Jenny</Configuration>
<Platform>Any CPU</Platform>
<OutputPath>.\bin\Jenny</OutputPath>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.Csharp.targets"/>
<ItemGroup>
<Reference Include="Entitas">
<HintPath>.\Jenny\Plugins\Entitas.Roslyn\Entitas.dll</HintPath>
SendMode Input
SetWorkingDir, %A_ScriptDir%
#SingleInstance, Force
#IfWinActive, ahk_exe osu!.exe
Thread, interrupt, 0 ; ensure no delay on keypresses
global prev := 0, zDown := false, xDown := false
CheckAlternate(cur)
@ribbanya
ribbanya / pilot.txt
Created November 21, 2020 20:28 — forked from compcon/pilot.txt
Titania - Olivia Hargreaves (LL:2)
{"id":"0273b0ad-4b92-4f68-92c4-cb1794937ed4","campaign":"","group":"Wow Cool Robots","sort_index":0,"cloudID":"8197faa54c01e2efac61f2a271766470","cloudOwnerID":"e2451b4d-2adb-4262-acce-d62759181896","lastCloudUpdate":"Tue Nov 17 2020 08:07:53 GMT-0500 (Eastern Standard Time)","level":2,"callsign":"Titania","name":"Olivia Hargreaves","player_name":"Ribbanya","status":"ACTIVE","mounted":true,"text_appearance":"","notes":"","history":"","portrait":"","cloud_portrait":"","quirk":"","current_hp":10,"reserves":[],"orgs":[],"background":"Soldier","mechSkills":[4,0,0,0],"licenses":[{"id":"mf_white_witch","rank":2}],"skills":[{"id":"sk_read_a_situation","rank":1},{"id":"sk_get_somewhere_quickly","rank":1},{"id":"sk_take_control","rank":2},{"id":"sk_take_someone_out","rank":1},{"id":"sk_show_off","rank":1}],"talents":[{"id":"t_duelist","rank":2},{"id":"t_exemplar","rank":2},{"id":"t_leader","rank":1}],"core_bonuses":[],"loadout":{"id":"f021c1e7-d1d5-487e-9e65-d65a81857d28","name":"Primary","armor":[{"id":"pg_heavy_hard