Open Golf: A cross-platform minigolf game written in C
github.com
github.com
1. Maybe have a "par" for each hole.
2. Be able to better see the layout of multi-level holes, i.e. the ones with slopes.
Other than that this is a really nice lunchtime distraction.
I work on frontend projects day-to-day. I'd love to build a simple cross-platform game in C/Zig/C++ for some variety and to learn lower-level programming.
I've looked at Handmade Hero in the past but its specific to Windows at the moment.
Think of a system as shipping data packets around, then it should be much easier to see how to swap out the platform parts.
One way (out of many) to do this is have a cross-platform interface for each non-portable thing, with separate platform-specific implementation files that you swap in depending on which platform build you're doing. For example, if your game has sound, you'll probably have a platform-independent sound.h the rest of the game calls into, and then sound_windows.c, sound_linux.c, sound_mac.c, etc. files that contain the platform-specific implementations of those functions. Repeat for graphics, input, and other things that cannot be done (or you don't want to do) in a portable way.
Another thing is the game loop. Back in the DOS days, when you were the only thing running on the system, you implement main() did something like:
while (game_running) { do_everything(); }
Modern platforms expect to be in the driver seat, and will instead call into your code, so this turns into something like: function windows_call_me_please() {
do_everything();
}
Obviously this is a simplification, and there is a lot more to it, but hopefully it answers some basic questions.https://prog21.dadgum.com/66.html
Libraries can be helpful. But at the baseline, what you have to solve is the problem of adjusting your dependency load such that adding new target platforms is a matter of rewriting small details, which means taking a language-designer's view of your system and saying "OK, if I need to automate the rewrite, then I need a compilation mechanism". Sometimes you have to change asset formats or runtime I/O mechanisms, but you can select what layer of the design you are aiming to standardize and go from there. e.g. records of chess games have a few defined formats. They don't need to track the assets used to draw the board, or the account information of the players.
If what you want is all of it: every pixel and frame of output the same, all input devices treated identically across all environments, then you'll gravitate towards a VM type of design, like Another World, Z-Machine or SCUMM, to name three well-known examples of such a design.
Great work, awesome orchestration of cross platform libs.
Have you seen the leaderboards of any online game lately? They usually get wrecked by cheaters and defeat the whole purpose.
Typically there's big companies with large dev teams working on accomplishing such a feat & this project does it with with a 50 year old language and a handful of libs
Working on a project to port a 20 plus year old c/cpp code base to the web. The tooling was like 98% there but I've had to upstream a few fixes or find a workaround every now and then.
Plenty of retrogaming stuff to learn from.
Thanks for giving me an easier way to share this good old game with friends!
I wish there is a replay mode so I can relish on my glorious strokes of luck.
Browsing the Sokol Github, it looks like it's compiling to web assembly. I'm not very familiar with web assembly, how does one normally debug it?
(disclaimer: sokol author)
Perhaps a level generator based on some ascii art or something would be nice.
That way more people could add levels in merge requests. Or even add a level loader where you can import a list of those levels.
* Use right-click for the camera control, rather than left-click away from the ball. It's unnerving to have the camera change while you're trying to line up a shot.
* Show a shot counter, and assign each hole a par.
* Slightly tune down the friction. I had the ball stop dead on slopes a couple of times, and it stopped way earlier than I expected on slower shots.
More exotic hardware also relied on the vendors providing a C compiler and the quality there could vary wildly.
But yes.
https://github.com/mgerdes/Open-Golf/blob/master/src/golf/ga...
It would be nice to be able to skip the starting animation.
Then suddenly it wasn’t.
Was this inspired by Golf with Your Friends? I've been playing that a fair bit, it's pretty fun and good value.
The ball shouldn't go in easily if you hit too hard.
-- Wanted to share a memory. Growing up there was this put-put course that was called Magic Mountain that my family and I used to go to. It was sort of a big hill that they made into a mountain so that when you were walking on it you felt like you were a giant. Anyway they had this small stream that came down the side of the mountain and wound in-between all of the courses. There was this one hole where the stream intersected at the top of this really obnoxious little course with lots of switchbacks and weird angles. You were "supposed to" (quote on quote) jump the stream and continue on with the hole, but if you managed to knock your ball into the stream there was a ball catch at the bottom that would push the ball back onto the course near the hole so it didn't get washed out to the bottom of the entire mountain. It was possible to make a hole in one if you knocked the ball into the stream - the little river would carry the ball down to the bottom and then gently push it into the hole. Your game reminded me of that memory. Thanks.