Performance problems, need help

I have some performance problems with my game. I’m 99.9% sure it’s something I’m not understanding or have done wrong. I should clarify I have many years experience in programming, so I’m not a newbie. But for the life of me I cannot figure out why when I spawn enemies, the fps drops eventually to like 1? And not even that many enemies, maybe like 6-7. So I’m guessing it’s something to do with the script on my enemies, but, in the update code there shouldn’t be anything Lua can’t handle? So if someone could message me, I can provide a project link if you wanna take a look at it.

The first thing to do is turn on the profiler (Profiling in Defold) and see what it says. As well as the cost of any outstanding functions, it will tell you the number of existing instances of certain things, so you can tell if you’re actually only adding 6-7 enemies, or if something’s going haywire and you’re really spawing 6-7 enemies every frame or something like that.

4 Likes