News for hackers. Stuff that matters.
Re:Show HN: My first game, minimal procgen gravity golf insp... by mrspatula on Wednesday October 02, 2019 @09:51AM (#21136392)
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

Re:Show HN: My first game, minimal procgen gravity golf insp... by albi_lander on Wednesday October 02, 2019 @10:58AM (#21137157)
So 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.
Re:Show HN: My first game, minimal procgen gravity golf insp... by mrspatula on Wednesday October 02, 2019 @11:08AM (#21137268)
Thanks. 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.
Re:Show HN: My first game, minimal procgen gravity golf insp... by pryce on Thursday October 03, 2019 @11:12PM (#21154473)
Oh, 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?

Re:Show HN: My first game, minimal procgen gravity golf insp... by seanwilson on Wednesday October 02, 2019 @10:24AM (#21136772)
Great job on completing it - looks fun! Any comments on troubles you ran into and surprises on the way?
Re:Show HN: My first game, minimal procgen gravity golf insp... by mrspatula on Wednesday October 02, 2019 @10:32AM (#21136862)
Thank 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 :)

Re:Show HN: My first game, minimal procgen gravity golf insp... by petargyurov on Thursday October 03, 2019 @03:48AM (#21144646)
It's funny isn't it... just a pretty space golf game on the surface; but a monster of mathematics underneath it. Impressive stuff!
Re:Show HN: My first game, minimal procgen gravity golf insp... by kleer001 on Wednesday October 02, 2019 @03:46PM (#21140087)
Stupid question... Did you try a voronoi diagram?
Re:Show HN: My first game, minimal procgen gravity golf insp... by mrspatula on Wednesday October 02, 2019 @03:52PM (#21140140)
Not 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.
Re:Show HN: My first game, minimal procgen gravity golf insp... by pryce on Thursday October 03, 2019 @11:09PM (#21154467)
I 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.
Re:Show HN: My first game, minimal procgen gravity golf insp... by zubi on Wednesday October 02, 2019 @10:21AM (#21136729)
Care to share the tech stack behind the game? Seems that you used a cross-platform technology to make it runable on several OSes.
Re:Show HN: My first game, minimal procgen gravity golf insp... by azhenley on Wednesday October 02, 2019 @10:21AM (#21136737)
The splash screen says Unity on it.
Re:Show HN: My first game, minimal procgen gravity golf insp... by mrspatula on Wednesday October 02, 2019 @10:26AM (#21136791)
Yes, exactly. Have to pay $$ to remove that splash screen logo!
Re:Show HN: My first game, minimal procgen gravity golf insp... by big_chungus on Wednesday October 02, 2019 @11:03AM (#21137208)
Stupid 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.
Re:Show HN: My first game, minimal procgen gravity golf insp... by TheRealSteel on Wednesday October 02, 2019 @03:56PM (#21140173)
Even if you're technically able to cover the splash screen, you aren't legally or morally able.
Re:Show HN: My first game, minimal procgen gravity golf insp... by big_chungus on Wednesday October 02, 2019 @05:01PM (#21140704)
That's why I called it a "stupid question", because I asked out of technical curiosity alone and without intent to do so.
Re:Show HN: My first game, minimal procgen gravity golf insp... by mrspatula on Wednesday October 02, 2019 @11:13AM (#21137315)
No, they don't make it easy (and more importantly, it would violate their terms). You just have to pay to remove the splash screen.
Re:Show HN: My first game, minimal procgen gravity golf insp... by ablation on Thursday October 03, 2019 @09:47AM (#21146865)
It's really not much of a bugbear anyway. I actually found it useful to see it was built in Unity!