Live data from Hacker News

Why I Write Games in C

jonathanwhiting.com

1–10 of 303 posts

Re: Why I Write Games in C

#4
"C# ... does a lot to railroad a programmer into a strongly OOP style that I am opposed to".

C# has functional capabilities as well. People write in it nowadays in a whole lot of different styles, including procedural, OO, functional, reactive.

Yes, the average developer uses it in an OO style, but it can do a lot more.

Re: Why I Write Games in C

#5
> I would like to use [Go], 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.

GC pauses in Go should not be a serious issue for games like the ones featured on the OP's site. The same general techniques used for high-performance manual memory management work fine in garbage-collected languages -- allocate on the stack if possible, allocate the heap you're going to need up front and reuse it (with object pools or the like).

> The library support for games is quite poor

I would say the same for C, honestly. Last time I was looking for game libraries to write a binding to (from OCaml) I found more C++ and Java options than C.

Re: Why I Write Games in C

#6
I understand the want for simplicity in C (and Go gets closer, but has its issues), however, it seems in the end it drags you down.

Just having the C++ ability to have objects doing things is very helpful. But yeah, C++ has the ability to get very complicated

But it's your choice to have "complicated C++". Limit yourself to some functionalities and it's much more manageable.

Use basic STL and keep it simple (also C++11 at least) and it's a very pleasant experience (or less worse experience, depending on your point of view).

Re: Why I Write Games in C

#8
TL;DR Many people is making money doing Unity games, so I ignore it exists - for $1500 - and I go the hipster way and create my own hundreds of memory corruption bugs myself.

Re: Why I Write Games in C

#9

I understand the want for simplicity in C (and Go gets closer, but has its issues), however, it seems in the end it drags you down. Just having the C++ ability to have objects doing things is very helpful. But yeah, C++ has the ability to get very complicated But it's your choice to have "complicated C++". Limit yourself to some functionalities and it's much more manageable. Use basic STL and keep it simple (also C++…

I think that's what most engine developers do nowadays. Sticking to some part of C++ to a point that it looks like C with classes. Hey, some don't even use STL and go with their own libraries.

Re: Why I Write Games in C

#10

What about Rust?

Exactly. Compilation times and young age might be an issue, but if the guy likes C and Go, then why not Rust?

The reason people might want to avoid it can be the same as "Why not D". The answer to that is that it doesn't offer enough over C and C++, which is where Rust is different, and why I think Rust will be huge.

Post reply on HN