Earlier quoted context omitted.
How many changes to the C code are required for this sort of thing?
That depends on the code. Neverball has acquired a high level of portability thanks in large part to SDL2 and OpenGL (ES). So compiling to Emscripten was mostly about rearranging the pieces that were already there. My original patch was surprisingly small. ( https://github.com/Neverball/neverball/commit/517c93b7bcf63f... ) I would say I spent more time on integration with browser APIs, so it would behave and feel mor…
Open Golf: A cross-platform minigolf game written in C
91–99 of 99 posts
Re: Open Golf: A cross-platform minigolf game written in C
#92Re: Open Golf: A cross-platform minigolf game written in C
#93Any recommendations to learn to build cross-platform games like this? 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.
This might be obvious, but one of the key activities is to minimize platform-dependent code so that most of the game logic is portable and shared across all platforms. So no Win32-isms or Cocoa-isms or littered all over your game. 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 pla…
Re: Open Golf: A cross-platform minigolf game written in C
#94This is excellent. Can I suggest a couple of improvements? 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.
Loved it, and would concur that having a better sense of what the hole looks like from above before the shot (or being able to click to see the hole from above like a map) would be awesome. But, I loved playing it. And, I sucked.
Re: Open Golf: A cross-platform minigolf game written in C
#95Any recommendations to learn to build cross-platform games like this? 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.
This might be obvious, but one of the key activities is to minimize platform-dependent code so that most of the game logic is portable and shared across all platforms. So no Win32-isms or Cocoa-isms or littered all over your game. 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 pla…
Re: Open Golf: A cross-platform minigolf game written in C
#96Any recommendations to learn to build cross-platform games like this? 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.
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.
Re: Open Golf: A cross-platform minigolf game written in C
#97Impressive to see C being able to create x-plat 3D games that run in Browser + popular Desktop + Mobile OS's. 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
What's the TLDR on how to compile the C code to run in the browser?
Re: Open Golf: A cross-platform minigolf game written in C
#98Impressive to see C being able to create x-plat 3D games that run in Browser + popular Desktop + Mobile OS's. 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
Re: Open Golf: A cross-platform minigolf game written in C
#99Earlier quoted context omitted.
Emscripten. If you use something like SDL porting is trivial. 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.
Good on you man. If I got an email that said “opportunity: port 20+ cpp app to web” I would chuckle and close that sucker real quick. Modern cpp I maybe can deal with. That 90s stuff is real bad.