Skip to content

Instantly share code, notes, and snippets.

View andrew-raphael-lukasik's full-sized avatar
🏴‍☠️

Andrew Raphael Lukasik andrew-raphael-lukasik

🏴‍☠️
View GitHub Profile
@andrew-raphael-lukasik
andrew-raphael-lukasik / .FightCube.md
Last active September 12, 2023 11:31
Run thousands of basic² ai agents without and with Unity ECS `1.0.11`

Run thousands of basic² ai agents without and with Unity ECS 1.0.11.

No Unity ECS

  • FightCube.cs

Unity ECS

  • FightCubeAuthoring.cs
  • GameStateStartedAuthoring.cs
@andrew-raphael-lukasik
andrew-raphael-lukasik / .sand.c.md
Last active October 16, 2023 17:23
most basic sand sim you can create with Raylib 4.0

most basic sand sim you can create with Raylib 4.0

b2iqtgf9ejyhwr6krw5ytwsjty54yhr

@andrew-raphael-lukasik
andrew-raphael-lukasik / .ObjFileFormatVertexColorImporter.cs.md
Last active April 24, 2024 10:13
OBJ file format vertex color importer for Unity

(Unity) vertex color importer for MeshLab's OBJ files

@andrew-raphael-lukasik
andrew-raphael-lukasik / MirrorThisTransformInEcsWorld.cs
Last active May 31, 2023 16:34
Mirror hundreds of `Transform`s in an ECS `World` easily. Uses `IJobParallelForTransform`/`TransformAccessArray`
// src* https://gist.github.com/andrew-raphael-lukasik/530e90ee27cd7a9be47351e03b2634d1
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Jobs;
using Unity.Entities;
using Unity.Transforms;
using Unity.Rendering;
using Unity.Collections;
using Unity.Mathematics;
@andrew-raphael-lukasik
andrew-raphael-lukasik / .GLDraw.cs.md
Last active September 28, 2023 18:47
`GLDraw.cs` tiny open-source rendering system to draw debug shapes with. Target camera is *not* restricted to `SceneView` and unlike `Gizmos` this will work in !DEBUG builds.

Rendering system to draw debug shapes with.

Target camera is not restricted to SceneView and unlike Gizmos this will work in !DEBUG builds.

@andrew-raphael-lukasik
andrew-raphael-lukasik / .write_to_managed_array_from_Burst-compiled_IJob.md
Last active October 18, 2023 18:21
Write to managed arrays from an `IJob` ! A collections of useful utilities when working with `Unity.Jobs`.

👉write to managed array from a Burst-compiled IJob

Highlights:

  • cast T[] to NativeArray<T>
  • schedule jobs that read/write to managed arrays
  • pointer safety assertion that prevent crashes and data corruption

more info in the first comment under the source code

@andrew-raphael-lukasik
andrew-raphael-lukasik / .SunController.cs.md
Last active September 28, 2023 18:49
basic sun controller script

basic sun controller

@andrew-raphael-lukasik
andrew-raphael-lukasik / .RandomnessAndIJobParallelFor.cs.md
Last active September 28, 2023 18:50
lets run some test and figure out how to generate useful random numbers in a `Unity.Collections.IJobParallelFor` run

Test to figure out how to generate useful random numbers in a Unity.Collections.IJobParallelFor

seed: 46473452

(reference) new Random( Seed * (uint)( index + 1 ) ).NextInt() new Random( Seed + (uint)( index * Results.Length ) ).NextInt() Random.CreateFromIndex( Seed ^ (uint)index ).NextInt() new Random( Seed * Random.CreateFromIndex( (uint)index ).NextUInt() ).NextInt() new Random( Seed * Random.CreateFromIndex( (uint)index ).state ).NextInt() new Random( new Random( Seed * Random.CreateFromIndex( (uint)index ).NextUInt() ).NextUInt() ).NextInt()
-37321856 -37321856 -37321856 501644091 673738796 2057345775 -477813603
-1687388613 2073921280 -97452083 -1206518005 327600797 -2026729932 -1871146698
-2118002258 -421164753 -83806521 -530221473 -1985565071 1850284329 -781137724
-462119340 2000358945 -128750088 -2079259769 -20976
@andrew-raphael-lukasik
andrew-raphael-lukasik / .UniversalTurretComponent.cs.md
Last active September 29, 2023 17:26
universal turret component

Universal turret component

@andrew-raphael-lukasik
andrew-raphael-lukasik / .Planted.cs.md
Last active November 12, 2023 20:16
Example of a grid system built with with ISystemStateComponentData

unity dots 2d grid system ISystemStateComponentData color cross pollination

written for entities 0.5