Skip to content

Instantly share code, notes, and snippets.

View magicoal-nerb's full-sized avatar
💭
leelee,e

magical_noob magicoal-nerb

💭
leelee,e
View GitHub Profile
@magicoal-nerb
magicoal-nerb / PriorityQueue.luau
Created July 25, 2025 06:31
priority queue i guess
--!strict
-- PriorityQueue.lua
-- me when the queue is my priority
-- also made with lectures from mit ocw
-- magicoal_nerb/poopbarrel
local PriorityQueue = {}
PriorityQueue.__index = PriorityQueue
@magicoal-nerb
magicoal-nerb / Avl.luau
Last active July 25, 2025 06:31
avl tree
--!strict
-- AVL Tree implementations based on the mit ocw lecture videos
-- poopbarrel/magicoal_nerb :^)
local Avl = {}
Avl.__index = Avl
export type AvlNode<T> = {
data: T,
@magicoal-nerb
magicoal-nerb / Stack.lua
Created July 21, 2025 03:39
stack in luajit
-- Stack.lua
-- Last in, first out
-- poopbarrel/magicoal_nerb :^)
local Stack = {}
Stack.__index = Stack;
function Stack.new(capacityPow)
local mask = bit.lshift(1, capacityPow) - 1
-- create an array beforehand so lua doesn't
@magicoal-nerb
magicoal-nerb / Xml.lua
Last active July 21, 2025 03:42
xml parser in luajit
-- Xml.lua
-- Parses xml files
-- poopbarrel/magicoal_nerb :^)
-- This parser makes a few assumptions about our data:
-- * element tags are not separated by whitespace
-- * no comments
local Stack = require("Stack")
local ffi = require("ffi")
@magicoal-nerb
magicoal-nerb / Chunk.luau
Created July 21, 2025 03:20
binary greedy mesher in luau
--!strict
--!native
-- Chunk.luau
-- Uses a binary greedy mesher to chunk
-- everything together.
-- poopbarrel/magicoal_nerb
local CHUNK_FACES: { Vector3 } = {
Vector3.xAxis,
@magicoal-nerb
magicoal-nerb / quakec-bhop-rbx.luau
Last active July 20, 2025 10:02
really simple quake movement in roblx
--!strict
-- poopbarrel/magical_noob
-- @submodule quakec
-- @description another quake movement reimplementation ig
-- Physics
local XZ: Vector3 = Vector3.new(1.0, 0.0, 1.0)
local CAPSULE_FLOOR_ANGLE: number = 0.7
-- pprint.lua
-- suprisingly fast for being a non-tail call optimized
-- pretty printer. huh neat
-- poopbarrel/magicoal_nerb :^)
local function pprintHelper(buff, value, depth)
-- >_>
local t = type(value)
if t == "string" then
-- string
-- Average stack based JSON parser i guess
local LEX_CLASSIFIER = {
8, 8, 8, 8, 8, 8, 8, 8, 8, 40, 40, 40, 40, 40, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 160, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 66, 16, 16, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16, 16, 65, 65, 65, 65, 65,
65, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 16, 16, 16, 16, 16, 16, 66, 66, 66, 66, 66, 66, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16,
8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
local API_DUMP_URL = "https://raw.githubusercontent.com/MaximumADHD/Roblox-Client-Tracker/roblox/API-Dump.txt";
local HttpService = game:GetService("HttpService");
local Reflection = {};
Reflection.__index = Reflection;
local function reflQuery(name)
return function(self, className)
local root = className;
local output = {};
--[[
This mesher only handles 16x16x16 chunks!
Uses a more optimal approach towards creating
chunks. Checks plane intersections of the chunk
for greedy meshing.
This type of plane-intersection greedy meshing is
useful for fixing certain problems w/ voxel based
greedy meshing, where transparent objects may be
see through.