215

SCP:R | Compound 0

I've worked on the roblox SCPF genre for 7+ years now, starting from tinkering with basic toolbox models to making full-fledged games.

Compound 0

Compound 0 is a passion project of mine that I started with an alternate view of the SCP Genre. A quick summary is that it's an alternate timeline where the SCP Foundation's last surviving foundation was moved to the moon titan, with unknown SCPs stored by Site-0 before the Earth exploded.

  • Custom Entities
  • Extreme optimization with tweens, removal of memory leaks, etc.

Utilizing a technique I learned from Suphi Kaner, I implemented a drastic performance increase, while making tweened parts (especially doors) extremely smooth.

Server Module

local module = {}
 
local event = game.ReplicatedStorage.LocalTween
local threads = {}
 
local function TweenEnded(instance, properties)
	threads[instance] = nil
	for index, property in properties do instance[index] = property end
end
 
module.Tween = function(instance, tweenInfo, properties)
	if threads[instance] ~= nil then task.cancel(threads[instance]) threads[instance] = nil end
	event:FireAllClients(instance, tweenInfo, properties)
	if tweenInfo[5] == true then return end
	local repeatCount = tweenInfo[4] or 0
	if repeatCount < 0 then return end
	local delayTime = tweenInfo[6] or 0
	local tweenTime = tweenInfo[1] or 1
	
	threads[instance] = task.delay((delayTime + tweenTime) * (repeatCount + 1), TweenEnded, instance, properties)
	
end
 
return module

Localscript

local event = game.ReplicatedStorage:WaitForChild("LocalTween")
local TweenService = game:GetService("TweenService")
 
event.OnClientEvent:Connect(function(instance, tweenInfo, properties)
	TweenService:Create(instance, TweenInfo.new(table.unpack(tweenInfo)), properties):Play()
end)

This one change in tweens singlehandedly saved up to 50kb/s in my game while doors were moving. It fully syncs up with the server and client, and uses very little network data.

This is because of how tweening on the server works. Every single "frame" in the tween, it sends all the data to the client each time. With localtween, you're able to send the tween data once.

Custom Entities

So far, I have programmed 5 fully custom entities from scratch, in the span of a day. These include:

  • "The Eye" - Gives special visual properties
  • "Spike" - rolls around to the nearest players and kills them (some secret properties)
  • "The Lever" - A lever with a ton of random properties
  • "The Machine" - Similar to 914, but grants special health properties
  • "The Bomb" - A bomb that rolls to the nearest player that's not the player who threw it & blows up