I have neglected this blog for a short time after I fell ill, but have still been working on the project, and have the following update!
I have fixed a number of bugs, such as that where you could not always apply maximum power to the cue. This was caused by the size of the canvas being at the edge of the table, and so I was unable to track cursor movement outside of it. To fix this, a larger, blank canvas was drawn around the table and references to the previous canvas were changed to reference table size.
In addition, there was a case where balls could sometimes stick to each other for a short time when they overlap; either if they are generated this way, or upon collision. I have solved this by checking for the presence of other balls when generating them randomly in the sandbox described previously, and by modifying the collision response function, used across different game modes, to separate balls such that they are not overlapping before applying the relevant simulations of physical forces, which now perform correctly.
On top of this I have been working on new functionality, namely implementing the logic for pool rules. This is somewhat complex, and necessitates the use of event triggers and subscriptions to communicate the actions occurring in the collision model to the game rules. The game rules themselves set up the environment for Pool including the player objects, required ball objects, and of course score the game as it progresses and assess fouls and so forth – although this is not yet fully complete.