When playing my game, my FPS rates become low and unplayable. I’ve created a Microprofiler dump, but I’m not entirely sure what it means nor how to apply it. If someone could help that’d be great.
Microprofiler dump:
When playing my game, my FPS rates become low and unplayable. I’ve created a Microprofiler dump, but I’m not entirely sure what it means nor how to apply it. If someone could help that’d be great.
Microprofiler dump:
Hey, I’m not sure how to read this. However, I can lend you some other advice for debugging your game.
Have you tried testing in Studio and looking at the Script Performance tab for the client and server? It shows you the percentages each script is running at, if anything is > 3% or so it might be worth checking into.
One other thing, unanchored parts on the server definitely bring down the performance of any game, despite how far away the player is from them. Not sure if that’s relevant in your case, but just something to check for.
Hope this helps.
Do unanchored parts still affect the player when they’re unloaded with streaming enabled?
It shouldn’t, from my understanding all parts out of range with streaming will be completely removed.
Yikes.
Yeah, those scripts are definitely chunking your performance.
I don’t mind looking over the code to those scripts if you want to debug this further.
Both of those scripts are responsible for the E to interact controls. Those scripts are vital and I’m not sure how they contribute to memory that much.
(had to delete scripts for obvious reasons)
Alright so, I noticed a few things off the bat.
EHandler
You don’t need to be using spawn
at all, the code you’re running doesn’t even yield, so I see absolutely no need for that.
EAppearHandler
It probably isn’t a good idea to call :GetDescendants
every tenth of a second, that could very well be chunking on client memory if you have a large number of instances in the game. You could either run that once initially, and update the table every few seconds if you absolutely need to.
Hope this helps
Yikes. I have no idea what happened, but after I removed all the spawn
functions and the GetDescendants
thing, both the studio play test and in-game crashed. When I removed these changes, it was back to normal again. I couldn’t even see what the issue was because it kept crashing.
(had to delete scripts for obvious reasons)
Comment out your .DescendantAdded
event and see if it still crashes.
It fixes it, but I’m not sure how I would change that so it doesn’t crash. I’ve also found that this also uses up quite a bit of memory:
while true do
wait()
for i, v in pairs(workspace:GetDescendants()) do
if v:IsA("Sound") and v.Name == "StereoSound" then
v.Volume = 0
end
end
end
It’s probably because you’re calling :GetDescendants
every 1/30 of a second, approx. That can be very expensive.
Perhaps you could try storing the objects as a dictionary, instead of calling :GetDescendants
again when you really don’t need to. Here’s an example:
local objects = {}
--//When the player spawns in, call GetDescendants once to set up the dictionary.
for i, object in pairs(workspace:GetDescendants()) do
object[object] = object --//Store a new key as the object itself with itself as the value
end
workspace.DescendantAdded:Connect(function(obj)
objects[obj] = obj --//Add or replace existing key in the dictionary with the newly made object
end)
An idea I had, untested but this logic may give you a performance increase. Hope it helps!
In the output it says that it should be a string, not an instance. I’ve tried finding ways around it but I’ve been unsuccessful.
It should work?
Can you post what line of code is giving you the error?
The MicroProfiler Dump is very similar in functionality to the MicroProfiler built into the game client. It’s just that it doesn’t do live tracking of game performance, since it is a dump.
Here’s a small article on how it’s used.
Just tested my logic to make sure I wasn’t feeding you incorrect syntax, and it worked.
Really puzzled by why it’s giving you that error.
Maybe add a print statement on top of that line-
print(type(object))
Seems to have fixed itself. Not sure what happened.