Skip to content

Instantly share code, notes, and snippets.

@MrChickenRocket
MrChickenRocket / astar.lua
Created Jul 31, 2022
Relatively well optimized Astar for luau (uses a kinda clever priority queue to avoid searching the open list for best f)
View astar.lua
local module = {}
local INF = 1/0
function dist ( x1, y1, x2, y2 )
return math.sqrt ( math.pow ( x2 - x1, 2 ) + math.pow ( y2 - y1, 2 ) )
end
function heuristic_cost_estimate ( nodeA, nodeB )
return dist ( nodeA.x, nodeA.y, nodeB.x, nodeB.y ) * 2000
View DeltaCompression.lua
local DeltaTable ={
--[[
This module is for getting the difference between a table and then
being able to merge it back in.
-- Specifically great for networking as it allows us only to send what has changed
This is an independant Module because it has enough parts to it, that it should be
seperated from ADTs and or some sort of "Table" lib. This is abstractly a table differ.
--]]
_VERSION = 2.0
@MrChickenRocket
MrChickenRocket / DetailModule.lua
Created Nov 30, 2021
Detail objects for Roblox. Distant objects get parented to nil.
View DetailModule.lua
-- A lightweight module for hiding "detail" objects that get too far away from the camera
--
-- Usage:
-- Tag objects with Detail_Small and Detail_Big
-- If they get too far from the camera, they get parented to nil
-- (Tries to account for the objects getting deleted or parented around by other processes, results may vary!)
--
-- MCR, 2021