Laggyness in TGB
by Robert Carroll · in Torque Game Builder · 10/11/2009 (2:26 am) · 4 replies
Hi, Im almost done with a game but theres one thing holding me back. I have a game where you fight off waves off enemys, I made this progressingly harder by making spawn spawners :) But Eventually in my game when there get to be about 20 AI's the thing gets too laggy to play. Dose anyone have suggestions on how to fix this?
About the author
Stay Up all night playing PS3 ;) add me PSN: RCBASEBALL13.
#2
10/11/2009 (3:22 pm)
Ok, my game is a platformer were you try to survive as long as you can. Im making spawners that spawn other spawners, which spawn the enemy. I have them to self Destruct after 1 min to help clear stuff up. Then my bullets have a KILL world limit set to them and Kills them. My ememy's have explotion particle effects, and their head have a different explotion effect. Heres one thing I think might be lagging it my enemys are connected by a mount to clone behavior, Do thoose go away when their parent dies? And lastly the only thing I don't get is I have a grenade set to rigid and a big explotion explotion effect. I can throw about 20 in a second but it only laggs for about 1 millisecond (somethimes unoticeable)
#3
To test this theory, simply remove all particle effects from your game. If the game runs smoothly, then re-design your effects to have fewer particles. If it is still laggy, then you might be doing too much per frame in your scripts.
10/12/2009 (12:24 am)
It sounds like you have a lot of particles. If you have a particle effect that generates a lot of individual particles, your game will slow down quite a bit.To test this theory, simply remove all particle effects from your game. If the game runs smoothly, then re-design your effects to have fewer particles. If it is still laggy, then you might be doing too much per frame in your scripts.
#4
10/12/2009 (3:46 am)
Thanks, I deleted some particle effects that I don't need, but I was wondering somthing else since im prob going to put other particle effects in place of those can I make a spawner that after every spawn it adds 1,2,3,etc. more? That will help alot because spawners that spawn spawners is confusing and laggs it some.
Associate William Lee Sims
Machine Code Games
Very likely you have a lot of "onUpdate" callbacks due to behaviors. I find behaviors great for GUI elements, a few number of objects, and prototyping. After that, it's really best to convert the class into C++ and to convert the behaviors into the function calls.
Since you don't have the Pro version, the next thing to do is to re-design your game so that all of the objects "think" at once.
Another thing that can slow down your game is lots of particles.
After that, I'd need to know more about what your game was doing or looked like.