0
\$\begingroup\$

I have a processing game where I am having serious lag problems with collision detection. I am using the most effective code I can think of however after about 9 levels in The game gets unbearably laggy. I would show you the code but site wont handle my less thans.

If you want to check the program out you can find it here: https://www.khanacademy.org/computer-programming/tanks-v1245/6637554186715136 under the tankMelee function ~line 160

\$\endgroup\$
1
\$\begingroup\$

Most games use quadtree structures to manage the colisions, you should read about it.

Anyways, if you are having lag after X levels is possible that you are storing all the objects and checking them out every loop, and not just the object in the current scene or level.

\$\endgroup\$
  • \$\begingroup\$ but this is a real time thing - the enemy has to check for bullets, walls ,and the player, the lag after levels is a "I have to check more things" issue \$\endgroup\$ – gfaster Jan 17 '16 at 22:38
  • \$\begingroup\$ Understood, have a peek in the link i provided, theres a demo cheking docens of objects un real time, quadtree is used in real games, give it a try \$\endgroup\$ – PRDeving Jan 18 '16 at 8:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.