Earlier quoted context omitted.
If by safe pointers you mean unique_ptr etc, I'm pretty sure those are classes: https://en.cppreference.com/w/cpp/memory/unique_ptr So by definition require OOP?
OOP is such a nebulous thing. Just because the word 'class' is used doesn't mean something is OOP. Those smart pointers don't use inheritance, they don't implement any interfaces, no virtual methods...
Why I Write Games in C (yes, C)
141–150 of 556 posts
Re: Why I Write Games in C (yes, C)
#142Re: Why I Write Games in C (yes, C)
#143> 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 love this opinion from games programmers because they never qualify it and talk about what their latency budgets are and what they do in lieu of a garbage collector. They just hand wave and say "GC can't work". The reality is you still have to free resources, so it's not like the garbage c…
>The reality is you still have to free resources, so it's not like the garbage collector is doing work that doesn't need to be done. Does it? In most game I expect resource management to be fairly straightforward, allocation and freeing of resources will mostly be tied to game events which already require explicit code. If you already have code for "this enemy is outside the area and disappears" is it really that muc…
Re: Why I Write Games in C (yes, C)
#144> 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 love this opinion from games programmers because they never qualify it and talk about what their latency budgets are and what they do in lieu of a garbage collector. They just hand wave and say "GC can't work". The reality is you still have to free resources, so it's not like the garbage c…
I know this subject quite well and I will later publish a detailed article. The real run-time cost of memory management done well in a modern game engine written without OOP features is extremely low. We usually use a few very simple specialized memory allocators, you'd probably be surprised by how simple memory management can be. The trick is to not use the same allocator when the lifetime is different. Some resourc…
Re: Why I Write Games in C (yes, C)
#145> 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 love this opinion from games programmers because they never qualify it and talk about what their latency budgets are and what they do in lieu of a garbage collector. They just hand wave and say "GC can't work". The reality is you still have to free resources, so it's not like the garbage c…
I know this subject quite well and I will later publish a detailed article. The real run-time cost of memory management done well in a modern game engine written without OOP features is extremely low. We usually use a few very simple specialized memory allocators, you'd probably be surprised by how simple memory management can be. The trick is to not use the same allocator when the lifetime is different. Some resourc…
Re: Why I Write Games in C (yes, C)
#146He didn't talk about Rust. I feel rust bridges the gap, it's just library support still sucks.
> and ideally I'd like to have the option of developing for consoles. So it's important that my programming language is portable, and that it has good portable library support. Every console will have a C toolchain out of the box, we can't say the same for rust.
Re: Why I Write Games in C (yes, C)
#147Re: Why I Write Games in C (yes, C)
#148> 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 love this opinion from games programmers because they never qualify it and talk about what their latency budgets are and what they do in lieu of a garbage collector. They just hand wave and say "GC can't work". The reality is you still have to free resources, so it's not like the garbage c…
Is the claim that 200us would be the worst case time for the GC to complete its work?
Is this worst case measurement one that the language itself guarantees across all platforms targeted by the game?
If you haven't measured the worst case times, and the system you are using wasn't designed by measuring worst case times, then we're not yet speaking the same language.
Re: Why I Write Games in C (yes, C)
#149Re: Why I Write Games in C (yes, C)
#150Earlier quoted context omitted.
Implying that typing does not prevent bugs is the strangest programming meme I’ve ever heard, and its proponents push it so hard that I wonder if there’s somewhere I can sign up to be paid for it. We rarely are able to directly compare the cost/benefit of strict typings vs loose typings, but with JS vs TS you get a pretty direct comparison, and it is absolutely unsurprising that TS is eating the JS world; it does pre…
> TS is eating the JS world Definitely another reason to stick to C. In C you don't have to change to another language or another framework, or yet another design principle, or whatever hype that is being followed by a horde of idiots that think they're incredibly smart. C is still C. I love that so much. No endless discussions about type safety. And yes, with C I can shoot myself in the foot, which is great because…
Even if we ran with it, like, would a cook use a knife with a sharp handle because it's "more sharp"??
I get what you mean though: C is pretty liberating. It gets out of your way and let's you be pretty precise about what you want it to do. In return you have to... well, be precise. If you have a bug it feels like you just need to get better. If a language makes too many promises and fails you, it feels like it let you down.
But I feel that way about Java vs. Scala, so what do I know.