Live data from Hacker News

I write games in C (yes, C) (2016)

jonathanwhiting.com

21–30 of 288 posts

Re: I write games in C (yes, C) (2016)

#21
post #18

Literally 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++.

DirectX 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.

Re: I write games in C (yes, C) (2016)

#22

its 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 deg…

For 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.

Re: I write games in C (yes, C) (2016)

#24
post #7

its 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 deg…

> UI in C Try Clay! https://www.nicbarker.com/clay

There’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

Re: I write games in C (yes, C) (2016)

#25
I 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.

Re: I write games in C (yes, C) (2016)

#26
>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

Re: I write games in C (yes, C) (2016)

#27
People 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.

Re: I write games in C (yes, C) (2016)

#28
post #18

Literally 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++.

DirectX 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.

There 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.

Re: I write games in C (yes, C) (2016)

#29
post #18

Literally 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++.

Khronos APIs are C, DirectX is C++ exposed via COM or WinRT, Metal is Objective-C with C++ for shaders and Swift bindings, on Nintendo and PlayStation depends on which console generation you talk about.
Post reply on HN