Skip to content

Instantly share code, notes, and snippets.

@nucleartide
nucleartide / Setup.md
Created February 28, 2024 09:51
Setup instructions for FishNet and Edgegap that weren't necessarily mentioned in FirstGearGames' setup video.
  • Mandatory pre-requisites
    • New Unity project
    • Absolutely must add this to your packages: com.unity.nuget.newtonsoft-json
      • Otherwise, calling .ToString() on JSON objects will return NewsonSoft.Something.Something, and your API calls will return HTTP 400s for bad requests
    • Must have Linux dedicated server modules installed (including the Mono and IL2CPP modules)
      • Ensure you are switched over to Linux dedicated server build once modules are installed. You may need to restart your editor to accomplish this
    • Open the HashGrid_Demo scene, and make sure this scene is included in Build Settings, not the default Sample Scene
    • You shouldn’t need to do this, but in case you see complaints about Spawnable Prefabs being null, in the HashGrid_Demo scene, ensure NetworkManager has its Spawnable Prefabs set to Default Prefab Objects
    • Install Docker Engine so that you can build Docker containers
  • Step 1: Build our dedicated server
require 'fileutils'
require 'optimist'
require 'plist'
def run(path, source_path)
process(path, source_path, '**/*.app', true)
process(path, source_path, '**/*.dylib', false)
end
def process(path, source_path, search_pattern, is_app)
require 'optimist'
require 'plist'
# Setups of source path mapping for the framework at framework_path,
# which has a dsym at dsym_path. It maps the source paths to the
# source_path root. Implementation borrowed from https://medium.com/@maxraskin/background-1b4b6a9c65be
def setup_dsym_source_mapping(framework_path, dsym_path, source_path)
binary_uuids = get_uuids_of_dwarf(framework_path)
dsym_uuids = get_uuids_of_dwarf(dsym_path)
verify_uuids(binary_uuids, dsym_uuids)
class EnemyModel
{
public ReactiveProperty<long> CurrentHp { get; private set; }
public ReactiveProperty<bool> IsDed { get; private set; }
public EnemyModel(int initialHp)
{
CurrentHp = new ReactiveProperty<long>(initialHp);
IsDead = CurrentHp.Select(x => x <= 0).ToReactiveProperty();
}
@nucleartide
nucleartide / rrectfill.p8
Last active May 5, 2020 14:21
rounded rectfill for pico8
function rrectfill(x0, y0, x1, y1, col, corners)
local tl = corners and corners.tl
local tr = corners and corners.tr
local bl = corners and corners.bl
local br = corners and corners.br
local new_x0 = x0 + max(tl, bl)
local new_y0 = y0 + max(tl, tr)
local new_x1 = x1 - max(tr, br)
local new_y1 = y1 - max(bl, br)
function weighted_choice(choices)
local total_weight = 0
local thresholds = {}
for choice, weight in pairs(choices) do
add(thresholds, {total_weight, choice})
total_weight += weight
end
local selection = rnd(total_weight)
for i=1,#thresholds-1 do
const verbs = [
'move horizontally',
'raise sword',
'lower sword',
'thrust sword',
]
const objects = [
'fencer with sword',
'piste',
@nucleartide
nucleartide / command.p8
Last active April 25, 2019 04:40
Command pattern in PICO-8 (basically, passing a callback)
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
-- here's a simple player class:
function player(o)
return {
x=64,
y=64,
on_input=o.on_input,
@nucleartide
nucleartide / verbs.txt
Created January 3, 2019 09:30
interesting verbs
- [ ] swing
- [ ] blow
- [ ] shake whipped cream / screenshake
- [ ] wash dishes
- [ ] cut / chop
- [ ] roll
- [ ] punch
- [ ] blow up
- [ ] cook (by breathing fire)
- [ ] jump