Google-apps
Hoofdmenu

Post a Comment On: C0DE517E

"C++, it’s not you. It’s me."

8 Comments -

1 – 8 of 8
Anonymous Alex said...

It's clear to me that C++ has a very useful and powerful ecosystem for the game development community but have two doubts:
1) While game development community is very diffident about all recent extensions some programmers stated at the end that they are not interested in using such sophisticated extensions.
2) I am wondering why the rich videogame industry has not yet take into account the development of a programming language dedicated to videogame development.

February 26, 2019 at 2:31 PM

Blogger DEADC0DE said...

I didn't get what you're asking in 1), but I'll gladly answer 2)

Videogame studios should never ever make their own programming language. And they already do. Allow me to explain.

Unfortunately there is this common misconception that the more revenue you make, the bigger your company is, the more you have freedom to do things. This is wrong. Usually money comes with more restrictions on how you invest it, not less. Especially in the common case where making a big company means dealing with other people's money (investors, either private or public).

In this context, making a C++ replacement would be foolish. A serious programming language is a decade-long endeavour, just to get started. Then there is the ecosystem problem and finding and training talent. All the hot new languages people talk about, are really 10+ years old. In 2011 I wrote a long post about programming languages, and I never found it useful to write another one because I never thought the landscape changed. I talk back then about Rust for example, and what I thought back then mostly still applies today - http://c0de517e.blogspot.com/2011/04/2011-current-and-future-programming.html

Replacing C++ would be only an improvement for programmers, if any! That's to say, assuming we are successful, which, given how hard is to work the ecosystem, is not an easy thing. You want to have profilers, debuggers, linters, code-reviewing, distributed building/caching and so on and so forth. And all this in a context where you change platforms every 6-7 years (consoles, phones, whatnot) and you have zero control over these platforms (e.g. would they still use LLVM? who knows).

Programmers don't really matter, in the grand scheme of things. Yes yes, you heard me. Games, especially big games, are mostly content when you look at costs, and mostly design when you look at innovations that matter/make users happy/sell...

Of course there is the argument that if you make programmers happier (more productive), these can in turn make it "trickle down", but in practice that's also true to a limited extent. How do I know? Well, because I've never seen a game company where we had even addressed just all the "low hanging fruits" for productivity enhancements with the tools we have. Not for programmers, not for artists and so on. There is always a balance between getting these multipliers, and the reality of also shipping a game and keeping the production happy. If you've played any management game, Sim City, Stardew Valley, Starcraft, whatever you like, you'll have experienced these tradeoffs!

That if for "we should never do it" part. Why I say though that we already do? Because we do! But in the part that can get us a ROI. I said that game design for example is much more important. And in fact you will find there lots of custom scripting languages and environments made to help people create new things. Even custom VMs, custom compilers, transpilers and so on. Same with artists, you get node-graphs, scripting languages and other similar things.

Hope this helps!

February 26, 2019 at 6:41 PM

Blogger DEADC0DE said...

(that's also why it's most likely for languages to be started by individuals with some amount of time on their hands, e.g. https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md or say http://arclanguage.org/ or dunno, https://bitbucket.org/duangle/scopes/wiki/Home https://nim-lang.org/ and so on and so forth)

February 26, 2019 at 7:11 PM

Blogger masterden said...

Have you ever looked at D language?

February 26, 2019 at 7:51 PM

Anonymous Shafte said...

You said:
“Nowadays, a lot of high-performance code leverages specialized compilers that use are embedded in relatively high-level languages via reflection.”

What are some examples of this approach?

February 27, 2019 at 12:49 AM

Anonymous Edward said...

Unity's Burst compiler is a great example of this. Written in C#, but with a specialised compiler to write high-performance byte code based on a subset of the language http://lucasmeijer.com/posts/cpp_unity/

February 27, 2019 at 6:42 AM

Blogger DEADC0DE said...

Yes, also plenty of numerical, big data and machine learning things. For example, pyCuda, parakeet python, numba, cython, theano, pytorch and so on... All code-generators that either use the python AST or equivalent methods to embed themselves in the language.

February 27, 2019 at 11:20 AM

Blogger DEADC0DE said...

Yes, I've looked at D.

Some old articles: http://c0de517e.blogspot.com/2011/04/2011-current-and-future-programming.html

http://c0de517e.blogspot.com/2014/06/where-is-my-c-replacement.html

http://c0de517e.blogspot.com/2014/06/bonus-round-languages-metaprogramming.html

The tl;dr; version is that yes, D is wonderful. It's C++ done right. Even Rust could be wonderful, but I personally "disagree" with the borrow-checker (its usefulness in our domain).

But, all these things are incremental improvements, and I think they won't fly. Relatively small improvements are ok only if you keep full compatibility with the past (like C++ did with C).
Otherwise you'd really need to show a huge leap to be able to win over the inertia of our large, risk-averse, multi-platform legacy codebases and all the very significant tooling ecosystem built around them.
Especially as, then again, there isn't a lot of space for improving the "living coditions" of these C++ codebases. There is some space, yes, but not for huge investments, because at that point you run into tradeoffs where your time would be much better spent improving other areas that impact the end product more.

February 27, 2019 at 11:42 AM

You can use some HTML tags, such as <b>, <i>, <a>

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.
Please prove you're not a robot