5 ms·
Hi HN, I just launched this little game of mine - Astro Golf. You can think of it as Desert Golfing but in space, where the gravitation pull of the planets cre
by mrspatula 7y ago
Hi HN,
I just launched this little game of mine - Astro Golf. You can think of it as Desert Golfing but in space, where the gravitation pull of the planets create some interesting levels. I think it was on an HN comment that I first heard about Desert Golfing many moons ago, so it felt fitting to post this back here.
All the levels are procedurally generated, and are guaranteed to be hole-in-one-able. I did this by computationally testing a huge amount of levels offline.
This is my first game, and I learnt a lot doing it. Happy to answer your questions! I hope you enjoy it.
Peace
- seanwilson 7y agoGreat job on completing it - looks fun! Any comments on troubles you ran into and surprises on the way?
- mrspatula 7y agoThank you. Lots of interesting troubles - quite a few surrounding Unity itself. E.g. they have a physics API that gives different results when run automatically by the engine at 1x speed and when you run it manually as fast as it can go. This came up because I wanted to test every level automatically offline, using the exact same physics simulation as the player would experience. The procedural generation of the levels was also an interesting problem. I used rejection sampling to basically place non-overlapping circles in a box, but when you want to create quite a dense level this becomes very inefficient (it can be very hard to slot the final few circles in). I tried a number of heuristics and other methods to speed this up, but none of them actually improved over brute force. One of the most interesting was using Gibbs sampling - i.e. generate an initial valid level configuration, then move one planet at a time and sample from the ensuing Markov chain (basically sampling from the marginal distribution of each planet given all the others). This ~kind of worked, but was annoying for a few reasons so in the end I just brute forced rejection sampling on a beefy AWS server :)
- kleer001 7y agoStupid question... Did you try a voronoi diagram?
- mrspatula 7y agoNot a stupid question - I did some small amount of experimentation with voronoi, but I also had some global constraints / parameters that I wanted the levels to have and these were more easily implemented in the sampling method.
- petargyurov 7y agoIt's funny isn't it... just a pretty space golf game on the surface; but a monster of mathematics underneath it. Impressive stuff!
- zubi 7y agoCare to share the tech stack behind the game? Seems that you used a cross-platform technology to make it runable on several OSes.
- azhenley 7y agoThe splash screen says Unity on it.
- mrspatula 7y agoYes, exactly. Have to pay $$ to remove that splash screen logo!
- big_chungus 7y agoStupid question, but I see your logo is on there as well. Might you be able to just make a larger image, or make a background image that blended in with the colors so as to make it illegible? I'm sure that was not top priority, just curious.
- mrspatula 7y agoNo, they don't make it easy (and more importantly, it would violate their terms). You just have to pay to remove the splash screen.
- ablation 7y agoIt's really not much of a bugbear anyway. I actually found it useful to see it was built in Unity!
- TheRealSteel 7y agoEven if you're technically able to cover the splash screen, you aren't legally or morally able.
- 7y ago
- albi_lander 7y agoSo simple, yet incredibly fun, well done! Could you share how long it took to build it ? I've been thinking about creating a small game, for fun, and to learn stuff along the way, and I am wondering how much time it would take me.
- mrspatula 7y agoThanks. The goal of this project was to actually get something out there, so I deliberately set myself quite a small goal. I probably got "80%" of the way there in 2-3 weekends back in March, then I got busy with some other stuff. I didn't want to let this become another project that falls to the wayside, so I then spent another ~6 weekends polishing, refining, etc in the last 2 months. It was a great learning experience, and I would 100% recommend making a game. It's such an interesting mix of programming, animation, design, art, sound.
- pryce 7y agoI like it. Only thing I'd change is maybe the stars to be a fainter, more blue hue, and maybe have them as points or subtly x shaped, just to help visually distinguish the ball.
- pryce 7y agoOh, actually I'm also interested in how you made the levels. Because of the computational difficulty of solving similar things (eg the three-body problem is hard) and you've got several variables to work with, did you just experiment with each level and place the holes retroactively based on an interesting shot you found? Or did you have to do a bucketload of math to work out where to place things?