10 ms·
I write games in C (yes, C) (2016)
- Keyframe 8mo agoIn my core I'm the same. C is my language and served me well for decades. There's nothing inherently major wrong with it until you reach one of the two (or both). Working in a group of people on a C codebase tends to introduce pain on multiple levels unlike some other languages (yes, including C++). The other is that anything takes a long-ass time to do compared to modern alternatives, which might also be an issue if you're developing a game; Especially if you're developing a game. Having said that, I can't disagree since as I said, I'm also inclined towards it's siren call of simplicity.
- uecker 8mo agoWhy do you think working with a group of people on a C codebase introduces pain unlike other languages? Working with a group of people always causes pain, but I found the pain much less severe for C than for C++.
- dragonelite 8mo agoIn my mind using a simpler language should be less painful given there is less to argue about given syntax and versions etc. Take c# for example you have multiple ways to do the same sort of things.
- Keyframe 8mo agoYour question also hides an answer. You don't often get to chose a group of people you work with, and unlike projects that self-attract and self-distill ideal profile (like linux mentioned in sister comment), you're left with people usually not used to ye olde C idioms. With C++ it's a bit easier since it is more widespread and supports some of the idioms people get used through schools and other projects. Of course, projects (should) always dictate a certain discipline by different mechanisms, but if certain way of thinking isn't ingrained then it introduces just that much more pain to the communication layer between people.
- uecker 8mo agoI would argue that is is much harder to find a group of C++ programmers who write a coherent style of C++. In C there is not nearly as much to decide. Note also that I am speaking from experience with both.
- direwolf20 8mo agoC relies on the programmer to understand the lifetime of every object in the program, which is global structure. When the programmer is multiple people, it's easy to get out of sync. unique_ptr from C++ solves 90% of this.
- smallstepforman 8mo agoEver use a leak detector? Even my graphics engines (with shared resources) uses a leak detector in debug mode. The monent you forget to release a resource, assertion at program termination. Leaks are trapped with tooling, and all you need is one dev in the team to be diligant to run valgrind or visual leak detector or similar.
- uecker 8mo agoWe run valgrind and asan as part of the CI, so it is checked before every merge and no developer has to be particularly diligent. But it is also not something that triggers a lot.
- direwolf20 8mo agoDo you think the best way to avoid bugs is to thoroughly test your code, or does understanding the code while you write it also help?
- saidinesh5 8mo agoIt depends on what you're building with the language too. For eg. In very embedded contexts where we were not using any big data structures like struct of strings, not doing any memory allocations etc... C might be easier to reason about than C++. (No hidden code paths). Just allocate something on the stack, pass the pointer to a function to do the computation, done. In any desktop apis (gui, web servers etc..), where you deal with collections of objects, need to spin up thread pools and rely on results from the future etc... The standard library data structures (vectors, maps etc...) alone makes C++ code a lot more easy to read and review than C. When raw pointers are forbidden, Ownership of memory becomes very clear. Granted my opinion of desktop development comes mostly from very few libraries (Qt vs. Gtk, gstreamer's C API vs. C++ wrapper, http libraries etc...), but there are some problem domains for which C is just insufficient.
- NuclearPM 8mo ago> Having said that, I can't disagree since as I said, I'm also inclined towards Say more with less.
- heliumtera 8mo ago>Working in a group of people on a C codebase tends to introduce pain on multiple levels unlike some other languages linux attracted 2,134 developers in 2025 that kinda weakens your argument a little bit
- jonahx 8mo agoMaybe (and I like C, for the record), but it doesn't follow necessarily. It's possible most of those devs were attracted by "working on linux," and are putting up with the pain of collaborative C. I know there's a movement pushing for more Rust.
- tialaramex 8mo agoI think the popularity of Rust for Linux is also in part a reflection of internal discontent with poorly documented and sometimes straight up poorly understood kernel internal APIs. When a developer asks Can I Fizzle this Doodad? C is comfortable with the answer being "It'll definitely compile but whether it would work is complicated - ask the expert on Fizzling and the Doodad expert, and hope they give the same answer" but Rust wants the answer to be "Yes" or "No" or at the very least, "Here is some actual text explaining when that's fine" Sometimes it really is hard work to figure this out but for a project as big as Linux even in those cases it's often worth doing that hard work, because you unlock something valuable for every non-expert contributor and Linux has a lot of those.
- Keyframe 8mo agoIt proves the argument as an outlier. I explained in another comment. You often don't have the luxury of selecting the group of people you work with and more often than not, especially these days, people aren't used to (C) way of thinking which just introduces more noise to the communication between people.
- smallstepforman 8mo agoIf Linus started his OS project in 2026, he might have chosen Zig instead of C.
- vascocosta 8mo agoI totally resonate with the author of the post. My main requirement to enjoy a language deeply is often simplicity, so I love languages like, C, Golang, Odin and Zig. That said, I also acknowledge that often times I need to solve problems that can benefit from a language that embraces what I call necessary complexity, but do it in elegant ways. Whenever I need to prioritise code correctness, especially memory and concurrency safety, using a mostly functional pattern instead of OOP, but without going as extreme as say Haskell, I unquestionably choose Rust, my favourite complex language. I often work with network code that is highly concurrent, must be as correct as possible and benefits from good performance, so then again, Rust feels natural here. On the other hand, I love coding simple indie games and for that particular case, I like a simple and performant language using an imperative, non-OOP style. In my opinion C, and in particular Odin more recently are quite a good fit. If Jonathan happens to be reading this comment, since he mentioned Golang, I would suggest him Odin as perhaps the best of both worlds between C and Golang. It has all the simplicity of Golang, but without a garbage collector, plus it is quite easy to code a game using Raylib.
- pjmlp 8mo agoThe language is called Go, golang is the website domain.
- ternaryoperator 8mo agoThe use of "golang" for posts and comments is desirable IMHO because it greatly facilitates search, especially on sites such as HN that cover many languages.
- 9rx 8mo agoSearching "site:news.ycombinator.com go" on Google didn't yield any results that weren't about the Go programming language even after going several pages deep. What kind of search problems are you having, exactly? And why is it unique to Go? I am sure there are comments on HN about metal oxidization, making sharp changes in direction, Norse gods, and letters of the alphabet.
- webdevver 8mo agoits funny how writing games in C is now seen as some kind of 'hardcore mode', despite the fact that a huge number of excellent titles up to and including the 2000s were written that way. the core of games tend to be a 'world sim' of sorts, with a special case for when a select entity within the world sim gets its inputs from the user. where C becomes a chore is the UI, probably has to do with how theres many more degrees of freedom (both in terms of possibilities and what humans consider appealing) in the visual plane than there is in the game input 'plane', which might be as little as 6 independent inputs plus time.
- namuol 8mo ago> UI in C Try Clay! https://www.nicbarker.com/clay https://www.nicbarker.com/clay
- pansa2 8mo agoThere’s also CimGUI. I know the underlying C++ library is well-regarded - I’m curious to hear people’s experiences using the C wrapper. https://github.com/cimgui/cimgui https://github.com/cimgui/cimgui
- pengaru 8mo agoFor quite some time even games technically written in C++ were more appropriately described as C compiled by a C++ toolchain with a minimum of actual C++ syntax - more like C with classes.
- glimshe 8mo agoRollercoaster Tycoon was written in assembly! C was easy mode back in the day...
- deleted 8mo ago[deleted]
- NewsaHackO 8mo ago>Death of flash >The library support for games[in Go] is quite poor, and though you can wrap C libs without much trouble, doing so adds a lot of busy work. I can't see when this was written, but it has to be around 2015. So, about 10 years ago. I wonder what his opinion is today.
- QuantumNomad_ 8mo agoThe first capture of the page on Internet Archive Wayback Machine is from January 9th, 2016. So it’s at least that old. Also here is a snapshot of the main page of his website from that time, which has screenshots of his games and thereby provides context into what kind of games he had made and published when the blog post was written. https://web.archive.org/web/20160110012902/http://jonathanwhiting.com/ https://web.archive.org/web/20160110012902/http://jonathanwh... This one looks like it’s 3d and has a pretty unique style: https://web.archive.org/web/20160112060328/http://jonathanwhiting.com/games/knossu/press.html https://web.archive.org/web/20160112060328/http://jonathanwh...
- edu 8mo agoI think it would be aprópiate if @dang added a (2016) to the title
- leecommamichael 8mo agoCome try Odin!
- andai 8mo ago+1 for Odin Did a bit of game dev in Odin last year and it was a wonderful experience. It's very much game dev oriented and comes batteries included with many useful libraries. And the built in vector stuff is very helpful there too.
- doublerabbit 8mo agoI've been doing theory and really want to myself. Time escapes me before I get a chance to type Hello World. Working in front of a screen eight hours a day leaves me exhausted that the least things I want to do is code more on my day off. Although wanting to dive in to WASM has been a priority and checking Odin for wasm their 3D model example is super cool. May just have to take a poke. TCL for web frontend; Erlang for DB and potentially Odin for wasm? This could be a cool mix.
- andreldm 8mo agoI was also really surprised with Haxe, I share the author’s concerns about its future, other than it’s quite fun to work with.
- dismalaf 8mo agoHaxe is a great language but it feels like the ecosystem has been stagnant for 10 years. No Vulkan bindings, no SDL3, still trying to be a web language that happens to compile to native code instead of getting with the times and going fully native + maybe wasm. Part of me wants to write my own bindings to SDL3 in Haxe but it's far easier to just use Odin these days.
- stephc_int13 8mo ago"nobody does this" Well, this should be reformulated a bit. Using C is not the norm, but it once was and many people are still using C to write games, myself included.
- IshKebab 8mo agoWhen people say "nobody .." or "everybody .." they often - maybe even usually - do not literally mean 100.000000% of people. You are an outlier. He is still correct to say "nobody does this".
- graemep 8mo ago> when it comes to compilation I can't think of anything faster. What languages compile fastest?
- arcologies1985 8mo agoRust can be up there with C depending on the project.
- NewsaHackO 8mo agois that a joke?
- enricotr 8mo agoAny language can be, depending on the project. Rust compile is slower than C, on more than average. That's it.
- gfody 8mo agonothings faster than turbo pascal
- levodelellis 8mo agoIIRC go wasn't that fast but can feel like it in vscode. IIRC vscode compiles go using the lsp which is faster than launching a process because for some reason, vscode stalls for a second or more before launching a process. I can't remember how fast D was but iirc it was fairly fast. Actual fastest is my compiler which I don't work on anymore and isn't ready for production. It's the only compiler I know of that hit millions of lines <1s in a non trivial language https://bolinlang.com/ https://bolinlang.com/
- tmtvl 8mo agoNot every compiled language has a de facto standard compiler, but with SBCL Common Lisp compiles pretty quickly. The Pascals (and Delphi) also tend to have rather fast compile times. I believe Jai is supposed to compile quickly but I'm not in the beta so I don't know. C can be quite good if you know what you're doing and use a decent compiler.
- drnick1 8mo agoLiterally thousands of games have been written in C, and all graphics APIs (OpenGL, Vulkan, DX) are C APIs, so it isn't weird at all. All major game engines are also written in C/C++.
- jiggawatts 8mo agoDirectX is C++ (technically a set of COM interfaces) and most game engines are also C++. Unlike, say, Linux programming where C is the standard, almost all games have been written exclusively in C++ for a long time now, probably three decades.
- direwolf20 8mo agoCOM was designed to be compatible with C. Linux games are also often written in C++. The ones written in C are just old.
- jiggawatts 8mo agoSure, but in practice COM is almost never used from C programs unless there is some integration into a very legacy codebase. Games are newly developed, they’re not enterprise database platforms.
- direwolf20 8mo agoOpenGL is commonly used from C++ too, or Java, but you labeled it as C.
- cedilla 8mo agoThere are a few exceptions though, like most mobile games, visual novels (many of which use Python of all languages, due to an excellent framework called ren'py), and of course games written using Unity or XNA, which use .NET languages. Also, three decades is going a bit too far back, I think. In the mid nineties, C was still king, with assembly still hanging on. C++ was just one of several promising candidates, with some brave souls even trying Java.
- torlok 8mo agoI write mostly like I would in C, but use C++ features as needed. It ends up looking similar to Rust if you squint. All these "I write games in C" people complain about C++ features, and then end up reimplementing virtual interfaces manually with struct headers or massive switch statements, just to feel better about themselves. Writing games in C is not harder, you just have to implement modern language features by hand. Complaining about a language having features you don't want is silly. C++ doesn't take longer to compile if you don't abuse templates.
- pansa2 8mo agoYeah, you could argue that choosing C is just choosing a particular subset of C++. The main difference from choosing a different subset, e.g. “Google C++” (i.e. writing C++ according to the Google style guide), is that the compiler enforces that you stick to the subset.
- ninkendo 8mo agoC's string handling is so abominably terrible that sometimes all people really need is "C with std::string". Oh, and smart pointers too. And hash maps. Vectors too while we're at it. I think that's it.
- teo_zero 8mo agoI agree on the former two (std::string and smart pointers) because they can't be nicely implemented without some help from the language itself. The latter two (hash maps and vectors), though, are just compound data types that can be built on top of standard C. All it would need is to agree on a new common library, more modern than the one designed in the 70s.
- uecker 8mo agowhy not std::string?
- 8mo ago
- akoluthic 8mo agoIt's not unheard of, but you have to be a little crazy to do this in 2026. I developed Chrysalis entirely in C (with GLFW3 and FMOD for audio): https://store.steampowered.com/app/1594210/Chrysalis/ https://store.steampowered.com/app/1594210/Chrysalis/
- trueno 8mo agoI've been working religiously for like 2 years on the jedi academy codebase which is c & c++. It's Ravensofts variant of the idtech3 engine and it's insane how fragile the games combat is to precision and timing changes, I can't get away with adding much without destroying the lightsaber combat qualities. There are certain spots where I can't even add an incrementing i++ counter lmao it presents just enough of a slowdown or shifts something around that I haven't been able to track down that bleeds into the rest of the gameplay, but I am also sticking with the ancient compilers from 22 years ago so as to preserve the fpu characteristics of the game. There are some modern attempts at using this codebase with modern tooling but they've kind of bastardized/refactored all of it and it just feels different/unbalanced wrong. idtech3 is such an incredibly foray into c it's really something else and carmack and team really sent it back in the day.
- lylejantzi3rd 8mo agoAre you working on the original codebase or the OpenJK fork?
- ethin 8mo agoI write all of my games in pure C++. C++ all the way. FMOD for the audio engine, Steam Audio or Atmoky TrueSpatial for HRTF/geometric occlusion, and Jolt Physics for, well, physics. I'm sure many might say I'm a bit insane to do that, but eh, I do it anyway because it's fun.
- mapcars 8mo ago>I really dislike javascript, it is so loose that I marvel that people are able to write big chunks of software in it. I have no interest in trying. Because they use Typescript. >The stop-the-world garbage collection is a big pain for games There is a number of languages that allow manual memory management: Zig, Nim, Rust and few others
- archargelod 8mo ago> There is a number of languages that allow manual memory management: ... Nim Nim not only has support for manual memory management, but there're several gc modes that are not stop-the-world. Also, since Nim 2, the stdlib now is using ARC by default, which is deterministic and has advantages over conventional garbage collection.
- pjmlp 8mo agoPeople did do that, 30 years ago. Then Watcom C/C++ made it quite easy to use C++ for game development on PCs, PlayStation 2 introduced support for C++, quickly followed up by XBox and Nintendo, and that was it.
- HeavyStorm 8mo agoYes, C. Like all id games up to... Doom 3, if I'm not mistaken? Only then they switched to C++. There's absolutely nothing impressive about this fact.
- brokencode 8mo agoNobody claimed it was impressive. It’s a little unusual to use C instead of C++, but that’s about it.
- direwolf20 8mo agoIt's impressive these days when software quality and craftsmanship is declining.
- quotemstr 8mo agoPlenty of people cycle on a fixie too. So what? C, especially modern C, does provide metaprogramming and abstraction facilities. In practice, you can even get things like the "defer" construct from other languages: https://lwn.net/Articles/934679/ https://lwn.net/Articles/934679/ The question isn't "Can I write a game in C?". Yes, of course you can, and it's not even that painful. The question is "Why would you?", and then "Why would you brag about it?" > C++ covers my needs, but fails my wants badly. It is desperately complicated. Despite decent tooling it's easy to create insidious bugs. It is also slow to compile compared to C. It is high performance, and it offers features that C doesn't have; but features I don't want, and at a great complexity cost. C++ is, practically speaking, a superset of C. It being "complicated"? The "insidious bugs"? It being "slow to compile"? All self-inflicted problems. The author of this article can't even fall back on the "well, my team will use all the fancy features if I let them use C++ at all!" argument pro-C-over-C++ people often lean on: he's the sole author of his projects! If he doesn't want to do template metaprogramming, he... just doesn't want to do it. I don't read these sorts of article as technical position papers. People say, out loud, "I use C and not C++" to say something about themselves. ISTM that certain circles there's this perception that C is somehow more hardcore. Nah. Nobody's impressed by using it over a modern language. It really is like a fixie bicycle.
- enricotr 8mo ago"Practically speaking" means nothing. Use "from my confused point of view", instead.
- quotemstr 8mo agoIf GDB could switch its C codebase to compiling as C++ without major surgery, it's close enough.
- wudangmonk 8mo agoIf he doesn't use C++ features then there's no point of bothering with C++ at all. C++ is kinda but not really a superset of C. There are some nice features that are lacking in C++. The fixie example wants to make the comparison that using C instead of C++ is deliverately done just to brag about doing something in a way that is more difficult than in should be. In reality the issue is that C++ might not offer you any benefit at all and it could potentially bring you issues later on for things such as interfacing with other languages. I personally do not see the point of using C++ if you do not use any of its features.
- quotemstr 8mo ago> I like Go a lot. In many ways it is C revisited, taking into account what has be learnt in the long years since it was released. I would like to use it, but there are big roadblocks that prevent me. The stop-the-world garbage collection is a big pain for games, stopping the world is something you can't really afford to do. I'm no Go fan, to be clear, but GC isn't the problem with Go. It has a pretty decent GC with sub-millisecond pause times. People who complain about GC pauses while extolling the virtues of manual memory management are running on a set of prejudices from 1999 and are badly in need of a mental firmware update.
- nasretdinov 8mo agoYeah I was a bit surprised by this too. I think the post was written around 10 years ago, when it still was a genuine problem in Go.
- quotemstr 8mo agoGood eye. This is why HN titles have year tags. :-) Yeah, this is from 2016. I don't think choosing C over C++ was defensible even back then, but the critique of Go makes more sense now. https://web.archive.org/web/20160109171250/http://jonathanwhiting.com/writing/blog/games_in_c/ https://web.archive.org/web/20160109171250/http://jonathanwh...
- carefree-bob 8mo agoThe performance gains from bit-level control over memory come from managing the layout to ensure cache locality and do things like SIMD - and nowadays even GPU kernel offload. Enormous performance gains. I agree that it really isn't about garbage collection pauses, but I haven't heard people focusing on "eliminating gc pause" when they talk about low level languages, but they spend a lot of time talking about SIMD, GPU kernels, and cache misses. If Go could add these features, it would be a performance monster.
- nasretdinov 8mo agoGo defines structs the same way C does, so it's already encouraging thinking about and optimising the physical data layout. It also recently added experimental support for SIMD intristics: https://go.dev/doc/go1.26#simd https://go.dev/doc/go1.26#simd . Nothing on GPU side yet though, but I wouldn't be surprised to see it there eventually too :)
- pyrolistical 8mo agoI always liked C. I enjoyed how brutal it is, except the preprocessor. This is why zig is a godsend. It is actually simpler than C while being more precise than C! For example zig can distinguish between a pointer to a single element vs a pointer to an array of unknown length. Where as in c abi, it is all T* When importing a c lib, you can make it more ergonomic to use than c itself. Being able to easily import c lib is especially important to game dev, as practically all so called c++ libs also export a c header as they know how important it is. https://github.com/zig-gamedev https://github.com/zig-gamedev has a lot of repos of ziggified c libs used in games. As for the preprocessor, zig comptime is so much better. It’s just more zig that runs at compile time.
- dualogy 8mo ago> as practically all so called c++ libs also export a c header as they know how important it is In the gamedev space, I'd say too few of them do.
- p0w3n3d 8mo agoC has very low entry level, providing that you have some knowledge about memory management. When, as a Java developer, I had to quickly deliver some exchange connector using given .h and .so, I chose C, because C++ had too high entry level. If C is a sharp knife, C++ is a rotating pell post full of sharp knives. You can cut yourself even if you think you're safe. But I find string management in C awful and would like to borrow it from C++. Only the string management
- direwolf20 8mo agoThat's the neat thing about C++. You don't have to use any of it that you don't want to.
- 9rx 8mo ago[flagged]
- direwolf20 8mo agoDo you get a dopamine hit out of this?
- 9rx 8mo agoNothing about a dopamine hit out of it, no. Something about _main being an undefined symbol. Are you familiar with that error message?
- direwolf20 8mo agoHow did your equivalent assembly program without a definition of _main to? You're doing that thing. I think it's called "trolling". It goes like "hurr durr, they said take one, but they wouldn't let me take one plate" or "hurr durr, I filled my gas tank with nitrogen, which is a gas, but my car doesn't go" or "hurr durr, they said C++ features are all optional, but I don't want to use letters, how can I write C++ without using letters?" At least when that guy asked Stack Overflow how to make gcc compile his .png, it was actually funny.
- andai 8mo ago(2016)
- Bengalilol 8mo agoI did read the whole article thinking "who is he, his name reminds me something, but why isn't he providing game names?" and so on. Then I clicked on "back to main site". Revelation. A lot of his games are jewels. I have a special thing/relation with Sportsfriends. So many hours of fun while playing with my son.
- Mikhail_Edoshin 8mo agoI want to write general apps in C. Such as a raster image editor. I have some idea and C has exactly the right mix of simplicity and flexibility that I need. C is a constructor, and as a constructor it places few limits on what you can do. Other environments are way more rigid. E. g. I find Python way too rigid compared to C.
- seabrookmx 8mo agoGTK apps can be written in pure C. GTK itself is.
- sylware 8mo ago[dead]
- guerrilla 8mo agoAs a hardcore C programmer and zealot myself... How in the hell can you be productive like that? C is a systems programming language, not an application programming language, let alone relevant to the levels of abstraction you'd want in game development. That said, "I am dead" is a very real video game indeed... and his arguments are very sound. I also can't stand C++. I disagree with him on Java though. The core language of Java is actually super simple, like C.
- giancarlostoro 8mo agoWere not most games back in the day in C?
- pantalaimon 8mo agoQuake and Doom sure come to mind
- bowsamic 8mo agoMost games back in the day were written in assembly
- guerrilla 8mo agoBack in what day? Quake II I would say is the best good looking thing written in pure C. id Tech 3 is partly C++. Everything after that era was pretty much C++. Even GoldSrc is partly C++. Source was pure C++.
- giancarlostoro 8mo agoI guess back in my day, early to mid 90s. My understanding is C became more common.
- guerrilla 8mo agoWell I guess that was my time too but it was kind of a very short period. We went from assembly to C++ pretty quickly. Like things were assembly for a very long time, and they have been C++ for a very long time, but C was dominant mostly in that Doom to Quake II window.
- tombert 8mo agoI've been writing a good chunk of C lately for some stuff that has some relatively high memory constraints (lower than I could squeeze out of GraalVM). I know I could do C++, and you could argue that's better, but I find C++ to be exceptionally irritating to use. Every time I've used C++ I get people telling me I'm using it "wrong", sometimes in contradictory ways. Sometimes I should use a "friend" function, sometimes "friend functions are evil". Sometimes multiple inheritance is fine, sometimes it should be avoided like the plague. Sometimes you should "obviously" use operator overloading, sometimes you should avoid it because it's confusing because you don't know which functions are being called. I'm sure someone here can "educate" me with the best practices for C++, and maybe there will be some reasoning for it, but ultimately I don't really care. I just found the language annoying and I don't enjoy using it. I know that I could "just write it mostly like C and use the C++ features when I need it", but I have just found that I have more fun thinking in pure C, and I've kind of grown to enjoy the lack of features. Maybe it's just a little bit of masochism on my end, but I like the fact that C gives you so little. You kind of have to think about your problem at a very fundamental and low level; you have to be aware of how memory is allocated and deallocated, you don't get all these sexy helper functional-programming constructs, strings aren't these simple automatic dynamic things that you have in basically every other language. You have a dumb, simple language that will give you exactly what you need to write programs and very little else. Most stuff I write uses a garbage collector, but the safety and easy of writing stuff with garbage collectors like Java makes it very easy to be lazy. I've grown to appreciate how much C makes you actually think about problems.
- rramadass 8mo ago> I know I could do C++, and you could argue that's better, but I find C++ to be exceptionally irritating to use. Every time I've used C++ I get people telling me I'm using it "wrong", sometimes in contradictory ways. Sometimes I should use a "friend" function, sometimes "friend functions are evil". Sometimes multiple inheritance is fine, sometimes it should be avoided like the plague. Sometimes you should "obviously" use operator overloading, sometimes you should avoid it because it's confusing because you don't know which functions are being called. That is because you are looking at Design in C++ wrong. Language features and low-level abstractions are just mechanisms. You have to put them into a coherent framework for modeling a problem domain via commonality & variability analysis (aka domain engineering) onto a solution domain consisting of language features, idioms and patterns. For a very good explanation, see the classic book, Multi-Paradigm Design for C++ by James Coplien. The above can also be found in his PhD thesis Multi-Paradigm Design available in pdf form here - https://tobeagile.com/wp-content/uploads/2011/12/CoplienThesis.pdf https://tobeagile.com/wp-content/uploads/2011/12/CoplienThes...
- howToTestFE 8mo agoHas anyone got any good resources for something like this? I haven't touched C in years, and never worked on anything game-like. But it does look like a really interesting project to start something like this.
- anatoly 8mo agoraylib is one possible starting place. Also might look at dos-like (https://mattiasgustavsson.itch.io/dos-like https://mattiasgustavsson.itch.io/dos-like).
- lylejantzi3rd 8mo agoIf you have patience, the first 30 or so episodes of Handmade Hero are pretty good. https://guide.handmadehero.org/code/ https://guide.handmadehero.org/code/
- krapp 8mo agoHandmade Hero is a bad idea for anyone wanting to learn how to make a game in C or C++. Casey intentionally avoids using standard libraries and frameworks and his irrational hatred of high-level code and modern standards will lead developers astray and waste their time. Even if you're using C you don't need to implement your own renderer or do half the things he does. Get a library like SDL3 to handle the basics, maybe use Lua/LuaJIT for scripting. Learn OpenGL or Vulkan. Stay away from HH and Casey Muratori until you're experienced enough to tell the difference between his wisdom and his bullshit.
- lylejantzi3rd 8mo agoWe'll have to agree to disagree on this one.
- ddtaylor 8mo agoI need RAII and refuse to debug ugly macros as a workaround. The STL isn't perfect but it's a good guiding principle.
- direwolf20 8mo agoYou should try writing something serious in C just for the hell of it. And without RAII-like macros. Write all your allocs and frees.
- ddtaylor 8mo agoI very much have. I specifically like to craft ISAs for genetic algorithms over the last two decades. It's not work I publish because I never feel like it matters, although I regret that often. I very much enjoy writing C for this purpose in many ways and I actually enjoy some of the allowances that fit very well to writing an ISA where every bit of the instruction must map to valid behavior and nothing can be an invalid instruction. It's an ongoing struggle!
- csb6 8mo agoYes, having built-in generic containers and algorithms is the part that keeps me favoring C++. Bespoke versions of these can always be written in C (and work fine) but C++ makes it much easier and saves time. Lambdas and function objects are also useful.
- zuluonezero 8mo agoNice looking games though.
- JamesTRexx 8mo agoI'm pulling apart and rewriting so far a little in C a personal fork of OpenTTD 12.2. I began on it a few years ago for the first time for the heck of it after patching for realtime, began again while adding features I wanted until I hit a bad enough snag, and now began again by first extracting most used functions and profiling with Valgrind inbetween. Things I noticed are inconsistent coding styles, overly complex processes, unused(!) functions, inefficient data use, nothing surprising with a project worked on by various people in their spare time and their own ideas on how to code. And this isn't even talking about later versions. To me it's an example of how unrestricted access to bling features causes a mess. Eventually I want it converted to C (C23), split apart in seperate functions with a decent source code organisation, and simplified processes to make it easier to understand what's going on and extend fuctionality. For this I need it simplified as possible and weed out the layer of complexity caused by C++ first. Going to take plenty of time, but I'm still having fun doing it (most of the time anyway :-p ). I'm not advocating anything, but it's satifying to me to bring clarity to code and see small improvements to performance during the process at the same time. It also gave me an opportunity to develop a unique syntax style that visualises parts of the code better for me.
- uecker 8mo agoThis is great! This so rare that people remove the complexity again that has accumulated over the years. Most of the programming world is just accumulating entropy and then people give up and start fresh at some point, which is just sad.
- teunispeters 8mo agoI like C. You can take away all memory management (yes, including some of the unsafe glibc calls that have hidden memory management) and everything can be so smooth and clean. Since rules like MISRA require up-front allocation - if any is in use - this can be tightly controlled. Very useful if you don't want (or need) surprises anywhere. Or if you want all the surprises (exceptions, errors, etc) all better tied to the hardware that provides such. It's also fairly easy to write unit tests for everything.
- parasti 8mo agoWhat does "vanilla C" mean? Asking as a maintainer of 20 years of a game written in C.
- nottorp 8mo agoBtw, in the wannabe indie gaming scene it doesn't matter what language or tool or framework you use. It matters if you finish the fucking thing.
- zzo38computer 8mo agoI also use C, for games and other stuff. However, for many games it can be useful to have a game engine, which is written in C (and I might write it by myself) but other parts will be written in the game engine. I also sometimes program games on DOS, and will use BASIC or Pascal. You will then not need to have too many dependencies; if it is a DOS program then the executable file should just work (with emulation if necessary) without the mess that is common on modern computers.
- globalnode 8mo agothis is refreshing. personally i do all my hobby stuff in C or Python. I could certainly use c++ if i wanted to but templates and cin/cout were such monumental jokes how can i trust the rest of the language? i too have contemplated writing my own language but to paraphrase the author, id rather make games than languages and C/Python are good enough.
- deleted 8mo ago[deleted]
- cyh555 8mo agoI read this article years ago and haven't been able to find it since. It's a pleasant surprise to come across it here.
- smallstepforman 8mo agoNoble quest, but without operator overloading when dealing with Matrix*Vector you end up with an unreadable mess for physics, skeletal animation etc. There is a reason professional game dev is still 90% C++. (Funny enough, amateur gamedev is C# these days, students use what they learn at uni).
- andreamonaco 8mo agoI fully agree, in fact I'm writing a game in C too, it's https://github.com/andreamonaco/zombieland https://github.com/andreamonaco/zombieland. Plus I have at least another idea for a game project in mind with the same language.
- alexmyczko 8mo agoso do we, one example https://github.com/floooh/pacman.c https://github.com/floooh/pacman.c
- throwaway2037 8mo agoBefore I even read the blog post, my first thought was: "Bullshit, this feels like clickbait. Simple DirectMedia Layer (SDL2) [one of the most popular gamedev libs for indy games] is written in pure C." I guess that the only backdoor to this clickbait argument in 2026 can be: "My graphics/audio libary is written in pure C, but I use bindings with language X (C++/Rust/Zig/etc)."
- Western0 8mo agowhy? because You know C
- zenlot 8mo ago[dead]
- naranyala 8mo agowhat about: https://github.com/julelang/jule https://github.com/julelang/jule