Game Optimization ideas and techniques

Hey! Congrats on releasing your game, it can be quite underwhelming when you get negative feedback from the game you’ve worked a lot of time on, but you should not focus on these negative feedbacks as hating, more like constructive criticism.

Now to ur question: It all depends on how simple the game is. I am not sure how long you’ve worked on the game, but if it’s as simple as you say, you might end up better rewriting the game keeping optimization in mind as you go along. Otherwise if you’ve worked a lot on the game, you might want to just identify, and patch each issue one by one.

But first of all, you should go and figure out what IS causing the lag. Just because your game is laggy, it doesn’t mean that the whole game is bad. It could simply just be one single script that is making it unplayable. Memory leaks can be hard to detect sometimes, but gladly we have tools like the MicroProfiler to help with that issue.

If you do decide to rewrite your game, be sure to focus on things such as connecting events at the right time, disconnecting them after you’re done using it, minimize your RemoteEvent calls, and basically your code’s integrity as a whole. Try and build up your game as different small parts / modules, and connect them together for your entire game. Although a small performance change, if your game requires creation of parts a lot of times (like guns for example), you might want to use Object Pooling to improve performance a little bit. It’s concept is pretty simple: Upon game startup, create a lot of parts somewhere in your game that the player can’t see, and instead of creating a new Part instance every time, you just simply get the objects from the pool and position them to where they are supposed to be, and give them the necessary functionality. Although i haven’t used this, i found a promising module for it.

As some last words, i’ll give you a couple modules that i (and a lot of other people) use to help with memory leaks:
Janitor
Maid
Trove

2 Likes