Back to projects
Gameplay Framework

Deterministic Melee Combat Framework

Role: Gameplay Programmer
Timeline: Nov 2024 - Jan 2025

Code Preview

M1Service.luaufile preview
luau
1local Players = game:GetService("Players")
2local ReplicatedStorage = game:GetService("ReplicatedStorage")
3local RunService = game:GetService("RunService")
4local Workspace = game:GetService("Workspace")
5
6local CombatConfig = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("Config"):WaitForChild("CombatConfig"))
7local HitboxUtils = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("Utils"):WaitForChild("HitboxUtils"))
8
9local DamageService = require(script.Parent:WaitForChild("DamageService"))
10local StateService = require(script.Parent:WaitForChild("StateService"))
11
12local M1Service = {}
13
14local VALID_FINISHER_TYPES = {
15 Normal = true,
16 Uppercut = true,
17 Downslam = true,
18}
19
20local GROUND_RAYCAST_DISTANCE = 3.5

Overview

A responsive melee combat framework built around predictable kinematics, directional hit detection, and combo chaining. Handled through an explicit Finite State Machine so attacks, dashes, and parries transition cleanly without animation cancellation bugs or phantom hits.

Stack

LuauRojoPromisesFSMRaycastingVector Math

The Hard Part

Keeping hit detection reliable and preventing movement glitches in high-latency multiplayer matches.

How It Was Handled

Implemented server-authoritative hit checks with directional cones, replaced default physics impulses with custom momentum vectors, and drove all combo transitions through an explicit FSM.