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 Answer 1

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\$
2
  • \$\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\$ Commented Jan 17, 2016 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\$ Commented Jan 18, 2016 at 8:34

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.