Live data from Hacker News

Why C++ for Unreal 4

forums.unrealengine.com

61–70 of 178 posts

Re: Why C++ for Unreal 4

#61
post #39
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…

They could also use C# instead of UnrealScript on top of C++. This way you would be able to leverage the Visual Studio while getting one of the best languages. It would make Unity3d guys welcome once they need something better as well. PS: I like the BluePrint though.

To second what scott_s said, you'd have a huge interop layer. The fact that C# has a closer match to C++ types and primitives doesn't mean you have no interop. Unity has a huge surface area between the C++ parts of the engine and the C# parts of the engine; a ton of work goes into maintaining that, and it complicates porting to new target platforms like the web (can't just feed everything through emscripten).

Re: Why C++ for Unreal 4

#62

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?

Re: Why C++ for Unreal 4

#63

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?

A safer language with higher-level, low-cost abstractions.

Re: Why C++ for Unreal 4

#64
post #10

Maybe UnrealScript was just too damn complex. Having not used it, and just Googled it, my first reaction was "this looks just like C++ anyway". What's language features are there specificity catered for games? It doesn't seem very DSLy

There were a few constructs for dealing with scripts running on the client vs server and also data replication across the network built into the language. This is where it different from being just a scripting language.

Ultimately it was confusing at first. Besides the official docs I had to look at their script source and old UT2 tutorials to figure it out.

I haven't seen the new engine, but I imagine simply doing a net.replicate(&player_info) would have been more straight forward than dealing with all of the unrealscript language constructs for it.

Re: Why C++ for Unreal 4

#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 idea if that's the case here.

Re: Why C++ for Unreal 4

#66

Earlier quoted context omitted.

What's the appeal of Rust for gamedev?

A safer language with higher-level, low-cost abstractions.

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.

Re: Why C++ for Unreal 4

#67
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…

I would guess the idea was to enable non-coders (esp. artists, level designers etc) to handle many of their needs themselves - for faster iteration.

But maybe the UnrealScript wasn't simple enough in practice to do that?

Or perhaps, giving people a template function, and a few functions, is just as easy/hard as a separate scripting language.

Generally, scripting languages are a really great idea: consider all the bash scripts in unix. An imperfect mismatch with the underlying language, yes; but worth it.

Re: Why C++ for Unreal 4

#68
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…

Haha.

Note how many games have come out using UE3, think about the royalties coming in.

Also, right now they have just about the best game-engine, only hobbyists and some indies would choose Unity, mostly because its easier.

UE4 will definitely get several high profile games soon from big AAA companies.

I would say that Unity is in deep trouble right now :P

Re: Why C++ for Unreal 4

#69
post #25
post #24

Earlier quoted context omitted.

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…

Note that Unreal uses a C++ GC.

Totally different from C#:sa GC.

The GC in unreal engine is used to know when what entity should be removed from the game. (If you have multiple entities pointing each other.)

The memory allocation still works how it works in C++.

Re: Why C++ for Unreal 4

#70

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.

LuaJIT contains a pretty fast interpreter, thus it makes sense to use it on consoles (with the JIT turned off by compile-time-flags) instead of the Lua reference implementation.
Post reply on HN