Tessellation — Modular Animation Kernel for Roblox

Copyright 2025 s3ntin5l

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Overview

Tessellation is a lightweight, high-performance animation kernel for Roblox, designed to handle large numbers of animations reliably by enforcing state coherence and providing intelligent conflict resolution . It streamlines loading, caching, and playback while providing robust debugging, grouping, and advanced playback control.

This kernel abstracts animation track management, automatically handles character respawn, and integrates seamlessly into existing systems.

Key Features

Core Animation Management

  • Deterministic Loading: Automatically loads and caches animation instances from specified folders.
  • Intelligent Caching (LRU): Handles AnimationTrack caching with automatic respawn handling and Least Recently Used (LRU) eviction to limit memory use.
  • State Coherence: Provides reliable animation state tracking across character respawns and Animator recreation.

Advanced Playback Control

  • Flexible Configuration: Set fadeTime, weight, priority, speed, and looped.
  • Priority Conflict Resolution: Configurable strategies (aggressive, conservative, manual) to intelligently resolve animation blending conflicts based on priority.
  • Animation Groups: Named groups for synchronized, multi-animation control, treating them as a single atomic unit.
  • Batch Operations: Play or stop multiple animations or groups with single method calls.

Observability & Debugging

  • Debug Pipeline: Built-in debugging that logs the entire animation lifecycle, including track loads, cache evictions, and errors.
  • Configurable Throttling: Debug events are batched and throttled for minimal performance impact.
  • Kernel Statistics: Real-time tracking of tracks loaded, active tracks, cache size, and error count via kernel:GetStats().

Event System

  • Marker Binding: Simplifies binding functions directly to named animation markers/keyframe events (BindMarker).
  • Global Debug Signals: Subscribe to the kernel’s debug stream for global play/stop/error events.

Performance & Optimization

  • Track Pooling: Efficient reuse of AnimationTrack objects.
  • LRU Cache: Automatically destroys the least recently used tracks when cache limits are reached.
  • Debounced Operations: Prevents excessive reloads during rapid changes (e.g., from character updates).

Usage

Basic Setup
local Tessellation = require(game.ReplicatedStorage.Tessellation)
local folder = game.ReplicatedStorage:WaitForChild("anims")
local player = game.Players.LocalPlayer

-- Create kernel with custom configuration
local kernel = Tessellation.new(folder, player, {
    debugMode = true,
    maxCachedTracks = 30, -- Set LRU cache limit
    priorityStrategy = "aggressive" -- Automatically stop conflicting animations
})

-- Subscribe to the debug event stream for deep monitoring
local unsubscribe = kernel:SubscribeToDebug(function(event)
    if event.type == "ERROR_MISSING_ANIMATION" then
        warn(`[Analytics] Missing animation: {event.animationName}`)
    elseif event.type == "TRACK_PLAY" then
        print(`Playing: {event.animationName} - {event.details}`)
    end
end)
Animation Playback
-- Single animation
kernel:Play("Run")

-- Advanced config
kernel:Play("Walk", {
    fadeTime = 0.3,
    weight = 0.8,
    priority = Enum.AnimationPriority.Movement,
    looped = true,
    -- stopOthers is now handled by the kernel's priorityStrategy
})

-- Stop animation
kernel:Stop("Walk", 0.2)

-- Adjust a playing animation's speed and weight
kernel:Adjust("Walk", 0.5, 0.5) -- Speed = 0.5, Weight = 0.5
Animation Groups
kernel:CreateGroup("movement", {"Walk", "Run"}, {
    priority = Enum.AnimationPriority.Movement,
    fadeTime = 0.2
})

-- Play group: plays all members with the merged config
kernel:PlayGroup("movement")

-- Stop group
kernel:StopGroup("movement", 0.3)
Marker Binding
-- Bind a function to a specific named marker in the animation
kernel:BindMarker("Attack", "HitFrame", function()
    print("Hit registered! Dealing damage now.")
    dealDamage()
end)

-- You can safely call BindMarker multiple times; it manages connections internally.

API Reference

The Tessellation Kernel API is streamlined for robustness and predictability.

Core Controls
kernel:Play(name: string, config: table?) -> AnimationTrack?    -- Play animation with optional configuration
kernel:Stop(name: string, fadeTime: number?) -> ()              -- Stop animation with optional fade
kernel:Adjust(name: string, speed: number?, weight: number?, fade: number?) -> ()  -- Adjust speed/weight of playing track
kernel:IsPlaying(name: string) -> boolean                        -- Check if animation is playing
kernel:StopAll(fadeTime: number?) -> ()                          -- Stop all playing tracks managed by the kernel
Grouping & Events
kernel:CreateGroup(name: string, members: {string}, defaultConfig: table?) -> ()    -- Create animation group
kernel:PlayGroup(name: string, config: table?) -> {[string]: AnimationTrack?}       -- Play animation group
kernel:StopGroup(name: string, fadeTime: number?) -> ()                             -- Stop animation group
kernel:BindMarker(animName: string, markerName: string, callback: () -> ()) -> ()   -- Bind function to a specific animation marker

Configuration Options

Playback Configuration (Used in :Play and :CreateGroup)

Field Type Default Description
fadeTime number 0.2 Crossfade duration in seconds.
weight number 1 Animation blending weight.
speed number 1 Animation playback speed.
priority Enum.AnimationPriority Action Animation priority level.
looped boolean false Whether to loop the animation.
stopOthers boolean DEPRECATED This is now handled entirely by the kernel’s priorityStrategy. Setting this is ignored.

Kernel Configuration (Used in Tessellation.new / :UpdateConfig)

Field Type Default Description
debugMode boolean false Enables the debug event logging system.
maxCachedTracks number 50 Maximum number of AnimationTracks to keep in the LRU cache. 0 for unlimited.
priorityStrategy string "aggressive" Conflict resolution: “aggressive” (stops tracks of lower or same priority), “conservative” (stops only lower priority), “manual” (no auto-stop).
autoRetryLoads boolean true Retries failed AnimationTrack loads once to mitigate temporary issues.
gracefulDegradation boolean true Prevents the kernel from crashing on minor internal errors.

Important Notes

Best Practices

  • Use the Debug Pipeline (:SubscribeToDebug) during development for full visibility into animation lifecycle, caching, and errors.
  • The kernel automatically manages track lifecycles (loading, respawns, cleanup). Do not manually attempt to stop or destroy AnimationTrack objects retrieved from the kernel.
  • The stopOthers field in playback configuration is deprecated. Rely on the priorityStrategy in the kernel configuration for conflict resolution.

Example Implementation

local Tessellation = require(game.ReplicatedStorage.Tessellation)

-- Setup
local player = game.Players.LocalPlayer
local animations = game.ReplicatedStorage.PlayerAnimations

-- Initialize with custom conflict resolution strategy and debug mode enabled
local kernel = Tessellation.new(animations, player, {
    debugMode = true,
    priorityStrategy = "conservative", -- Only stop strictly lower priority tracks
})

-- Subscribe to the debug event stream (Crucial for monitoring kernel activity!)
local unsubscribeDebug = kernel:SubscribeToDebug(function(event)
    print(`[DEBUG {event.severity}] {event.type}: {event.animationName or "N/A"} -> {event.details}`)
    if event.severity == "error" then
        warn("KERNEL ERROR DETECTED")
    end
end)


-- Create movement group
kernel:CreateGroup("movement", {"Walk", "Run", "Sprint"}, {
    priority = Enum.AnimationPriority.Movement,
    fadeTime = 0.15
})

-- Set up combat marker
kernel:BindMarker("Sword_Attack", "Hit", function()
    -- Combat logic happens precisely on the Hit keyframe
    dealDamage()
end)

-- Example usage
kernel:Play("Idle")
-- When 'Run' plays, the debug stream will log the 'TRACK_PLAY' event.
kernel:PlayGroup("movement", {name = "Run"}) 

-- Cleanup when player leaves or module is no longer needed
-- unsubscribeDebug() -- Remember to disconnect the debug subscription if needed!
kernel:Destroy()

Link: Creator Store | GitHub

7 Likes

I’m highly confident both this post and the product advertised is fully AI-generated. There are many signs of this, some of which include the style of writing and layout.

Another slightly less notable sign that I’d like to point out anyways, is the lack of indentation in this specific type declaration in the source code:

export type DebugEventType = 
	"TRACK_LOAD" | "TRACK_PLAY" | "TRACK_STOP" | "TRACK_ADJUST" |
"GROUP_CREATE" | "GROUP_PLAY" | 
"MARKER_BIND" | "MARKER_FIRE" | "MARKER_INVALID" |
"ANIMATOR_CREATE" | "ANIMATOR_LOST" |
"CHARACTER_RESPAWN" | "CLEANUP" | "CACHE_EVICT" |
"ERROR_MISSING_ANIMATION" | "ERROR_LOAD_FAILED" | "ERROR_NO_ANIMATOR" |
"ERROR_INVALID_CONFIG" | "ERROR_MARKER_MISSING"

This indicates that he has pasted the AI-generated code into Roblox Studio’s code editor which has then removed the indentation for whatever reason. This is a common weird behavior of the current Roblox code editor’s auto-formatting.

Anyways, most likely this is some AI-generated slop and my question is just “why?” This is of no importance to the community that deserves real human ingenuity rather than lazy prompt-engineering.

In the case that I’m wrong, I apologize. Although I am very certain at least the post is not human written, which is already a concern.

6 Likes

Why do you call this a kernel?

1 Like

Because it’s the central manager for all animation stuff in one place.

Hello! I understand your concerns, and I appreciate you pointing out the specific details.

To clarify: The core Tessellation module logic and architecture were written by me.

I use AI assistance for documentation and code polishing (I primarily use an AI-powered auto-complete in VSCode, not full generation).

I apologize if the heavy use of AI for documentation & polishing gave the wrong impression

Thanks for the feedback.

1 Like

Thanks for clarifying!

I’d highly recommend you write posts, advertisements and documentation at least partially yourself. You have to communicate to your users, rather than let the AI do that job all by itself. Don’t forget that the more you do yourself, the more rewarding it is.

Also I fully understand being proud of your work and wanting to highlight the copyright and license—but I’d highly suggest moving that further down in your post, at least after the introduction, or just keeping it in the source code. Make sure you make the introduction clear, concise, and put it first. Always read it yourself to check whether it’s good and easy for people to read.

Anyway, sounds cool! I’ll be sure to check it out later.
Good luck then. :slight_smile:

1 Like