Alice Community  

Go Back   Alice Community > Alice 2 > Works-In-Progress

Reply
 
Thread Tools Display Modes
Stage 7: reduced lag
Old
davidghemer
Member
 
Status: Offline
Posts: 38
Join Date: Nov 2011
Default Stage 7: reduced lag - 12-06-2011, 03:55 AM

Here's another update to the game. In this stage my main focus was decreasing lag in the collision detection and hopefully reducing the number of exceptions and incorrect behaviour.

To do this my main improvement was to calculate the angle of the ball periodically in the background, rather than on demand at the time when a collision with the cushion occurred. This works very well most of the time, except in the case where the angle needs to be calculated very soon after a ball is hit (especially when a ball is resting on the cushion).

The other main enhancement was to combine three lines of code into a single calculation in the method that handles collisions with the cushions. This worked surprisingly well.

I also slowed the ball movement down a bit which buys me a bit more time.

There's still a few problems, caused mainly by lag, but I'm not sure I can get much more improvement. Enjoy
Attached Files
File Type: a2w PoolGame_Stage7.a2w (883.7 KB, 48 views)


For video tutorials on programming in Alice 2.2 check out my YouTube channel

http://www.youtube.com/user/drdave785

Also check out my Programming in Alice blog at

http://programminginalice.com
   
Reply With Quote
Reply

Tags
collision, game, pool, trigonometry

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.