TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why C++ for Unreal 4

209 点作者 zschoche大约 11 年前

25 条评论

flohofwoe大约 11 年前
We&#x27;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&#x2F;C++ code) and the majority of the per-frame performance-budget was lost somewhere in this scripted mess. The game sometimes suddencly crawled to a halt when some crazy scripting construct was called, and we had a lot of trouble getting stuff into a shippable state until the gold-master milestone (this is the game: <a href="http://www.metacritic.com/game/pc/project-nomads" rel="nofollow">http:&#x2F;&#x2F;www.metacritic.com&#x2F;game&#x2F;pc&#x2F;project-nomads</a>).<p>The main problem with scripting layers is that you are basically handing programming tasks over to team members who&#x27;s job is not to solve programming tasks, and thus getting a lot of beginner&#x27;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).<p>And then there will be definitely those &quot;creative workarounds&quot; to get something done which neither the engine nor the scripting layer was designed for, which make entertaining horror stories the programmers tell the new hires when they inevitable ask why your engine doesn&#x27;t have scripting ;)<p>A better approach is to give the level designers simple, pre-programmed, combinable high-level building blocks (AI behaviours, actions, triggers, etc), and let them customize a level (as in game area) with this. But never build the entire game logic with such an approach! With this, stuff can still be fucked up, but at least the performance-sensitive stuff can be implemented by the programming team, and it&#x27;s much easier to debug and maintain.<p>[edit: typos]
评论 #7587351 未加载
评论 #7588541 未加载
评论 #7587964 未加载
评论 #7587275 未加载
octo_t大约 11 年前
The phrase<p>&gt; &#x27;What starts out as a sandbox full of toys eventually grows into a desert of complexity and duplication.&#x27;<p>is beautiful and is a pattern I&#x27;ve seen multiple times before. Its not feature creep per-se, but more something a bit more insidious in software development.
评论 #7585939 未加载
评论 #7585496 未加载
评论 #7585805 未加载
xedarius大约 11 年前
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&#x27;re not careful you can end up being completely unable to do a build.<p>As much effort as they put into the IDE it would always play second fiddle to Visual Studio. When I left there was no way to remote debug unreal script on the target device (this may not be the case now).<p>I know that all of the guys I worked with in the studio would welcome pure C++ approach. The only real losers here are mod makers who will have a higher entrance bar.
评论 #7586624 未加载
评论 #7587046 未加载
评论 #7585884 未加载
HeXetic大约 11 年前
It&#x27;s important to note that what is being talked about in this post is not, &quot;why we wrote the Unreal engine in C++&quot;, because it already <i>was</i> in C++. Many games, older Unreals included, had a separation between &quot;code&quot; and &quot;scripting&quot;, 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.<p>Doom 3 and previous Unreal engines had scripting languages; even the first moddable FPS engine, Quake, had a &#x27;scripting language&#x27; of sorts -- Quake C, a sort of subset of C. id software turned back to pure code with the Quake 4 engine, however, recognizing the mistake that introducing the overhead of script-vs-code, and the limitations of scripts, outweighs any gains from being &quot;easier to edit&quot;.
评论 #7586995 未加载
评论 #7586429 未加载
CyberShadow大约 11 年前
There was a talk at last year&#x27;s D conference how Remedy Games have used D as their &quot;scripting&quot; language:<p><a href="http://dconf.org/talks/evans_1.html" rel="nofollow">http:&#x2F;&#x2F;dconf.org&#x2F;talks&#x2F;evans_1.html</a><p>I wonder if some of the same points would apply here. The short version of the talk is that D compiles much faster than C++, has limited C++ link compatibility (e.g. classes, but not templates), and overall has nicer syntax &#x2F; language features than using C++ directly. Metaprogramming &#x2F; compile-time introspection allow automatically serializing&#x2F;deserializing data to allow updating data structures without restarting the engine.
评论 #7586079 未加载
mccr8大约 11 年前
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&#x27;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.<p>[1] <a href="http://www.w3.org/TR/WebIDL/" rel="nofollow">http:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;WebIDL&#x2F;</a><p>[2] <a href="http://jstenback.wordpress.com/2012/04/11/new-dom-bindings/" rel="nofollow">http:&#x2F;&#x2F;jstenback.wordpress.com&#x2F;2012&#x2F;04&#x2F;11&#x2F;new-dom-bindings&#x2F;</a><p>[3] <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=938294" rel="nofollow">https:&#x2F;&#x2F;bugzilla.mozilla.org&#x2F;show_bug.cgi?id=938294</a>
beefsack大约 11 年前
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&#x27;t help but feel it has become so entrenched in the industry that it will take something monumental to disrupt it.
评论 #7586023 未加载
评论 #7587506 未加载
评论 #7589676 未加载
评论 #7586108 未加载
评论 #7587243 未加载
评论 #7586229 未加载
pjmlp大约 11 年前
The PVS-Studio guys have a static analysis of the code quality<p><a href="http://www.viva64.com/en/b/0249/" rel="nofollow">http:&#x2F;&#x2F;www.viva64.com&#x2F;en&#x2F;b&#x2F;0249&#x2F;</a>
archagon大约 11 年前
On the other hand, I feel that tools like Unity are successful precisely <i>because</i> they let you tinker with your game in a WYSIWYG kind of way. It&#x27;s really liberating to be able to work inside such a tight feedback loop, and it&#x27;s a little weird to see a modern game engine distancing itself from that approach.<p>(But maybe I&#x27;m missing something. What exactly is the role of the Unreal Editor in UE4? Is it mostly for things like graphics and sound?)<p>EDIT: OK, so apparently UE4 has something called Blueprints. I&#x27;m still not exactly sure what they are, but people in the thread are saying that they&#x27;re superior to C# in Unity, and that they can even allow you to make a game without knowing how to program. So why is Tim Sweeney saying that C++ is replacing UnrealScript for gameplay code?
评论 #7585506 未加载
评论 #7586053 未加载
评论 #7589370 未加载
评论 #7585918 未加载
nly大约 11 年前
Maybe UnrealScript was just too damn complex. Having not used it, and just Googled it, my first reaction was &quot;this looks just like C++ anyway&quot;. What&#x27;s language features are there specificity catered for games? It doesn&#x27;t seem very DSLy
评论 #7585807 未加载
评论 #7585735 未加载
评论 #7586363 未加载
评论 #7585710 未加载
pjmlp大约 11 年前
The whole C# vs C++ discussion going on the forum shows how little current generations understand of compiler design and language implementations, oh well...
评论 #7585656 未加载
XorNot大约 11 年前
I remember back when Descent 3 was being developed, the devs must&#x27;ve run straight into this problem since pretty late in the development cycle they suddenly dropped their script language for pure C++ libraries for scripting levels.
danso大约 11 年前
&gt; <i>Developers seeking to take advantage of the engine&#x27;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.</i><p>Replace &quot;C++&quot; with &quot;JavaScript&#x2F;client-side processing&quot; and &quot;script&quot; with &quot;server-side scripting&quot; and I feel like this adequately describes web-development.
评论 #7585838 未加载
评论 #7585602 未加载
评论 #7585958 未加载
评论 #7585778 未加载
syncsynchalt大约 11 年前
Inner Platform Effect: &quot;the tendency of software architects to create a system so customizable as to become a replica, and often a poor replica, of the software development platform they are using&quot; - <a href="http://en.wikipedia.org/wiki/Inner_platform" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Inner_platform</a><p>Seems an appropriate term here.
leoc大约 11 年前
The upshot is likely that a community-created Lua or JS binding will gain a significant userbase.
评论 #7585621 未加载
评论 #7585714 未加载
评论 #7585935 未加载
kayoone大约 11 年前
Unity runs well with a Scripting approach and for everybody where thats not enough, you can still get the full source license. I think Unity did it quite clever in that the engine itself is c&#x2F;c++ and all the interfacing with the engine is done through C#&#x2F;Mono.
评论 #7585530 未加载
评论 #7585481 未加载
daenz大约 11 年前
This was refreshing. I&#x27;m struggling with the same problem...I&#x27;ve embedded Lua in my C++ engine for high-level scripting. Unfortunately, as my scenes became more and more complex, I found myself struggling with representing the inheritance hierarchies in Lua, as well as things like object ownership&#x2F;gc (resorting to passing around shared_ptrs in Lua userdatas). And for each new data type, I had to write the same old C++ boilerplate to make it available in Lua the way I needed to. The complexity is getting to be too much.<p>I think this article is going to push me to strip out the embedded Lua from the engine and use plain old C++ as well. Great read!
评论 #7587738 未加载
golergka大约 11 年前
Right now I sit through the second week of non-stop iOS crash logs of our Unity game, which are opaque, unclear and mysterious for the most part, and I can&#x27;t agree more.
Guthur大约 11 年前
From my limited experience of Unreal Script it was a pretty rough implementation of a language, it really didn&#x27;t seem to provide any real benefits.<p>What I would have liked to see was better support for interactive development. When I was playing with it I still had the edit&#x2F;save&#x2F;compile&#x2F;run loop to see my changes, that&#x27;s not what I want. I use Common Lisp extensively and appreciate the power of a REPL, it&#x27;s available in many languages now. This brings me to the next point of providing powerful reflection support so that I can easily explore the state of the application, as well as better debugging tools.<p>UnrealScript was just not a very good language implementation in my opinion.<p>So in my opinion removing it and exposing the C++ is a good thing. But not for the same reasons that most are touting, I don&#x27;t want to code in C++. But now it should be a lot easier to build a reasonable Lisp on top of Unreal Engine 4, which is what I really want.
anoplus大约 11 年前
A(programming) language gets very powerful by simply being accepted as standard. Take English as example.
jokoon大约 11 年前
finally.<p>Now, to make the gameplay programmer and level designer&#x27;s job easier, you still have to build well made and documented building blocks.<p>It&#x27;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.<p>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.<p>Setting the bar high or demanding discipline if you prefer. Computers are stupid, so you need to be precise when you work with them.
评论 #7589393 未加载
chris_wot大约 11 年前
Looking at the comments around the post, the amount of people who don&#x27;t really understand pointers but who seem to be Unreal developers is a little surprising!
评论 #7587860 未加载
Aardwolf大约 11 年前
Can you script actors and such with C++ from within UnrealEd then?
评论 #7585625 未加载
thomasahle大约 11 年前
The idea:<p>&gt; It is ... more dangerous than UnrealScript, C#, and JavaScript. But that is another way of saying that it&#x27;s more powerful.<p>is why we can&#x27;t have nice things.
hyp0大约 11 年前
Am I cynical? The recent changes in Unreal 4 make me think the company is in extremely serious trouble. It&#x27;s because they aren&#x27;t addressing the key reason people buy a graphics engine (<i>viz</i> graphics), but all this ancilliary stuff. While it is important, it&#x27;s off center...<p>But maybe they are just trying to fend off Unity (open source, a more coherent experience). Usually when companies do this, it&#x27;s too late. I&#x27;ve no idea if that&#x27;s the case here.
评论 #7586471 未加载
评论 #7586945 未加载