(Not sure if this is in the right category as I was originally going to place this in #help-and-feedback:scripting-support)
Two friends and I made a randomizer fighting game until we started to noticed a critical bug that we can’t figure out the core root to. The game’s performance slowly starts to drop the longer you play, causing most weapons to be almost practically useless or game-breaking. A good example of this would be an item called michael p -which damages all humanoids that’s in range of the item-. When the game’s performance starts to drop, the DPS of the tool starts to decrease until its doesn’t even damage. We also noticed how the game’s performance drop speed changed depending on how many players are there, which makes it insanely hard / time consuming to replicate/recreate without many players. When there was a 15 player server, the game’s performance was dropping massively, unlike having a server with 5 players in it.
I noted down what the performance drop does to the game:
- All serversided functions such as
wait()
becomes delayed making scripts last longer than its suppose to or desynchronize scripts. - Performance decrease does not affect ping, so if you have ~40ms and you use a basic melee, there should be no delay between the click.
- Weapon cooldowns are extended, causing the game to feel way slower.
We had some ideas on what could be the root cause such as:
- DataSaves causing lag every time a player joins the server. (Recently rewrote the data system, so that shouldn’t be the issue)
- Possibly too many loops (Did some looking around on hopefully other devforum posts and some claim that having too many loops can cause server issues)?
- Server possibly can’t handle much.
- Possible memory leak?
- Projectiles probably scuffed?
- Connections cause lag / Too many Connections not disconnected?
- The amount of players might be too much for the game to handle.
I’m not fully sure what’s causing it, but if anyone might have an idea and would like to say what they think could possibly be causing the performance drops, then don’t hesitate to give your idea. I’ll gladly appreciate any ideas. Thanks you.
EDIT: I can most likely confirm it’s caused from a memory leakage.