Source Code, Game Engines, Unity
by Ryan Zec on Apr.20, 2009, under Game Programming, Unity
If you are looking for a game engine to build the next million dollar game, depending on the engines you are looking at and comparing, a question on whether source code access is available or not may come up. I have noticed some people have a suborn point of view that if the engine does not provide source code access, any other engine that does is instantaneously better than it. This is a bad mind set to have when looking at a game engine depending on what you needs and goals are.
Please note that any percentages I use are not meant as exact numbers.
The Misconception:
Without source code access, my creativity is limited.
I think that the major reason for the misconception is that a lot of the game engines out there are designed by default around the FPS genre. So let’s say were are going to build a mod for Unreal, this gives us access to the Unreal Editor and Unreal Scripts. This is basically giving us access to the Unreal engine without the source code. Now could we build a Diablo style RPG, no. The ability of the editor and the scripting language does limit the amount of flexibility and creativity we have with the engine. If we wanted to use the Unreal game engine to build a Diablo like RPG, we would need source code access as we would need to moderately (probably heavily) modify the core source code of the engine. Lets say we had the TGEA and wanted to build a Mythos/Diablo like game. Commoning from the TGEA’s own community, I would have to make some to a lot of core modifications depend on how close I want to make the game into the style (the closer I want it the mmore modifcation I would need).
This may seem on the surface that the issue is not having access to the source code so what is the misconception? In reality the issue is not having access to the source code but how the game engine itself is designed. Now I am not saying there is anything wrong with the way these game engines have been designed, it is not like I would do any better of a job at it however there are other companies that have a different approach to the engine design and Unity is one such engine.
Unity:
Unity seems to have a different approach in how games are created with their game engine. Instead of doing some game play functionality in the game engine and some in scripts like with most engines, they have moved virtually all game play functionality from the engine to scripts. This removes the need of having source code access as almost everything can be handled through scripting.
So what about speed; I though scripting languages were much slower than C++? While scripting is slower than native C++ coding (by the way, this gap is consistently getting smaller as time goes by), you have to consider the trade off with speed vs. development time, ease of use, and maintainability. Another thing to consider is where the game spends most of the time in the code. A large chunk of the time is going to be spent inside the core engine and not the scripts (as long as the scripting environment is good and Unity’s is) and the core engine is still written in C++.
Unity’s scripts are also not all that slow. It uses Mono, the cross-platform version of Microsoft’s .NET, and supports C#, Boo, and a customized version of Javascript. .NET is quite powerful and there are even some game engines that are programmed 100% in C# (no C++) so the power behind it is not just for general applications. The only downside is that Unity is currently on version 1.2.5 of Mono and Mono is up to 2.4 so it is not as fast as it could be but it is planned for Mono to be upgrade soon (hopefully within the next few releases).
What if I want feature x, y, and z which is not implemented in the Unity core? Well again, 98% of the things you want to do should be doable inside the scripting environment. Need path finding, there is already a system built from scripting for that (free too). Need IK, there is already a system from scripting for that (also free). Let’s say you need something that has to be done in C++, well the professional version allows you to plug-in C++ code too. Now there might be a few people out there that need a very specific feature that requires core source code access and if that is the case and you don’t have 100’s of thousands of dollars (see next paragraph), then yes, Unity will not work for you but my guess it that Unity will work for 98% of the people out there.
Also note that you can license the source code for Unity but it will range from 10’s to 100’s of thousands of dollars, just like Unreal or Gamebryo.
Summary:
I don’t think having access to the source code is a bad thing, is it just that if an engine is designed well enough, source code is not needed. Now if you are looking to learn the inner workings of how game engines work instead of just creating a game then I would not recommend Unity at all, I would recommend something like C4 so just think about what your real goals are before thinking you need source code access.
April 21st, 2009 on 1:41 am
Nice and well written post!
I’m glad there are more people who try to put focus on this issue.
April 21st, 2009 on 4:56 am
Thanks Rune.
I have also stroke-out the part about Unreal as I truly don’t have a ton of experience with it and have been told is it possible to build a Diablo like RPG with just the modding tools but that just proves the point even more that source code access if not needed. I replaced that section with information about TGEA the I got directly from the TGEA community.