Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(+2)

Thank you, MurphysDad!

At first I didn't think I needed to display the score, but I couldn't find anything better to put on that wall that I had time to model before the month was over. I'm happy it ended up that way though.

You're probably right, there are really no instructions at all.

The AI was fun to implement, but I had to google quite a bit to get the maths right. When the opponents shot timer is up (ready to shoot again) the AI iterates over all the target balls (the yellow ones for the AI). For each ball the AI calculates where the ball must be hit to sink into each one of the holes. If the angle isn't possible without bouncing off the wall that hole is rejected for that target ball. Then based on the angle, distance to the cue ball and distance to that hole that shot is given a score and stored in an array (with all other needed data about that shot). That array is then sorted according to scores. Then the AI raycasts 4 times for each shot (from each of the cue ball to the each side of where the cueball would be when the contact occurs), then again from each side of the target ball to where it will be when it reaches the hole. If the ray hits another ball the shot is rejected. When a shot has returned 4 successful raycasts without hitting another ball that shot is selected. The AI then calculates the time for the cue ball to reach the target ball, and where the target ball will be after that time and adjusts the shot angle according to that location of the target ball.

The last part doesn't really work 100%, and I tried to fix it but realized that the AI doesn't have to sink each shot right away so I could spend a bunch of time to fix it then manually add some randomness to make the opponent miss or I could just leave that bug in.


For the difficulty settings:

The player shot timer (the delay) is 1 second at easy mode and the opponents is 6 (I think from the top of my head), leaving the player at a clear advantage. Then for each difficulty the player's shot timer is increased and the opponent's decreased. Additionally at the highest difficulty the guide line for aiming is removed.

(+1)

Very cool, thanks for the detailed summary! Haha it's cool when a bug becomes a feature :) yeah you don't want the AI to be too perfect