- You can pick up Firefly on ROBLOX here (You can also require it’s ID to stay up-to-date)
- Alternatively, you can download Version 0.3.0 here: Firefly.rbxm (5.2 KB)
- You can watch a demonstration of Firefly in use below
Firefly is a lightweight module designed at reducing the load on rendering performance costs while maintaining a decent client graphics quality setting. This is to say, you can have your client graphics on full while reducing the amount of which is enabled.
For example, you can customise your graphics settings using this module such that you can disable materials, particle emitters, textures, post effects, global shadows, and, the soon to come atmosphere!
Firefly comes pre-installed with a default preset list for you so you don’t have to touch the module at all, but for those of you with more confidence you can adjust the presets to whatever values you desire.
For example, the default preset list will toggle everything listed above off when using the “Min” setting, it will then toggle materials on in the “Low” setting and gradually move it’s way up the list turning more and more features on. You could even remove presets that you do not need, it comes installed with 5 different preset arrangements, these being: Min, Low, Medium, High, and Max.
It is worth noting this does not interfere with the Client’s RenderSettting QualityLevel property settings.
This was developed because I wanted to somewhat untie the connection between QualityLevel and Render Distance. As it stands the Client’s Render Distance is tied with the game’s whole QualityLevel which includes cost-heavy features such as Atmospheres and GlobalShadows, I also decided to throw in extra settings to customise: ParticleEmitters, Materials, and Textures*.
*- Currently Textures just get totally removed when they are toggled off, this might not be optimal for you, feel free to adjust the presets list however necessary.
I designed Firefly to be used in a “Graphics Preset” UI similar to how AAA Games allow preset options for graphics.
Though most AAA games also provide the ability to toggle certain features on or off, Firefly was not initially designed with this in mind, though it is possible to do this in Firefly by running the Toggle
group of methods when needed, for example, you can attach radio buttons to act as individual toggles
Here is a quick demonstration of Firefly being used to control the graphics settings of the game in the form of a “Graphics Preset” UI:
This section is solely used to house the relevant codebase and source documentation for Firefly.
Code
--> Arvorian Industries Firefly 0.3.0
--> Written & Maintained by ShaneSloth
--> Services
local Lighting = game:GetService("Lighting")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Firefly = {
Preset = "Medium",
Loaded = false,
Presets = {
["Min"] = {
Materials = false,
PostEffects = false,
Textures = false,
Atmosphere = false,
Lighting = {
["GlobalShadows"] = false
}
},
["Low"] = {
Materials = true,
PostEffects = false,
Textures = false,
Atmosphere = false,
Lighting = {
["GlobalShadows"] = false
}
},
["Medium"] = {
Materials = true,
PostEffects = true,
Textures = false,
Atmosphere = false,
Lighting = {
["GlobalShadows"] = false
}
},
["High"] = {
Materials = true,
PostEffects = true,
Textures = true,
Atmosphere = false,
Lighting = {
["GlobalShadows"] = true
}
},
["Max"] = {
Materials = true,
PostEffects = true,
Textures = true,
Atmosphere = true,
Lighting = {
["GlobalShadows"] = true
}
}
}
}
Firefly.PartsCollection = { }
Firefly.ParticleEmittersCollection = { }
Firefly.PostEffectsCollection = { }
Firefly.TexturesCollection = { }
--[[
Initialise Firefly, set default preset for client on player join
\code Informs client of Firefly initialisation call and warns it could take time scanning the game
Begins by grabbing the initial run time of Firefly
Scans the workspace and other DataModel containers for relevant Instances
{ Parts, ParticleEmitters, PostEffects, Textures }
Clones the Lighting's current Atmosphere if one exists to the ReplicatedStorage for quick enabling
Initialisation is complete, grab the start time
Inform the client of setup completion and give duration of setup ( Generally 0s )
Allow Firefly operations to run by setting Firefly.Loaded to true
If a preset is given and autoAdjustToPreset is true adjust the client to the new default preset
@param String: preset a string value representing which preset to load the client with ("Min", "Low", etc.)
@param boolean: autoAdjustToPreset a boolean value indicating whether to allow initialisation adjustment
]]
function Firefly:Initialise(preset, autoAdjustToPreset)
-- initialises by collecting all default information
print("Initialising Firefly... This may take some time... Scanning workspace & other containers")
local s = tick()
self:CollectParts()
self:CollectParticleEmitters()
self:CollectPostEffects()
self:CollectTextures()
if Lighting:FindFirstChild("Atmosphere") then
Lighting:FindFirstChild("Atmosphere"):Clone().Parent = ReplicatedStorage
end
local d = tick() - s
print("Finished initialisation! Time taken (s): " .. tostring(math.floor(d)))
self.Loaded = true
if preset and autoAdjustToPreset then
self:AdjustGraphicsQuality(preset)
end
end
--[[
Adjust the client's Graphics Quality setting to a new preset
\code Check if a new preset is given otherwise default to the current preset
Check that the new preset exists within Firefly's preset list
If Firefly is not yet loaded before this operation occurs hang the calling thread --> This should probably be handled better. Coroutines preferred.
Acquire the preset from Firefly's preset list
Using the given preset update the client's toggles.
Set Firefly's in-use preset to the given preset
@param String: newPreset a string value representing the preset to adjust the client to
]]
function Firefly:AdjustGraphicsQuality(newPreset)
newPreset = newPreset or self.Preset
assert(self.Presets[newPreset], "Firefly: The Preset {" .. newPreset .. "} is not a valid preset")
if not self.Loaded then print("Firefly has not finished initialising, awaiting initialisation...") end
repeat wait() until self.Loaded
local presetInformation = self.Presets[newPreset]
self:ToggleMaterials(presetInformation.Materials)
:TogglePostFX(presetInformation.PostEffects)
:ToggleTextures(presetInformation.Textures)
:ToggleAtmosphere(presetInformation.Atmosphere)
:ToggleLighting(presetInformation.Lighting)
self.Preset = newPreset
end
function Firefly:ToggleMaterials(isMaterialsEnabled)
end
function Firefly:TogglePostFX(isPostFXEnabled)
end
function Firefly:ToggleTextures(isTexturesEnabled)
end
function Firefly:ToggleAtmosphere(isAtmosphereEnabled)
end
function Firefly:ToggleLighting(lightingProperties)
end
function Firefly:CollectParts(root)
end
function Firefly:CollectParticleEmitters(root)
end
function Firefly:CollectPostEffects()
end
function Firefly:CollectTextures(root)
end
return Firefly