Live data from Hacker News

Why C++ for Unreal 4

forums.unrealengine.com

91–100 of 178 posts

Re: Why C++ for Unreal 4

#91

It will be interesting if any major game engines pop up using Rust as the core language, or even Go. C++ has been the king of highly optimised game engines for so long, I can't help but feel it has become so entrenched in the industry that it will take something monumental to disrupt it.

I don't think it will happen with Rust until it becomes more stable with no breaking changes between releases. As for Go, it's not very well suited to this domain. Or at least no better suited than Java or C#.

> I don't think it will happen with Rust until it becomes more stable

Indeed. Most of the trail blazing work is being done by professional game devs in their spare time, hobbyists, indies and students who are willing to endure the pains of early adoption for the incredible gains that Rust gives them. It will only be post 1.0 however that the bigger players will be able to even consider using Rust. It's too risky to bet an entire company on – and that's coming from somebody who is willing to bet their indie project on it. ;)

Re: Why C++ for Unreal 4

#92
post #85
post #80

Earlier quoted context omitted.

Digital had bumper profits just before they went under - it's typical, as they go upmarket, to get greater profits. But I'll accept that you get what I'm saying. :) Another data point: id was killing it (and, to us, Carmack remains undisputed). But they completely lost out the next generation, to Unreal, because of vehicles. I don't think that'll happen here, just disclaimin' past performance is no guarantee of futur…

They didn't even open the latest Id tech to public... They didn't even go to the game. It has nothing to do with vehicles.

It was an example of losing dominance, not to do with open.

Re: vehicles. I'm going by what Carmack said in an interview.

Re: Why C++ for Unreal 4

#93

It will be interesting if any major game engines pop up using Rust as the core language, or even Go. C++ has been the king of highly optimised game engines for so long, I can't help but feel it has become so entrenched in the industry that it will take something monumental to disrupt it.

I don't foresee big, established C++ code bases like the Unreal Engine being re-written from scratch, but once Rust reaches 1.0 it will definitely be a very compelling choice for new projects. It will start with the side-projects and indie projects, and gradually work its way up to larger and larger projects as the language proves itself. It's not a something that will happen overnight.

Re: Why C++ for Unreal 4

#94

We've also been there done that (about 10 years ago though), we had a very powerful scripting approach integrated into our game engine which gave direct access to game play systems in order to let our level and game designers build scripted behaviour into the game. In the end we ended up with a terribly huge mess of script code (I think it was about a third of the actual C/C++ code) and the majority of the per-frame…

> The main problem with scripting layers is that you are basically handing programming tasks over to team members who's job is not to solve programming tasks, and thus getting a lot of beginner's code quality and performance problems which are almost impossible to debug and profile (unless you have a few top-notch coders in the game- and level-design teams).

It sounds like having a real software engineer do code reviews and/or rewrite the poor scripts before they get committed would be a solution to this problem. Presumably giving level designers the ability to script things is good for the game play.

Re: Why C++ for Unreal 4

#95

We've also been there done that (about 10 years ago though), we had a very powerful scripting approach integrated into our game engine which gave direct access to game play systems in order to let our level and game designers build scripted behaviour into the game. In the end we ended up with a terribly huge mess of script code (I think it was about a third of the actual C/C++ code) and the majority of the per-frame…

The biggest advantage of scripting for me has been

1. Co-routines

Co-routines (co-operative multi-tasking?) mean you can do stuff like

    while (isWalking()) {
      advance();
      yield();
    }
    
This is effectively 'yield' from Python, C#, etc.. You can implement this in C++ by swapping stacks and calling setjmp but there's usually issues.

2. Iteration time

You can usually swap script code live. This project aims to fix that for C++ though I'm a little skeptical it can stay robust

https://github.com/RuntimeCompiledCPlusPlus/RuntimeCompiledC...

Re: Why C++ for Unreal 4

#96

Earlier quoted context omitted.

Honestly, I've made over 15 games in my career and safety with C++ really just isn't an issue with decent developers. The line between what's a programmer for games and what's a designer is narrowing, most designers are competent programmers. Furthermore, there's some great tools out there to help prevent things like memory leaks. Combine that with good company practice, like code reviews, and it becomes a non-issue.

> Furthermore, there's some great tools out there to help prevent things like memory leaks. Combine that with good company practice, like code reviews, and it becomes a non-issue. The security track record of applications written in C++ disagrees with you.

Selection bias much? The 500,000 C++ applications that have never blown up in somebody's face aren't discussed on Hacker News.

Re: Why C++ for Unreal 4

#97

It will be interesting if any major game engines pop up using Rust as the core language, or even Go. C++ has been the king of highly optimised game engines for so long, I can't help but feel it has become so entrenched in the industry that it will take something monumental to disrupt it.

What's the appeal of Rust for gamedev?

- Fine grained control over allocation whilst maintaining memory safety (stack, heap, RC, GC, or roll your own)

- No null pointers (with an Option type that compiles down to a nullable pointer)

- Data race free concurrency

- Zero cost abstractions

- RAII and destructors

- No exceptions

- A modern, highly expressive type system

- Generics that throw type errors at the call site, not deep in a template expansion

- True immutability (not `const`)

- An excellent C FFI

- Compiles to native code

- You don't pay for what you don't use

- Safe by default, but you can circumvent the safety checks if you know what you are doing, and those places are clearly marked and easy to audit. Inline assembly is supported.

- Most safety is enforced statically, so you don't pay for it at run time.

Re: Why C++ for Unreal 4

#98
post #92
post #85

Earlier quoted context omitted.

They didn't even open the latest Id tech to public... They didn't even go to the game. It has nothing to do with vehicles.

It was an example of losing dominance, not to do with open. Re: vehicles. I'm going by what Carmack said in an interview.

That sounds really weird, do you have a source for that interview?

Re: Why C++ for Unreal 4

#99
finally.

Now, to make the gameplay programmer and level designer's job easier, you still have to build well made and documented building blocks.

It's either that or hire people who do know how to talk a statically typed language. Might be good news for the job market, I always found it weird to have people making games who were not really competent in programming. always baffled me.

I guess you can still force people who are unable to write good c++ to write c++ anyways and hire somebody else to valgrind everything. In the end using a statically typed language is more a requirement for performance, clarity and consistency than a lack of flexibility.

Setting the bar high or demanding discipline if you prefer. Computers are stupid, so you need to be precise when you work with them.

Re: Why C++ for Unreal 4

#100

We've also been there done that (about 10 years ago though), we had a very powerful scripting approach integrated into our game engine which gave direct access to game play systems in order to let our level and game designers build scripted behaviour into the game. In the end we ended up with a terribly huge mess of script code (I think it was about a third of the actual C/C++ code) and the majority of the per-frame…

The biggest advantage of scripting for me has been 1. Co-routines Co-routines (co-operative multi-tasking?) mean you can do stuff like while (isWalking()) { advance(); yield(); } This is effectively 'yield' from Python, C#, etc.. You can implement this in C++ by swapping stacks and calling setjmp but there's usually issues. 2. Iteration time You can usually swap script code live. This project aims to fix that for C++…

UE4 has hot reloading of C++ code. Some of their demos were pretty impressive. However I'd have to use it for a long period of time on a "real" project to see how reliable it truly is.
Post reply on HN