Do you know how to learn c++ game programming from scratch

In software development, the direction of game development seems to have a clear goal, but it is actually a very broad direction. Getting some guidance from predecessors can do more with less.

Platform and programming language selection

First of all, there are many types of platforms for game development:

  • Personal host platform: Windows, Linux, Mac OC;
  • Mobile platforms: iOS, Android, Windows Phone, BlackBerryOS, Symbian;
  • Professional console platforms: Xbox, PlayStation, Will, etc.

When you encounter problems in learning, you can add C/C++ to learn the 487790381 group. If you want to engage in game development for mobile platforms, mainstream JAVA language for Android, and mainstream Object-C language for iOS, then you have to learn the mainstream of this platform. language, and the mainstream game development language on personal consoles is still C++ for a long time to come. But it's not that game development on different platforms has nothing in common. After learning this, it is useless to another platform. This is not the case. The further you go in the programming world, you will find that the essence of many things is similar. For example, if you have a solid understanding of the basic syntax of C++ (rather than rote memorization), you will be able to switch to Java in the future. It's not difficult, because their essential object-oriented features and various programming language features are the same. Therefore, if you want to go far, you can't simply superficial when learning. The deeper you go to the bottom of a piece of knowledge, the more you can see the similarities and differences between other knowledge and it, so you will be easier than others. However, of course, it is best to fit your own domain and programming language as closely as possible at the beginning, so that you can hold a place in this field as soon as possible. No matter which platform you choose, the huge project of game development is inseparable from the game engine, so here are two routes for you to choose:

  • only use the game engine;
  • Work with game engines and learn game engine principles in depth.

Line 1: Only use the game engine

For the first route, the use of a game engine is not difficult, so it is suitable for those who want to get started with game development quickly. Most of the time we work, we don't develop our own game engine, so it's not a big problem for general day-to-day work. For those who only use a game engine, all they need to do in the entry phase is to read the tutorials of the engine (books, videos, online blogs, online tutorials, official help documents, etc.) and become proficient in the programming language used for the tutorial.
When you encounter problems you don't understand, you can add C/C++ to learn 487790381 group. So the first thing you have to do is to understand the current popular game engines. Because the performance under different platforms is different, the supported programming languages ​​are also different, so the popular game engines for different platforms are also different (specially recommended in square brackets, based on open source, ease of use, performance and effect and other comprehensive level recommended):

  • Windows or game console: [Unreal], Frost, CE3
  • 苹果ios:【unity3D】、【cocos2d-ObjC】、【Unreal】、sparrow、sprite kit。
  • Android: [unity3d], [cocos2d-x], [Unreal], AndEngine, libgdx.
  • Website: [Egret], [cocos2d-html5], Fancy3D, unity3d.

在选择游戏引擎的时候,尽可能选用流行的游戏引擎,因为这个游戏引擎流行意味着官方的功能比较完善和易用,问答社区也比较多人解疑。各个游戏引擎也各有千秋,Unity3d胜在简单易用,对性能要求不高,但是效果不够华丽,因而一般用在移动平台而不会用在电脑或游戏主机。Unreal胜在开源免费,而且效果也很出色,但是对设备要求比较高,因而常常用来开发效果绚丽的大型游戏。cocos2d-x也是开源免费的,在2D领域深有造诣,但是缺点是不可视化开发。另外,如果你想了解游戏引擎原理,那么首要考虑的就是开源的游戏引擎。 不同游戏引擎使用的编程语言或者脚本语言可能是不一样的,所以当你想要学习某个游戏引擎的时候,也应该留意该游戏引擎所使用的语言。大部分情况是,Windows用的的是C++,同时结合lua或python脚本语言。而ios平台下使用Objective-C或swift,安卓平台下使用Java。但这不是必然的,例如Unity在各个平台下都可以用C#或者javascript脚本语言。 下面是商业上流行的游戏引擎详细比较:

1) Unreal4(虚幻4)

  • 适用平台:Microsoft Windows、Mac OS X、iOS、Android、虚拟现实设备(包括但不限于SteamVR/HTC Vive、Morpheus、Oculus Rift及Gear VR)、Linux、SteamOS及 HTML5平台。
  • 编程语言:C++或无需编写代码。
  • 优点:开源免费,画面效果出色,已有多款商业大作经验。同时,它还能跨平台,商店资源丰富,提供了无需编写代码即可制作游戏的强大功能(可视化开发)。
  • 缺点:开发机器配置要求较高。

2) Unity3D

  • 适用平台:iOS、Android、Windows phone 8、Tizen、Microsoft Windows、Windows Store应用程序、Mac、Linux/Steam OS、网络播放器、WebGL、PlayStation3、 PlayStation4、PlayStation Vita版、Xbox One、Xbox 360、Wii U、Android TV、Samsung SMART TV、Oculus Rift、Gear VR、Microsoft Hololens、Playstation VR。
  • 编程语言:C#、javascript、Boo。
  • 优点:方便易用,中文资料丰富,跨平台,商店资源丰富,可视化开发。
  • 缺点:画面效果一般,不是免费开源,引擎效率比较低。

3) Cocos2d系列(包Cocos2d-x、Cocos2d-ObjC、Cocos2d-html5、Cocos2d-xna等)

  • 适用平台:Microsoft Windows、OS X、 Linux、iOS、 Android、 Tizen、 Linux、Mac OS X、HTML5浏览器、Windows Phone 7 & 8、Xbox 360。
  • 编程语言:Python、Objective-C、C++、 Lua、 JavaScript、 Swift、JavaScript、 C#。
  • 优点:开源免费,跨平台,中文资料丰富,2D技术丰富且成熟。
  • 缺点:不可视化开发,3D方面技术不成熟。

4) CryEngine3

  • 适用平台:Microsoft Windows、OS X、Linux、PlayStation 3、PlayStation 4、Wii U、Xbox 360、Xbox One、iOS、Android。
  • 编程语言:C++、Lua。
  • 优点:画面效果世界一流,可视化开发,跨平台。
  • 缺点:开发机器配置要求较高,不是免费开源。

5) Frostbite3(寒霜3)

  • 适用平台:Microsoft Windows、PlayStation 3、PlayStation 4、Xbox 360、Xbox One。
  • 编程语言:C++。
  • 优点:画面效果出色,可视化开发,跨平台。
  • 缺点:开发机器配置要求较高,不是免费开源。

6) Egret(白鹭)

  • 适用平台:HTML5、iOS、Android、Windows Phone。
  • 编程语言:TypeScript、JavaScript。
  • 优点:免费开源,配套工具多,全中文文档,可视化开发,跨平台。
  • 缺点:支持平台较少,大多数时候用于开发对性能和效率要求不高的小游戏。

但是使用游戏引擎毕竟是停留在表面看不到本质,当游戏开发的时候出现了某些问题或者特殊需求,你往往很难处理。而且游戏引擎技术日新月异,你所学的几乎都是别人留下来的方法,而不是其本质思想。如果将来别的游戏引擎兴起,你又要重新学习另外的游戏引擎怎么使用。在很多大公司里面,甚至都有自己公司内部专用的引擎(如网易公司的风魂引擎、金山公司的剑网3引擎、蜗牛公司的Flexi引擎等等)。所以单纯地走这条路线,可能不会让你走得很远并且可能会日渐乏味。

线路二:使用游戏引擎并深入了解游戏引擎原理

对于第二条路线,深入学习游戏引擎原理短时间不会让你的工作有什么卓越的成效,但是可以弥补只使用游戏引擎导致的问题,而且学习游戏引擎原理,更多时候不是一定就为了自己日后要造个游戏引擎,而是更深入理解自己的游戏引擎,更好地使用它。当然,千里之行始于足下,经常学习游戏引擎底层原理的人到了一定的积累的时候,自己造个游戏引擎也是可以的。 对于像学习游戏引擎原理的人来说,需要制定自己明确的长期目标: 1) 首先,一开始可能对游戏引擎没什么概念,建议先使用一两个游戏引擎(我推荐C++程序员学习虚幻4游戏引擎,现在是免费开源的,非常值得学习。那些不开源的游戏引擎尽量不要去学习,因为其对于学习原理来说没有多大贡献)。 2) 因为游戏开发就是一门实时渲染的艺术,所以离不开图形库的学习。现在主流的图形库是Windows平台专用的DirectX 11和通用平台的Opengl。这两个图形库,至少需要入门其中一个。 3) 然后,你就可以开始看计算机图形学的书籍了。如果你发现你的理论底子不足,这个时候就需要补一下线性代数、基本的微积分、还有3D数学的知识。 4) 游戏引擎中包含了各个部分,上面的渲染只是游戏引擎的一部分。还有其它诸如着色器编写、地形编写、物理引擎编写、模型和动画、人工智能体设计、网络编程等等,完成渲染部分的基本学习后,你可以选择自己感兴趣的部分进行专攻,毕竟我们实际工作大多数时候是团队开发,而不是单打独斗,每个人都应该精通自己所擅长的那部分。


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325603668&siteId=291194637