Live data from Hacker News

Why C++ for Unreal 4

forums.unrealengine.com

81–90 of 178 posts

Re: Why C++ for Unreal 4

#81

Earlier quoted context omitted.

The LuaJIT interpreter is surprisingly fast. Still not as fast as the JIT or an AOT compiled language though...

His point though is that JITs (like LuaJIT) are often not allowed on consoles for security reasons - they don't allow running of unsigned code. So LuaJIT might not be an option.

As myrmidon said, LuaJIT ships with a very fast interpreter.

What I was trying to say is that, while its not as fast as JIT or AOT, it is still extremely fast (many times faster than the reference Lua implementation apparently).

Re: Why C++ for Unreal 4

#82
post #65

Am I cynical? The recent changes in Unreal 4 make me think the company is in extremely serious trouble. It's because they aren't addressing the key reason people buy a graphics engine ( viz graphics), but all this ancilliary stuff. While it is important, it's off center... But maybe they are just trying to fend off Unity (open source, a more coherent experience). Usually when companies do this, it's too late. I've no…

Last I checked Unity was a closed-source proprietary engine that I had to pay money for.

I'd say they should start worrying about Unity when something like Unreal Tournament 2004 (a decade old game btw) comes out built with Unity.

Re: Why C++ for Unreal 4

#83
post #59

It's important to note that what is being talked about in this post is not, "why we wrote the Unreal engine in C++", because it already was in C++. Many games, older Unreals included, had a separation between "code" and "scripting", where stuff like animations, weapon firing, etc. was written in scripts, in the belief that this would be easier to update as required vs. C or C++ code. Doom 3 and previous Unreal engine…

Brief rant:

Quake 1 ran a virtual machine, which QuakeC compiled down to. Quake 2 ran native code via DLLs. Quake 3 ran either VM code or native code--depending on how clever you wanted to be, you might need to break into the native code.

There wasn't some "mistake" about using scripts-vs-code, because they would actually compile down to executable bytecode. This made it much easier to load mods over the network if you needed to, and to port their tech to different architectures.

idTech 1-3 internally were a lot more like VR operating systems than scriptable game engines.

and the limitations of scripts, outweighs any gains from being "easier to edit"

Wrong, wrong, and wrong. The mod scene flourished back in the day specifically because it was so easy to bodge together mods in these friendlier environments--especially in the Unreal series.

The place where scripting falls apart is in modern AAA games where way too much stuff is expected of/exposed to designers, and then you end up with gigantic sprawling piles of poor performance. A friend worked with a licensee of the Unreal engine for a few games, and their script dispatch switch went on for...well, let's just say that many good programmers lost many good hours in those mines.

Scripting is a perfectly good tool, and one that makes sense until you start doing crazy AAA stuff with it.

Re: Why C++ for Unreal 4

#84

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.

They're talking about games in C++, not random C++ apps. Oranges to apples.

Re: Why C++ for Unreal 4

#85
post #80
post #73

Earlier quoted context omitted.

note that 90% of the profit comes from big AAA titles, not from below. ... I get what you're saying, but I think the Unreal Engine is going to continue to be a cash cow for a good while yet.

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.

Re: Why C++ for Unreal 4

#86
post #8

I developed two titles with the Unreal Engine and whilst initially UnrealScript seems like an advantage it very very quickly becomes problematic. My favorite being the dependency of the C++ code on the script and the script on the C++, so if you're not careful you can end up being completely unable to do a build. As much effort as they put into the IDE it would always play second fiddle to Visual Studio. When I left…

We ended up prototyping most things in UC then converting most of it to native code for performance reasons.

The reason builds were sometimes a bit tricky was due to chicken and egg syndrome because the script compilation wouldn't just compile scripts, but also modify headers to support the new objects created in script.

Aside from the performance issues, the main drawback (to me) with UC was definitely how tightly coupled to native code it was.

Re: Why C++ for Unreal 4

#87

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.

We are talking about new engines written in these languages, though, not multi-decade old codebases still using inline assembler, goto, and pointer arithmetic.

Modern C++ is really safe if you use the subset that involves automatic storage duration, well bounded arrays, etc and use all the warning flags of your compiler, run static analysis, have a robust test framework, etc.

Re: Why C++ for Unreal 4

#88
These issues are all very similar to the difficulties with interaction between JS and C++ in web browsers. A lot of engineering and specification effort has been expended in browsers to improve these problems, on things like WebIDL [1], codegenned bindings[2], JITs that understand some of the behavior of the underlying C++ operations [3] and so forth, but for a game engine where you aren't running potentially malicious code I can see that it would make a lot more sense to just tell people to use C++ rather than expend that effort.

[1] http://www.w3.org/TR/WebIDL/

[2] http://jstenback.wordpress.com/2012/04/11/new-dom-bindings/

[3] https://bugzilla.mozilla.org/show_bug.cgi?id=938294

Re: Why C++ for Unreal 4

#89
post #82
post #65

Am I cynical? The recent changes in Unreal 4 make me think the company is in extremely serious trouble. It's because they aren't addressing the key reason people buy a graphics engine ( viz graphics), but all this ancilliary stuff. While it is important, it's off center... But maybe they are just trying to fend off Unity (open source, a more coherent experience). Usually when companies do this, it's too late. I've no…

Last I checked Unity was a closed-source proprietary engine that I had to pay money for. I'd say they should start worrying about Unity when something like Unreal Tournament 2004 (a decade old game btw) comes out built with Unity.

Maybe he means the Godot engine? I've heard a lot of newer kickstarters are eyeing it since it went FOSS.

Re: Why C++ for Unreal 4

#90
post #24
post #20

The whole C# vs C++ discussion going on the forum shows how little current generations understand of compiler design and language implementations, oh well...

Exactly. What's most distressing is people (as normal) are completely ignoring the garbage collection overhead, which is mostly where the advantage of having complete control is, in terms of micro-managing your memory allocation, e.g. using slab allocators, memory pools, pre-allocation, etc. C# code in theory (ignoring things like intrinsics support and inline asm) can be as fast as C++ for tight loops, but in my exp…

[deleted]
Post reply on HN