SoundController (client): - Looping engine sound on the car body: pitch 0.7->1.9 tracks speed (curved so low speed feels torquey), volume swells with throttle - Tyre squeal loop faded by lateral slip (velocity along body RightVector) and hard braking from speed; always playing at 0 volume to avoid pops - 3D sounds with rolloff so other players hear cars pass - Asset IDs from safe sources (Roblox Resources engine loop, ProSoundEffects squeal); swap in SOUNDS table after audition Ambience (server): - Atmosphere (purple-grey haze, glare) so neon reads in the air - BloomEffect for neon pop + subtle cool ColorCorrection - Slow ClockTime ping-pong 22:00->03:00 over 10 min: always night, but the sky breathes
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
--!strict
|
||||
--[[
|
||||
Ambience.luau (SERVER)
|
||||
The night-city mood pass (M2). The Rojo project file sets the static
|
||||
Lighting baseline (night, fog); this module adds everything that can't be
|
||||
expressed as plain properties:
|
||||
|
||||
- Atmosphere: dense hazy air that catches the neon glow
|
||||
- Post effects: bloom (neon pop) + subtle cyan-shifted color correction
|
||||
- A giant "moon" disc + low star field for a sky with depth
|
||||
- A slow ambient clock drift (deep night 22:00 -> 03:00 loop) so
|
||||
shadows/sky aren't frozen — the game stays night forever by design,
|
||||
it just breathes.
|
||||
|
||||
All tunables at the top. Runs once at boot; the drift loop is one cheap
|
||||
task.spawn.
|
||||
]]
|
||||
|
||||
local Lighting = game:GetService("Lighting")
|
||||
|
||||
local Ambience = {}
|
||||
|
||||
-- Tunables --------------------------------------------------------------------
|
||||
local ATMOS_DENSITY = 0.35
|
||||
local ATMOS_HAZE = 2.1
|
||||
local BLOOM_INTENSITY = 0.9
|
||||
local BLOOM_THRESHOLD = 1.2
|
||||
local NIGHT_START = 22 -- ClockTime loop range
|
||||
local NIGHT_END = 27 -- 27 == 03:00 next day
|
||||
local NIGHT_LOOP_SECONDS = 600 -- one full drift cycle = 10 minutes
|
||||
|
||||
function Ambience.init()
|
||||
-- Atmosphere -----------------------------------------------------------------
|
||||
local atmosphere = Instance.new("Atmosphere")
|
||||
atmosphere.Density = ATMOS_DENSITY
|
||||
atmosphere.Offset = 0.6
|
||||
atmosphere.Color = Color3.fromRGB(120, 110, 160) -- purple-grey haze
|
||||
atmosphere.Decay = Color3.fromRGB(40, 30, 80)
|
||||
atmosphere.Glare = 0.3
|
||||
atmosphere.Haze = ATMOS_HAZE
|
||||
atmosphere.Parent = Lighting
|
||||
|
||||
-- Post effects ---------------------------------------------------------------
|
||||
local bloom = Instance.new("BloomEffect")
|
||||
bloom.Intensity = BLOOM_INTENSITY
|
||||
bloom.Size = 32
|
||||
bloom.Threshold = BLOOM_THRESHOLD
|
||||
bloom.Parent = Lighting
|
||||
|
||||
local cc = Instance.new("ColorCorrectionEffect")
|
||||
cc.Brightness = 0.02
|
||||
cc.Contrast = 0.08
|
||||
cc.Saturation = 0.12
|
||||
cc.TintColor = Color3.fromRGB(235, 240, 255) -- faint cool shift
|
||||
cc.Parent = Lighting
|
||||
|
||||
-- Slow night drift -----------------------------------------------------------
|
||||
task.spawn(function()
|
||||
while true do
|
||||
local t = (os.clock() % NIGHT_LOOP_SECONDS) / NIGHT_LOOP_SECONDS
|
||||
-- Ping-pong 0->1->0 so the clock sweeps back and forth smoothly
|
||||
-- instead of snapping at the loop point.
|
||||
local pingpong = 1 - math.abs(1 - 2 * t)
|
||||
local clock = NIGHT_START + (NIGHT_END - NIGHT_START) * pingpong
|
||||
Lighting.ClockTime = clock % 24
|
||||
task.wait(2) -- shadows drift gently; no need for per-frame updates
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
return Ambience
|
||||
@@ -23,6 +23,7 @@ local DataManager = require(script.DataManager)
|
||||
local CarManager = require(script.CarManager)
|
||||
local MapBuilder = require(script.MapBuilder)
|
||||
local AntiCheat = require(script.AntiCheat)
|
||||
local Ambience = require(script.Ambience)
|
||||
|
||||
-- 1. Remotes ----------------------------------------------------------------
|
||||
Remotes.init()
|
||||
@@ -44,6 +45,7 @@ AntiCheat.init()
|
||||
|
||||
-- 3. Build the world --------------------------------------------------------
|
||||
MapBuilder.build()
|
||||
Ambience.init()
|
||||
|
||||
-- 4. Player lifecycle: push car id + auto-spawn their car -------------------
|
||||
Players.PlayerAdded:Connect(function(player)
|
||||
|
||||
Reference in New Issue
Block a user