How to improve performance with many objects in game in HTML5?

后端 未结 2 1703
臣服心动
臣服心动 2021-01-23 21:27

What things can I do when it\'s necessary to show many objects and calculate position, collision detection, reaction, etc. and I want everything look smoothly? Here\'s an exampl

2条回答
  •  星月不相逢
    2021-01-23 22:11

    I see you're using box2d--an excellent and mature physics library. Good choice!

    Box2d is fairly well optimized already...and a lot of eyeballs have looked at the code to search for further optimizations.

    Therefore (if your design needs permit), your path to improvement is replacing this large library with simpler collision functions.

    Check out this set of video tutorials. Ignore the fact it targets processingJS, it still provides a good tutorial on game physics and handling collisions. Skip to the second link if you are already good on physics basics:

    Tutorial "home": http://channel9.msdn.com/Series/Sketchbooktutorial

    Tutorial chapter on collision of circular objects: http://channel9.msdn.com/Series/Sketchbooktutorial/Simple-Collision-Detection-and-Response

提交回复
热议问题