I’m not entirely sure how to ask this, so I’ll just be blunt about it. I’ve noticed in a few games, specifically games that use and delete a lot of parts, that my FPS begins to drop over time as I play. Rejoining the game seems to fix this issue until it occurs again. My theory is that these deleted parts are being stored in memory and never being cleaned out, but I feel like something like that would be managed right? I came across something called Garbage Collection, not sure if that has anything to do with it.
I guess what I’m trying to ask is, what could be causing this drop in FPS as I play and how could it be fixed?
I think if there is a massive deletion of parts, it would cause some lag if it is being destroyed by the server since that will replicate to all clients.
Probably because there are many connections that are not disconnected, causing an excess of memory buildup overtime. There are many other factors to consider, too. Are you deleting things? Using variables properly?
Replying you your question below:
Deleted objects have all connections associated with them disconnected.
In the particular game that I’ve been playing, attacks have hit boxes. I’m assuming that those touch events are never being disconnected after deletion then?
Anything else that it could be? I also noticed that anything that’s destroyed can still be referenced. It seems to me that the only thing destroying does is lock the parent property to nil, although it’s good to know that it also disconnects events automatically.
I doubt it, but is there any separate way to clear up memory? Perhaps a way to collect all events or something and disconnect them that way? Kind of a vague thing, but I know that there are other types of collections.
Thats why I said it could be a memory leak, we don’t know yet.
Memory leaks can happen in many ways, connections can be one of them.
Only way to “clear up” memory is to fix the memory leak by disconnecting unused connections.
I think effects are done client side, triggered by an event? But I’m not entirely sure. But I do know that there are often a lot of effects that don’t go away all of the time. However, removing them doesn’t seem to improve performance at all.
If things are being done by the client, then its the hosts job to do it. If there has to be a lot done, for example many parts being created and destroyed, it can hammer the CPU pretty hard. Lowering the FPS.
Worth a shot then, I suppose. I have no idea what else would cause these leaks. Rhythm Track also does almost everything client-side, including spawning the parts on the track, and also has the same FPS drop over time.