翻译:

 

前三代Unreal引擎都包含了一个脚本沙盒语言——UnrealScript,他提供了一个简单的GamePlay编程方式,从而避免用户使用复杂的c++语言。

对于新手程序员们,使用脚本编程的方式是好的。但是最终脚本成了引擎发展的阻碍。Unreal引擎在不断发展,我们也在不断的使用,实践。直到2011年,我们决定使用纯C++架构,这样做原因大致如下:

 

1.作为一个引擎,随着社区不断的成长,将原生C++功能导出为脚本功能的需求越来越大,如果要做出一个完整的沙盒功能的脚本,最终导致整个引擎变得很复杂,庞大。

2.实现C++与脚本之间的通信,需要一个多语言的接口以调用函数及封送(marshal)数据。随着脚本接口的不断扩展,这层互操作性(interop)层的维护成本和复杂性像指数般增长。互操作性对于一些高级数据类型(如容器)也是非常棘手的,因为脚本语言的惯用法与对应的 C++ 模板,无论在表示方式和语意都有很大差异。

3.开发者希望发挥原始的C++特性的优势,最终导致他们在脚本世界和代码世界切来切去,浪费了大量的时间,简直是地狱。

4.开发者需要整体的驾驭代码行为,但是很快发现,脚本调试工具和C++调试工具是独立的和不兼容的。他们发现,如果不跟踪C++程序,发现脚本的错误有时没有意义,反之也是这样。

 

正是这些原因,Epic最终决定使用纯C++。这样的话带来很多方便的地方,UnrealEngine4作为一个统一的可调试的引擎,可以让开发者从C++与脚本交互的地狱中解脱出来,并且让程序员可以学习,修改和扩展。这样还带来一个好处,让游戏的效率提高,并且可以容易的集成其他c++中间件。

并不是说C++是一个很理想的游戏编程语言。比起UnrealScript,C#,JavaScript,它有很多的复杂性,危险性。但反过来换一种方式说,C++更加强大。

通过小心使用c++复杂的地方,你的编写游戏程序时将感觉几乎没有限制。你可以调试整个底层代码,修改他们,甚至和操作系统层,高级第三方库进行打交道。

 


原文:

The first three generations of the Unreal Engine included a sandboxed scripting language, UnrealScript, which provided a simple interface for gameplay programming that was shielded from the complexity of the C++ engine.

The scripting approach is very welcoming to new programmers, but eventually it breaks down and becomes an obstacle to innovation and shipping. We experienced this over time as the Unreal Engine grew until finally, in 2011, we moved to a pure C++ architecture. The causative factors were both pervasive and general:

1.As an engine and its community grows, there is increasing pressure to expose more of the its native C++ features to the scripting environment. What starts out as a sandbox full of toys eventually grows into a desert of complexity and duplication.

2.As the script interface expands, there is a seemingly exponential increase in the cost and complexity of its interoperability or "interop" layer where C++ and script code communicate through a multi-language interface for calling functions and marshaling data. Interop becomes very tricky for advanced data types such as containers where standard scripting-language idioms differ greatly in representation and semantics from their templated C++ counterparts.

3.Developers seeking to take advantage of the engine's native C++ features end up dividing their code unnaturally between the script world and the C++ world, with significant development time lost in this Interop Hell.

4.Developers need to look at program behavior holistically, but quickly find that script debugging tools and C++ debugging tools are separate and incompatible. Seeing where script code had gone wrong is of little value if you can't trace the C++ that code led to it, and vice-versa.

It is these reasons, ultimately, that led to Epic's move to pure C++. And the benefits are numerous: UE4 is a unified and fully-debuggable code base, freed from Interop Hell and totally open to programmers to study, modify, and extend. There are side-benefits, too, such as increased performance in gameplay code, and ease of integrating other middleware written in C++.

Building Unreal Engine 4 as a unified C++ codebase has been very freeing, giving engine and gameplay programmers enormous flexibility to write code without unnecessary interop barriers.

This isn't to say that C++ is the ideal language for simple gameplay code. It is more complex and more dangerous than UnrealScript, C#, and JavaScript. But that is another way of saying that it's more powerful.

By making peace with complexity and writing code in C++, there is absolutely no limit to what you can accomplish, whether it involves debugging your entire codebase in-context, interfacing to low-level engine systems, modifying them, or talking to the operating system or advanced third-party libraries.

时间就是一切