Live data from Hacker News

Why I Write Games in C

jonathanwhiting.com

31–40 of 303 posts

Re: Why I Write Games in C

#31
post #11

I thought Lua was great for games development, the author does not mention it. http://www.lua.org

Lua is widely used as a scripting layer on top of a game engine. The intense calculations needed to generate a high-fidelity simulation like graphics and physics are usually implemented in the engine in C++, and then the game logic/item behavior/etc. is defined in Lua. I haven't heard of anyone using pure Lua for a whole game, including the engine. It'd be really interesting to see what it looked like if someone did…

Those aren't the types of games he's making, though.

Re: Why I Write Games in C

#33
Delphi compiles extremely fast, is strongly typed, no GC, has templates, objects. Too bad Embarcadero positioning towards Enterprise with its relatively high pricing effectively derailed it as a mainstream language and killed its community.

Re: Why I Write Games in C

#34
post #23

If by "strict typing" you mean strongly typed then you are factually incorrect. By virtue of casting C is weakly typed, as is Java, C++ et al. If your understanding of strict typing is statically typed, i.e. that types are checked at compile time then C still has some flaws as you could write a whole slew of C that is "typeless" using void * although that would be terribly misguided. I understand your intent, but I d…

As Dennis Ritchie once said "C is a strongly typed, weakly checked language."

Re: Why I Write Games in C

#35
post #21

The article mixes up the virtues of a programming language with the quality of the environment. C might very well be the best language in our current environment, which says little about the language itself. One major point certainly is, that it is that good compilers are available everywhere and almost any library can be used from C. There are a lot of historic reasons for that. If he wants strict typing, C is actua…

The Google Go team lives in a completely different environment. Their perspective of performance is not the same as a game dev. Go 1.5 stated their goal was 10ms GC latency. A game loop is 16ms for a 60fps game. 10ms is not close to acceptable. Fast for a web server backend, but not fast for a game.

Re: Why I Write Games in C

#36

Delphi compiles extremely fast, is strongly typed, no GC, has templates, objects. Too bad Embarcadero positioning towards Enterprise with its relatively high pricing effectively derailed it as a mainstream language and killed its community.

And doesn't have console support (AFAIK).

Re: Why I Write Games in C

#37
post #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.

If you're going to write a TL;DR for others, you should at least read the article yourself, don't you think?

[deleted]

Re: Why I Write Games in C

#38

What about Rust?

I like Rust, but sometimes it is pretty difficult to convince the compiler that one's code is safe. And this does not mean that the compiler is preventing unsafety; there are many safe programs that the compiler rejects. Also, the OP said that compile time was a priority, and compiling Rust code is closer to C++ speed than C.

There are many valid programs that static typing rejects, too. Question is whether the trade off is worth it (and the answer isn't the same for everybody)

Re: Why I Write Games in C

#39
post #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.

If you're going to write a TL;DR for others, you should at least read the article yourself, don't you think?

I did, it is so abstract to pretend you can do better that there is no way to discern. He didn't even mention "unity" in his post, thats just ridiculous in 2016, but yeah, keep down voting, your implementation of 2d graphics, sound, collision, physics, plugins, marketing, sprites, menus is gonna be so much better than hundreds of engineers at unity withing 10 years straight.

Re: Why I Write Games in C

#40

The thing I miss most in C when I don't cheat and use a couple C++ features is templates. Specifically, a dynamically sized List implementation that is type-generic. If you do this in pure C, you have to pick your poison: 1. preprocessor abuse 2. void * 3. multiple redundant implementations of the data structure Dynamically sized lists are used so often, that this tends to be a problem in almost every C project. I wo…

Just use queue.h, as do all the BSDs.

https://github.com/freebsd/freebsd/blob/master/sys/sys/queue...

Post reply on HN