3 ms·
How would you do it then? Run every possible sequence of hits? That's not going to work, too many possibilities. Level 17509 was reckoned to be impossible for a
by codeulike 9y ago
How would you do it then? Run every possible sequence of hits? That's not going to work, too many possibilities. Level 17509 was reckoned to be impossible for a long time but then someone did it.
- Simon_says 9y agoActually, I did this for a 3-D minigolf game I made about 20 years ago. The algorithm isn't hard. You have a rather small parameter space of possible hits (direction plus velocity). In my game it was a 3-dimensional parameter space. For his, it would be a 2-dimensional parameter space. The output is the distance from the hole to the ball when it stops moving. This is just a minimization problem. Try a bunch of experiments and refine the better ones. Worked for me. It is technically true that it's possible there might be a solution that your search won't find. But I never found an example of that occurring for my game. So if you follow this, you may inadvertently throw out a hard level that has a solution, but you'd never present the player with a level that has no solution.