Polish arena effects, audio and diagnostics

This commit is contained in:
Leshyi committed 2026-11-30 01:26:42 +05:00
1 parent 2774e625c1
commit 16a359d4af
28 files changed
+512 -257

No files matched your search

+112
View File
@@ -0,0 +1,112 @@
--!strict
local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local Input = game:GetService("UserInputService")
local Config = require(RS.Hunter.EffectsConfig)
local Budget = require(RS.Hunter.EffectsBudget)
local profile = Budget.profile(Input.TouchEnabled, Input.KeyboardEnabled)
local localPlayer = Players.LocalPlayer
local root = Instance.new("Folder")
root.Name = "HunterClientVfx"
root.Parent = workspace
type Slot = {part: Part, tween: Tween?, effect: ParticleEmitter?}
local rotation = CFrame.Angles(0, 0, math.pi / 2)
local function pool(name: string, size: number, particles: boolean): () -> Slot
local slots: {Slot} = {}
local cursor = 0
for i = 1, size do
local part = Instance.new("Part")
part.Name = name
part.Anchored, part.CanCollide, part.CanQuery, part.CanTouch = true, false, false, false
part.CastShadow = false
part.Shape, part.Material, part.Transparency = Enum.PartType.Cylinder, Enum.Material.Neon, 1
part.Size = Vector3.one
part.Parent = root
local emitter: ParticleEmitter? = nil
if particles then
emitter = Instance.new("ParticleEmitter")
emitter.Texture = "rbxasset://textures/particles/sparkles_main.dds"
emitter.Rate = 0
emitter.Lifetime = NumberRange.new(.3, .65)
emitter.Speed = NumberRange.new(9, 24)
emitter.SpreadAngle = Vector2.new(145, 145)
emitter.Size = NumberSequence.new(.42, 0)
emitter.LightEmission, emitter.LightInfluence = 1, 0
emitter.Parent = part
end
slots[i] = {part = part, effect = emitter, tween = nil}
end
return function()
cursor = cursor % size + 1
local slot = slots[cursor]
if slot.tween then slot.tween:Cancel(); slot.tween = nil end
if slot.effect then slot.effect:Clear() end
slot.part.Transparency = 1
return slot
end
end
local rings = pool("Ring", profile.worldSlots, false)
local columns = pool("Column", profile.worldSlots, false)
local bursts = pool("Burst", math.min(profile.burstSlots, profile.maxEmitters), true)
local gui = Instance.new("ScreenGui")
gui.Name = "ArenaScreenVfx"
gui.DisplayOrder = 7
gui.ResetOnSpawn = false
gui.Parent = localPlayer:WaitForChild("PlayerGui")
local flash = Instance.new("Frame")
flash.BorderSizePixel = 0
flash.Size = UDim2.fromScale(1, 1)
flash.BackgroundTransparency = 1
flash.Parent = gui
local flashTween: Tween? = nil
local ArenaVfx = {}
local function animate(slot: Slot, seconds: number, props: {[string]: any})
local tween = TweenService:Create(slot.part, TweenInfo.new(math.clamp(seconds, .05, .6), Enum.EasingStyle.Quad, Enum.EasingDirection.Out), props)
slot.tween = tween
tween:Play()
end
function ArenaVfx.ring(at: Vector3, radius: number, color: Color3, seconds: number, inward: boolean?)
local slot = rings()
slot.part.CFrame = CFrame.new(at + Vector3.yAxis * .24) * rotation
local diameter = radius * 2
local start = if inward then diameter else diameter * .55
local finish = if inward then .1 else diameter * 1.6
slot.part.Size = Vector3.new(.1, start, start)
slot.part.Color, slot.part.Transparency = color, .7
animate(slot, seconds, {Size = Vector3.new(.1, finish, finish), Transparency = 1})
end
function ArenaVfx.burst(at: Vector3, color: Color3, count: number, smoke: boolean?)
local amount = Budget.particles(count, profile.scale)
if amount == 0 then return end
local slot = bursts()
slot.part.CFrame = CFrame.new(at + Vector3.yAxis)
local emitter = assert(slot.effect)
emitter.Texture = if smoke then "rbxasset://textures/particles/smoke_main.dds" else "rbxasset://textures/particles/sparkles_main.dds"
emitter.Size = if smoke then NumberSequence.new(2, 8) else NumberSequence.new(.42, 0)
emitter.Transparency = if smoke then NumberSequence.new(.35, 1) else NumberSequence.new(.06, 1)
emitter.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
emitter:Emit(amount)
end
function ArenaVfx.column(at: Vector3, color: Color3)
local slot = columns()
slot.part.CFrame = CFrame.new(at + Vector3.yAxis) * rotation
slot.part.Size = Vector3.new(1, 3, 3)
slot.part.Color, slot.part.Transparency = color, .72
animate(slot, Config.FeedbackSeconds, {CFrame = CFrame.new(at + Vector3.yAxis * 22) * rotation,
Size = Vector3.new(44, 4, 4), Transparency = 1})
end
function ArenaVfx.flash(color: Color3)
if flashTween then flashTween:Cancel() end
flash.BackgroundColor3, flash.BackgroundTransparency = color, .93
flashTween = TweenService:Create(flash, TweenInfo.new(.32), {BackgroundTransparency = 1})
flashTween:Play()
end
return ArenaVfx
@@ -189,6 +189,7 @@ local function update()
elseif stage == "Live" or stage == "FinalPush" then
if final then
showBanner(Strings.round.final, Strings.round.finalPush[id] or "", now + Config.finalBannerSeconds)
Sounds.sound("FinalPush")
elseif oldStage == "Countdown" and wasInArena then
showBanner(Strings.round.fight, "", now + Config.startBannerSeconds)
Sounds.sound("RoundStart")
+3 -1
View File
@@ -4,6 +4,8 @@ local rs = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local UI = require(rs:WaitForChild("HunterUI") :: ModuleScript)
local Sounds = require(rs:WaitForChild("SniperEffects") :: ModuleScript)
local Input = game:GetService("UserInputService")
local mobile = Input.TouchEnabled and not Input.KeyboardEnabled
local Config = require(rs.CitadelAssaultConfig)
local Strings = require(rs.Hunter.Strings)
local Hints = require(rs.Hunter.Hints)
@@ -114,7 +116,7 @@ local function update()
})
if pending then table.insert(candidates, pending); pending = nil end
local chosen = if Config.HintsEnabled then Hints.pick(hints, candidates, workspace:GetServerTimeNow()) else nil
pg:SetAttribute("SiegeHint", if chosen then chosen.text else nil)
pg:SetAttribute("SiegeHint", if chosen then (if mobile then Hints.compact(chosen.text) else chosen.text) else nil)
if zone == "Inside" and previousZone ~= zone then Sounds.sound("SiegeEnter") end
if zone == "Inside" and status == "Capturing" and attacking then
+68 -19
View File
@@ -9,6 +9,10 @@ local S = require(rs.Hunter.Strings)
local Hints = require(rs.Hunter.Hints)
local Kinds = require(rs.Hunter.EventKinds)
local Router = require(script.Parent.EventRouter)
local Vfx = require(script.Parent.ArenaVfx)
local Config = require(rs.Hunter.EffectsConfig)
local Input = game:GetService("UserInputService")
local mobile = Input.TouchEnabled and not Input.KeyboardEnabled
local player = Players.LocalPlayer
local pg = player:WaitForChild("PlayerGui")
@@ -25,13 +29,6 @@ local title = UI.label(banner,"Title","",UDim2.fromScale(.02,0),UDim2.fromScale(
title.FontFace = UI.Display
banner.Visible = false
local wave = Instance.new("Part")
wave.Name = "LocalObjectiveWave"
wave.Shape, wave.Material = Enum.PartType.Cylinder, Enum.Material.Neon
wave.Anchored, wave.CanCollide, wave.CanTouch, wave.CanQuery = true, false, false, false
wave.Transparency = 1
wave.Parent = workspace
local effect: Tween? = nil
local pending: Hints.Hint? = nil
local activeMode: string? = nil
local provider: any = nil
@@ -43,19 +40,53 @@ local function tint(side: string?): Color3
end
local function showWave(at: Vector3, color: Color3)
if effect then effect:Cancel() end
wave.CFrame = CFrame.new(at + Vector3.yAxis*.3) * CFrame.Angles(0, 0, math.pi/2)
wave.Size = Vector3.new(.1,12,12)
wave.Color, wave.Transparency = color, .64
effect = TweenService:Create(wave,TweenInfo.new(.5,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),
{Size=Vector3.new(.1,42,42),Transparency=1})
effect:Play()
Vfx.ring(at, 18, color, Config.FeedbackSeconds)
end
local lastFlagAura = 0
local roleColumnAt = 0
local bannerScale = Instance.new("UIScale", banner)
local bannerTween: Tween? = nil
local function adjustScale() bannerScale.Scale = UI.combatScale(gui) end
local resize = gui:GetPropertyChangedSignal("AbsoluteSize"):Connect(adjustScale)
adjustScale()
banner:GetPropertyChangedSignal("Visible"):Connect(function()
if bannerTween then bannerTween:Cancel() end
if not banner.Visible then return end
banner.Position = UDim2.fromScale(.5, .365)
bannerTween = TweenService:Create(banner, TweenInfo.new(Config.BannerMotionSeconds, Enum.EasingStyle.Quart), {Position = UDim2.fromScale(.5, .34)})
bannerTween:Play()
end)
local function event(kind: string, p: any)
if player:GetAttribute("InArena") ~= true or match:GetAttribute("Phase") ~= "Round" then return end
local id = match:GetAttribute("Ruleset")
local tone = tint(p.side)
local at = p.at
if typeof(at) == "Vector3" then
if kind == Kinds.ZoneCaptured and id == "HotPoint" then
Vfx.ring(at, 18, tone, Config.FeedbackSeconds, true)
Vfx.burst(at, tone, 30, true)
elseif kind == Kinds.ZoneCaptured and id == "Siege" then
Vfx.ring(at, 11, tone, Config.FeedbackSeconds)
Vfx.burst(at, tone, 24)
Vfx.flash(UI.Ink)
elseif kind == Kinds.ZoneStarted and id == "Siege" then
Vfx.column(at, UI.Gold)
elseif kind == Kinds.ZoneContested then
Vfx.ring(at, if id == "Siege" then 11 else 18, Config.Danger, .35)
elseif kind == Kinds.FlagDropped or kind == Kinds.FlagReturned or kind == Kinds.FlagScored or kind == Kinds.TokensBanked then
Vfx.burst(at, tone, 16)
elseif kind == Kinds.TokenDropped then
Vfx.burst(at, UI.Gold, 12)
end
end
if kind == Kinds.AllObjectivesTaken then Sounds.sound("AllTaken") end
if kind == Kinds.RoleSwap then Sounds.sound("RoleSwap") end
if kind == Kinds.FlagPicked then Sounds.sound("FlagPicked") end
if kind == Kinds.TokenPicked then Sounds.sound("TokenPick") end
if kind == Kinds.FlagScored then Sounds.sound("FlagScored") end
if kind == Kinds.TokensBanked and p.userId == player.UserId then Sounds.sound("TokensBanked") end
if id == "CaptureFlag" and (kind == Kinds.FlagPicked or kind == Kinds.FlagScored) then
contour:SetAttribute("Accent", tone)
title.Text = if kind == Kinds.FlagScored then S.flagHints.scored
@@ -76,7 +107,7 @@ local function event(kind: string, p: any)
bannerUntil=now+2.5
end
if kind==Kinds.LeaderDown then
Sounds.sound("HotPointCaptured")
Sounds.sound("LeaderDown")
if typeof(p.at)=="Vector3" then showWave(p.at,tone) end
end
end
@@ -87,7 +118,7 @@ local function event(kind: string, p: any)
title.Text=if kind == Kinds.MiniRoundStarted then string.format(copy.begin,p.index or 1,blue,orange)
elseif not p.side then copy.draw else string.format(copy.win,S.team(p.side),math.max(blue,orange),math.min(blue,orange))
bannerUntil=workspace:GetServerTimeNow()+2.8
Sounds.sound(if kind==Kinds.MiniRoundStarted then "RoundStart" else "HotPointCaptured")
Sounds.sound(if kind==Kinds.MiniRoundStarted then "MiniRoundStart" else "ZoneCaptured")
end
if id == "TrophyHunt" and p.userId == player.UserId then
if kind == Kinds.TokensBanked then
@@ -121,6 +152,24 @@ local heartbeat = RunService.Heartbeat:Connect(function(dt)
local now = workspace:GetServerTimeNow()
local mode = match:GetAttribute("Ruleset")
local playing = player:GetAttribute("InArena") == true and match:GetAttribute("Phase")=="Round"
if playing and mode == "CaptureFlag" and now - lastFlagAura >= .8 and match:GetAttribute("FlagCarrierSide") == nil then
local at = match:GetAttribute("FlagPosition")
if typeof(at) == "Vector3" then
Vfx.burst(at, UI.Gold, 14)
lastFlagAura = now
end
end
if playing and mode == "Siege" and now - roleColumnAt >= .75 then
local data = match:FindFirstChild("CitadelMatchState")
local at = data and data:GetAttribute("Point")
if data and typeof(at) == "Vector3" and data:GetAttribute("Phase") ~= "RoleSwap" then
local status = data:GetAttribute("Status")
local hue = if status == "Contested" then Config.Danger elseif status == "Idle" then UI.Gold
elseif status == "Decaying" then UI.Muted else tint(data:GetAttribute("Attacker"))
Vfx.column(at, hue)
roleColumnAt = now
end
end
if not playing or typeof(mode)~="string" or mode=="Siege" then
activeMode, provider, pending, bannerUntil = nil,nil,nil,0
pg:SetAttribute("ModeHint",nil)
@@ -135,14 +184,14 @@ local heartbeat = RunService.Heartbeat:Connect(function(dt)
local candidates = if provider then provider.candidates(match,player) else {}
if pending then table.insert(candidates,pending);pending=nil end
local hint = Hints.pick(selection,candidates,now)
pg:SetAttribute("ModeHint",if hint then hint.text else nil)
pg:SetAttribute("ModeHint",if hint then (if mobile then Hints.compact(hint.text) else hint.text) else nil)
local results = pg:FindFirstChild("ArenaResults")
banner.Visible = now<bannerUntil and pg:GetAttribute("HunterVoting")~=true and (not results or results:GetAttribute("LiveScoreboardOpen")~=true)
end)
script.Destroying:Once(function()
heartbeat:Disconnect()
for _, remove in subscriptions do remove() end
if effect then effect:Cancel() end
wave:Destroy()
resize:Disconnect()
if bannerTween then bannerTween:Cancel() end
gui:Destroy()
end)
+22 -2
View File
@@ -11,8 +11,8 @@ local match=rs:WaitForChild("ArenaRound"):WaitForChild("Procedural")
local gui=Instance.new("ScreenGui")
gui.Name,gui.DisplayOrder,gui.ResetOnSpawn="TrophyCounter",23,false
gui.Parent=player:WaitForChild("PlayerGui")
local plate=UI.plate(gui,"Coins",UDim2.new(1,-16,1,-80),UDim2.fromOffset(106,48),UI.Gold)
plate.AnchorPoint=Vector2.new(1,1)
local plate=UI.plate(gui,"Coins",UDim2.new(.5,0,1,-85),UDim2.fromOffset(106,48),UI.Gold)
plate.AnchorPoint=Vector2.new(.5,1)
local art=UI.element("GoldCoin",plate,UDim2.fromOffset(6,4),UDim2.fromOffset(40,40)) :: Frame
local rig=UI.bindCoin(art)
local label=UI.label(plate,"Count","×0",UDim2.fromOffset(47,0),UDim2.fromOffset(52,48),24,UI.Gold)
@@ -35,7 +35,24 @@ local function update()
end
local connections={player:GetAttributeChangedSignal("ArenaTokens"):Connect(update),player:GetAttributeChangedSignal("InArena"):Connect(update),
match:GetAttributeChangedSignal("Ruleset"):Connect(update),match:GetAttributeChangedSignal("Phase"):Connect(update)}
local tokens: {[BasePart]: boolean} = {}
local arena = workspace:WaitForChild("ProceduralArena")
local function add(item: Instance)
if item:IsA("BasePart") and item.Name == "Tokens" then tokens[item] = true end
end
for _, item in arena:GetDescendants() do add(item) end
local created = arena.DescendantAdded:Connect(add)
local removed = arena.DescendantRemoving:Connect(function(item)
if item:IsA("BasePart") then tokens[item] = nil end
end)
local draw=RunService.RenderStepped:Connect(function()
local now = workspace:GetServerTimeNow()
for token in tokens do
local deadline = token:GetAttribute("TokenExpiresAt")
local flashSeconds = token:GetAttribute("TokenFlashSeconds")
local flashing = typeof(deadline) == "number" and typeof(flashSeconds) == "number" and deadline - now <= flashSeconds
token.LocalTransparencyModifier = if flashing then .32 + .26 * math.sin(now * math.pi * 2 / .76) else 0
end
if not gui.Enabled then return end
local t=os.clock()
UI.spinCoin(rig,t*2,math.max(0,math.cos(t*2))*.55,t%1)
@@ -70,6 +87,9 @@ end)
update()
script.Destroying:Once(function()
draw:Disconnect()
created:Disconnect()
removed:Disconnect()
for token in tokens do token.LocalTransparencyModifier = 0 end
for _, cn in connections do cn:Disconnect() end
off()
for _, coin in pool do
+53
View File
@@ -0,0 +1,53 @@
--!strict
local RS = game:GetService("ReplicatedStorage")
local Config = require(RS.Hunter.EffectsConfig)
if not Config.Debug then return end
local Players = game:GetService("Players")
local UI = require(RS:WaitForChild("HunterUI") :: ModuleScript)
local player = Players.LocalPlayer
local match = RS:WaitForChild("ArenaRound"):WaitForChild("Procedural")
local gui = Instance.new("ScreenGui")
gui.Name = "ArenaZoneDebug"
gui.ResetOnSpawn = false
gui.Parent = player:WaitForChild("PlayerGui")
local label = UI.label(gui, "Metrics", "", UDim2.new(.5, -180, 0, 10), UDim2.fromOffset(360, 25), 15, UI.Gold)
local function part(name: string): Part
local p = Instance.new("Part")
p.Name = name
p.Transparency = 1
p.Anchored, p.CanCollide, p.CanTouch, p.CanQuery = true, false, false, false
p.Parent = workspace
return p
end
local line, bounds = part("DebugSight"), part("DebugRadius")
bounds.Shape = Enum.PartType.Cylinder
local running = true
task.spawn(function()
while running do
local siege = match:FindFirstChild("CitadelMatchState")
local position = if siege then siege:GetAttribute("Point") else match:GetAttribute("HotPointPosition")
local root = player.Character and player.Character.PrimaryPart
label.Text = string.format("Ray %d / %d · Events/s %d · %s", match:GetAttribute("DebugRays") or 0,
match:GetAttribute("DebugFighters") or 0, match:GetAttribute("DebugEvents") or 0, player:GetAttribute("CitadelZone") or "—")
if root and typeof(position) == "Vector3" then
local r = if siege then siege:GetAttribute("Radius") or 11 else 18
bounds.Size = Vector3.new(.12,r*2,r*2)
bounds.CFrame = CFrame.new(position + Vector3.yAxis * .1) * CFrame.Angles(0,0,math.pi/2)
bounds.Color, bounds.Transparency = UI.Gold, .82
local target = position + Vector3.yAxis * 2
line.CFrame = CFrame.lookAt((root.Position + target) / 2,target)
line.Size = Vector3.new(.07,.07,(root.Position-target).Magnitude)
line.Color = if player:GetAttribute("CitadelZone") == "Blocked" then Config.Danger else UI.Mint
line.Transparency = .3
else
bounds.Transparency, line.Transparency = 1, 1
end
task.wait(.2)
end
end)
script.Destroying:Once(function()
running = false
line:Destroy()
bounds:Destroy()
gui:Destroy()
end)