Graphics Preset Module

  • 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

Information

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:


Limited Codebase & Source Documentation

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

Closing

This is my first Community Resource post so I apologise if this is formatted poorly, though I like to believe it’s presentable and great at conveying what Firefly is and does.

Feedback & Questions are welcome, thank you!

-ShaneSloth

61 Likes

Wow is this awesome! I have been waiting for something like this for a while, now I can finally use high graphics in my game.

3 Likes

Hey, this is great! This is definitely useful for development.

1 Like

Rōblox provides this API endpoint that could be of use for you. I haven’t checked your module’s source code yet - so I don’t know if you’ve already written it in.

I think it’s worth tying Firefly to the client’s SavedQualityLevel because the latter is where I’d expect to adjust that setting anyway.

2 Likes

Hmm I’m not entirely convinced of it’s uses here, nor if it’s a writable property.
The aim with Firefly is to somewhat disconnect heavy-load features such as GlobalShadows & Atmosphere (for lower-end clients) from the QualityLevel set at the client level.

I mainly made this so players at my game could raise their client’s QualityLevel to 10 while removing all of the bloat that comes with it.
The game itself is essentially an auto-duels arena so while making the lobby area aesthetically pleasing is a great idea, some lower-end PCs do suffer frame drops and such turn their QualityLevel down to accommodate for it.
This led to the issue of player’s not being able to see across far stretches of some maps and would have to adjust their QualityLevel again to boost their render distance back up.

I guess for now, Firefly tackles the job of separating render distance from performance-heavy features, which is still in my opinion, a great thing to be doing.

For your particular case-use, I see the sense in that. I’ve only however seen render distances decrease as you go below 9 or 8. You could always try that on a large map, such as these discussed in this post.

1 Like

This is amazing! this is useful for people with low end computers who cant play the game with a good enough fps count, this will for sure help improve player performance in game

1 Like

Update 25/07/2020 @ 02:05 AM BST

Hey everyone, just updating to let you know that I am in the works of re-writing this module to better support toggling. I have been working on writing it into the current module however it is becoming a slight headache to work with. There are a few weird bugs which I have attempted to fix and have not succeeded in patching, don’t worry it hasn’t been updated

So with that said I will create a new post for whatever I decided to name the upgraded version of Firefly, and then accordingly edit this post to reference the upgrade and implore using it over Firefly as I will be deprecating the module after its final update to have compatibility - so developers requiring this module won’t need to update - I hope?

I can’t give an estimate as to when this will be done as I am currently swamped with commissions and work with my studio. Stay tuned! :slight_smile:

This is a fantastic module! This helps my open world game perform SO much better on mobile!

Looking forward to the update!

1 Like

I seem to be having issues… I set the preset to “Min” and when I joined a part kept its material. Am I doing something wrong? Here is a screenshot image

Hey, could you perhaps send me a request on Discord so I can talk you through it? Thank you :smiley:

Will my game lag if I add this it sounds that this reduces lag a little but the script be in consent use

I like this. Makes it very easy for someone to implement a system that gives the user a choice to customize their graphics specifically.
Awesome work :+1:

1 Like

I am trying to use it but it doesn’t seem to want to work.
Here is my ‘activation’ script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Modules = ReplicatedStorage:WaitForChild("Modules")
local Firefly = require(Modules.FireflyMainModule)
local MinButton = script.Parent.Min
local LowButton = script.Parent.Low
local MedButton = script.Parent.Med
local HighButton = script.Parent.High
local MaxButton = script.Parent.Max
Firefly:Initialise("Medium", true) 

MinButton.MouseButton1Click:Connect(function(player)
	Firefly:AdjustGraphicsQuality("Min")
end)

LowButton.MouseButton1Click:Connect(function(player)
	Firefly:AdjustGraphicsQuality("Low")
end)

MedButton.MouseButton1Click:Connect(function(player)
	Firefly:AdjustGraphicsQuality("Med")
end)

HighButton.MouseButton1Click:Connect(function(player)
	Firefly:AdjustGraphicsQuality("High")
end)

MaxButton.MouseButton1Click:Connect(function(player)
	Firefly:AdjustGraphicsQuality("Max")
end)

It doesn’t work for me as well.

Doesn’t work, the bug is on your end for sure. If you’re saying you gonna update it is sure to do that and the version In the script states “0.0.0” but your description states “0.3.0” so you don’t actually update or?

I really need help the module is not working and I’m pretty sure It’s cause It is outdated.

Sorry for the delay, due to Covid I have been away from work/home for the last couple of months and haven’t been able to check or fix any issues.

If I were to make a guess the file download on this post hasn’t been updated but the post itself was and same goes to the roblox model (unsure of this), keeping track of multiple download points and keeping them updated is a tricky one for me.

Furthermore, this module is outdated in general and does not perform how I wish it to, when I eventually get back to my desktop I will be able to dive into it and see if anything can be done or if I will just be deprecating it before starting a new and improved version.

Thank you for the heads up, though, much appreciated!