Live data from Hacker News

Thoughts on Modern C++ and Game Dev

elbeno.com

101–110 of 143 posts

Re: Thoughts on Modern C++ and Game Dev

#101
post #38

Earlier quoted context omitted.

You should use SDL for this and not DirectX. You don't need complex API for GPU to paint line if you concerned about complexity.

Have you looked through the SDL source, though? Sure, I can get a window open and paint lines very easily, I only have to write ~50-150 LOC. However, I've silently added thousands of lines (and at least one dll) to my project. The library only hides some of the complexity (which I love about it), but the complexity still exists.

https://stackoverflow.com/a/35989490

Re: Thoughts on Modern C++ and Game Dev

#102
post #38

Earlier quoted context omitted.

You should use SDL for this and not DirectX. You don't need complex API for GPU to paint line if you concerned about complexity.

That's just piling on even more abstraction! You may as well use a hex editor and create a single line BMP, then "run" it with any image viewer.

"more abstraction"? It's just one to be cross platform, you can't use OpenGL without it.

No need to go full shit ape and creation of 3D images in bmp is excellent exercise you should try.

https://github.com/ssloy/tinyrenderer

Re: Thoughts on Modern C++ and Game Dev

#103
post #82

Earlier quoted context omitted.

Garbage Collection is not per default something bad, even in game development, its a method of memory management, just like reference counting, or manual memory management. If you are allocating memory in your renderloop, your likely doing it wrong. Allocation outside of this critical path, well, chose your poison. GC will consume more memory, but likely to be faster when it comes to allocating and deallocating large…

Sure, you can. But then you need to manage when GC triggers. Because if you don't, you'll drop frames. And then the real choice is between C++ where there is (little) extra work getting RAII correct vs GC languages where you need to keep preventing GC up to a point where it's okay to freeze the universe.

There are plenty of predictable garbage collectors now days, Shenandoah for example, Azul's C4 implementation is completly pause-less and concurrent. ZGC provides very low pause times (1 ms)

Re: Thoughts on Modern C++ and Game Dev

#104
post #96

I'm not in games but my industry is adjacent and I have the same gripes with c++. (Which the author characterized very well.) Although build and debug times definitely are an issue regardless of the performance of the hardware. I find reading C++ "standards" papers onerous and feel like they're written in a way that's deliberately inaccessible. I don't much like the idea of going to CppCon -- even if my company funde…

I find reading medical "standards" papers onerous and feel like they're written in a way that's deliberately inaccessible. I don't much like the idea of going to Medical Conferences -- even if my company funded it, which maybe they would, I feel like I'd be marginalized for not knowing basic medical techniques, not knowing the new hotness by heart, and generally being a proponent of bleeding with leeches. I just feel…

You're being flippant, but your paragraph is the reason we have pharmaceutical sales reps, and the reason they are so well paid.

Re: Thoughts on Modern C++ and Game Dev

#105

Earlier quoted context omitted.

Modern games have only increased the benefits a game studio can gain from testing as well. Games are now moving into service territory which only increases the amount of time spent maintaining the game while continuing to add to it.

This. Determining when the effort should be applied is the tricky part. Games are still hit driven and get cancelled/re-purposed during development. You can spend a lot of QA engineering time developing systems to test functionality that never ships (case in point would be Fortnight - the original shipped game did not need to be tested against the current 100 player game instances and huge load but they could have sp…

I don't disagree that it's important to understand when something is purely a proof of concept vs something that will stick around to evaluate the costs. However, the AI systems are still in Fortnite (and they even used those systems for the Haloween event). The major money making part of Fortnite has been the battle royale mode though. If they open up the main game to be free-to-play similar to the battle royale mode those systems will probably end up being used quite a bit.

Re: Thoughts on Modern C++ and Game Dev

#106
post #98

Earlier quoted context omitted.

It does seem that it seems that way. As someone who's pretty familiar with the current state of C++ and also has a long history in the games industry however I don't believe it actually is that way. I think the problem is more one of perception than reality but many of the complaints come from people who don't know what they don't know and I'm not sure the best way to fix that problem. The resources for them to educa…

You're very quick to call people ignorant and make uncharitable assumptions about their motivations. If your attitude is the common one, then it does seem that the opinions of regular C++ programmers are not valued by the people involved in the standards process.

I'm quick to call people ignorant who demonstrate their ignorance. It's not even an insult - I'm ignorant about lots of things. There's nothing wrong with being ignorant about something if it's not important or relevant to you. However, if you want to get involved in technical discussions about a topic that is of importance or relevance to you then I believe it is your responsibility to take advantage of the resources available to you to learn about that topic so you're not ignorant any more. In my experience the C++ community is quite helpful and generous about helping people who want to learn but you're going to have to do a certain amount of the work yourself.

I'm not part of the standards committee nor do I represent the C++ community as a whole. I personally am not particularly interested in trying to educate people who don't want to be educated. That doesn't say anything about whether I or anyone else in the C++ community is interested in the opinions of regular C++ programmers.

Re: Thoughts on Modern C++ and Game Dev

#107
post #98

Earlier quoted context omitted.

You're very quick to call people ignorant and make uncharitable assumptions about their motivations. If your attitude is the common one, then it does seem that the opinions of regular C++ programmers are not valued by the people involved in the standards process.

I'm quick to call people ignorant who demonstrate their ignorance. It's not even an insult - I'm ignorant about lots of things. There's nothing wrong with being ignorant about something if it's not important or relevant to you. However, if you want to get involved in technical discussions about a topic that is of importance or relevance to you then I believe it is your responsibility to take advantage of the resource…

Arandr0x hasn't demonstrated his/her ignorance. I'm not sure what you hope to achieve by harping on the ignorance of unnamed persons who aren't participating in this discussion.

Re: Thoughts on Modern C++ and Game Dev

#108

Earlier quoted context omitted.

I'm not sure what most teams do now-a-days but I went to GDC in Koln and saw the Croteam talk. Over 10 or so years by programmers just adding a little here and there as it occurred to them they had build a pretty cool testing system. First they had made it so if someone was playing the game and saw a bug they could press the "file a bug" key, type in a description and the game would save out enough info to bring some…

Similarly, on a game I worked on we had a “controller monkey” that would spam all possible player actions (move, jump, attack, special powers) rapidly and randomly. We then had the testers record multiple paths exploring through each level. Every few seconds the monkey-controlled player character would be teleported a bit further down the path to ensure progress and coverage. Dozens of people would set the monkey to…

I feel like when people just say "tests" there's a lot of conflating. Usually, on a site like this or on a blog post, "tests" are referring to automated unit-testing or talking about TDD...which is probably most rare and most fought against in game dev (from what I've seen from an adjacent industry).

Testing, in general, is pretty essential to writing code that does what you want. Test code is just automating what you'd be doing manually and it's a lot faster to have the code do it than for me to do it 10 times. Even if that's printing out a value or showing it in a debugger. Testing frameworks or libraries to fuzz out problems and harden code are quite common. Game dev often has a lot of manual play testers. Most engines and dev consoles have a lot of tools to either just record the screen or save state when problems are seen.

Heck, most "cheat codes" were added to jump around the came to test for bugs. That's technically "test code."

Re: Thoughts on Modern C++ and Game Dev

#109
post #54

Earlier quoted context omitted.

> But his argument fits well with C++'s history of finding exceedingly complex solutions for simple problems. Want to have efficient matrix calculation? Well, who needs native support for matrices when you can do the same with expression templates and static polymorphism/CRTP (see: Eigen library). I have to defend C++ here - "native matrices" is under-specified. In practice, "Matrix" is one of the leakiest abstractio…

For many projects you won't need that complexity. You just want to directly map basic matrix operations to the usual BLAS/LAPACK calls. Fortran 90+ does that job well, for instance, and performance will usually be better than a C++ library (yes, I've tested against Eigen and Armadillo, although that was years ago). Combine that with the enormous compile times and the absolute ridiculous error messages for even simple…

I'm confused. Are you suggesting that Fortran is a good environment for game development?

Re: Thoughts on Modern C++ and Game Dev

#110

Earlier quoted context omitted.

If you want to get involved and for your voice to have value then you have to educate yourself on the subject. Unfortunately too many of my former colleagues in the games industry (I'm now in a "games adjacent" industry too) fail to do this before complaining about C++ and have the same attitude of "it's not fair that I should have to know what I'm talking about before anyone will listen to my complaining seriously".…

I've read some of the drafts and the final spec of the APIs I care most about, for example, the concurrency API (which I like a lot... I'm not solely complaining!). Do I need to watch every talk on every C++ feature before anybody in the C++ community will want to talk to me? Because I'm paid to actually write code. (I mean normally. Today my boss isn't back from vacation so you get to read my rants on HN.) Here are…

The standards committee is a volunteer effort. Some of the most active participants have employers who consider their involvement as part of their job responsibilities so they are at least partly being sponsored by their employers but plenty of people involved in the standardization process and attending conferences are not paid by anyone for their participation and are in fact paying the costs of attending out of their own pocket. Hardly anyone in the C++ community is directly paid to sit around learning more about the language. If you wanted a career where you didn't have to put in learning on your own time to keep your skills current I think you picked the wrong one.

It's a fairly involved process to get a new library standardized. Functionality that's not included in the standard library may be missing because it's hard to get agreement on what is required, because there isn't anyone sufficiently motivated to drive it through standardization or because the committee just hasn't got round to it yet.

I don't consider this particularly problematic in many cases. Some functionality probably shouldn't be part of the standard IMO. For example, there's been some effort to standardize a 2D graphics library and I'm of the opinion that should not be part of the C++ standard. I'm inclined to think the same thing for geometric primitives, for similar reasons. Certain types of library are better left to competing open source libraries for now I believe.

Implementations are not the domain of the standards committee. It's rather inconsistent to demand relatively niche new library functionality for geometric primitives at the same time as wanting the committee to stop adding things to the standard faster than Microsoft can keep up however.

Concurrency is complicated and there are a lot of pitfalls which the standard library has gone to great lengths to avoid. It sounds like you're misunderstanding the best way to use atomics but without knowing more about your use case I'm not clear exactly how.

Coding standards are not really the domain of the standard and some things that have multiple possible ways to write them have to be maintained for backwards compatibility. If you want to standardize things like const placement however, tools for automatic formatting and transformation of C++ are getting better all the time thanks to clang/llvm.

C++ occupies a niche which necessitates it being a bit less beginner friendly than some languages and a bit more demanding on users putting in the effort to learn the language. That's what makes it fairly uniquely suited to certain use cases. I don't see that as a bad thing. I don't really know what you're asking for to be honest. My advice to anybody who uses C++ as a major part of their career to invest a decent amount of time into learning it better though, just as I'd advise them to spend time learning more in any domain that is a big part of their professional life.

Post reply on HN