Lag in PingPong bot

I made a PingPong bot that can find the destination of ball (including bouncing)(its not perfect tho).. but its so lagy.. im not doing so many loops or stuff(actually extra 1 loop for 1 bounce calculation).. i dont know if its because of my browser or laptop.. can you check it and tell me what is causing this? extra suggestions also appreciated
link

1st thing I thought was that you are over-using warp blocks so they end up fighting each other

This gives me about a 25% speedup and worth looking at the others I'd thought

so it is also laggy in your pc? hmm.. I applied the thing you said. thanks

Thanks to @cymplecy I found the solution.. looks like my "broadcasting" habit from Scratch isnt suitable for Snap!.. its trying to do each broadcasting simultaneously.. thats why its better to use 3forever blocks so engine can chill.

Yep :slight_smile: - that's much nicer to play now :slight_smile: Very smooth :slight_smile:

I'm loving the use of AI in a simple pong game - that never occurred to me in he past to do that as a learning exercise

Well impressed with it :slight_smile:

That's a really cool bot! Not to nit-pick, but in most pong games, the ball bounces depending on where on the paddle you hit it. The further form the center of the paddle the ball hits, the sharper that angle it leaves at.
ie:


For example, no matter what angle the ball comes in at, if it hits the center of the paddle, it will bounce straight forward. The idea with this is that skilled players can control where the ball goes. It would be cool if you got a bot to work with that model as well.

Good game, love it !

thats really good idea! and looks like easy to implement. Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.