五千年(敝帚自珍)

主题:初到贵宝地,灌一点游戏开发的东东 -- foundera

共:💬23 🌺4
全看分页树展 · 主题 跟帖
家园 游戏制作入门指南

游戏制作入门指南

我经常被问及:一个具有很少甚至没有编程经验的人要如何开始游戏制作。直到目前为止,我总是尽我所能一个一个解答。然而,问题的数量已经增长到了一个难以处理的水平,于是,我便决定把所有的建议汇总在一篇文章里作为参考提供给人们。

  I often get asked how someone with little or no programming experience can get started in game development. Up until now, I have always tried to help them along as much as I can on a one-to-one basis. However, because the number of questions has grown to an almost unmanageable level lately, I decided it is time for me to put all my advice in an article to serve as a general resource.

  这篇文章主要面向那些想开发自己的游戏,但仅有一点点或没有半点编程经验的人们。实际上,我也假定读者根本没有任何的编程知识。我将把重点放在游戏开发的编程和设计方面,而不是艺术方面。我也不准备对游戏行业进行论述(因为这个话题的资料太多了),但是,我会带你浏览一下在制作游戏之前需要做的一些事情。该说明的一点是,不要将我这里所介绍的方法当作唯一的或最好的学习游戏制作的路径,但对于我和其他人来说,它是有效的。

  This article is intended for people who want to make their own games, but who have little or no programming experience. In fact, I'm going to assume the reader has no programming knowledge at all. I will focus mainly on the programming and design aspects of game development, and not the artistic side. I am not going to cover actually getting into the industry (because there are already ample resources for that) but I will walk you through the things you need to do to get to the point that you can make your own games. Finally, the path I lay out here should not be looked at as the only ?or even the best ?route to learning how to make games, but it has worked well for me and for other people.

1、选择一门语言

  Choosing a Language

  第一件要做的事就是选择一门语言。你有一大堆的选择,包括 Basic、Pascal、C、C++、Java 等等,同样也有一大堆关于哪门语言最适合初学者的争论。欲了解各种语言的优缺点,请参阅 John Hattan 的绝妙文章《我该使用什么语言》。

  The first thing you will need to do is to choose a language to program in. You have a lot of choices, including Basic, Pascal, C, C++, Java, etc., and there is a great deal of debate over which language is best for beginners. For a discussion of a number of popular languages, see John Hattan's excellent article, What Language Do I Use?

  我这里建议使用 C 和 C++。有些人认为这些语言对于初学者来说太难了,但从我个人角度来说我是反对这个观点的,因为我自己就是从 C++ 起步的。另外,C/C++ 是目前最广泛应用的语言,因此,你能找到大量的资料和帮助。至于先学 C 还是先学 C++ 的问题不大,因为一旦你学习了其中一种,再学习另外一种就没太大问题了。不过,如果你一开始就选择 C++,请确信在学习面向对象编程之前,你已经了解并掌握了面向过程编程。(比如说,如果你在不使用类的前提下仍无法编好程序,先不要急于学习类)

  I'm going to recommend starting with C and C++. Some people will say that those languages are too advanced for beginners, but because I started with C++ myself, I tend to disagree. In addition, C/C++ is the most widely used language today, so you will be able to find a wealth of resources and help. It does not really matter whether you learn C or C++ first, because once you learn one, learning the other will be a trivial matter. However, if you choose to learn C++ first, make sure you understand and can use procedural programming before learning object-oriented programming (i.e. hold off on learning about classes until you can program well without them).

  如果你发现学习 C/C++ 是一件很困难的事,不要紧,回过头选一门比较简单的语言来学,比如 Basic 或 Pascal。不过我认为,如果你坚持下去,并找一些好的资料,学习 C/C++ 的问题不大。

  If you start with C/C++ and it turns out to be too difficult, there is nothing wrong with going back and learning a simpler language, such as Basic or Pascal. But I really think that if you stick with it and find the right resources, you should have no problem with C/C++.

  你的下一个问题是:我如何学习 C/C++?我很高兴你问这个问题。最好的方法是去听课。有没有老师帮助解答问题,对于你的发展影响巨大,而且编程作业将确保你确实掌握了所学的东西。

  Your next question should be, "How do I learn C/C++?" I'm glad you asked. The best way is to take a class. Having an instructor and TAs available to answer questions and help you along makes a huge difference, and the programming assignments will ensure that you actually apply what you are learning.

  如果听课不在你的考虑范围内,下一个最好的办法就是找一些好书。不要把注意力放在那些“大全”书上,因为你终究会买几本。我建议你去一个本地书店,花点时间浏览一下介绍 C 和 C++ 的书,直到找到你能理解并能从中学到东西的一本。同时,你可能还想买几本进阶书或是一本参考书,但一旦你具有了这门语言的部分知识,你会对你需要什么有更好主意。可以在网站BOOKS频道中找到一些建议。

  If taking a class is not an option for you, the next best thing is to get some good books. Don't stress too much about picking the "perfect book", because you are probably going to buy several eventually. I'd suggest going to a local bookstore and spending some time browsing the introductory C and C++ books until you find one that you understand and think you can learn from. In time, you will want to pick up some more advanced books, and probably a reference, but once you have some knowledge of the language, you will have a better idea of what you need. See our books section for some suggestions.

  在此,我简要的说明一下我见过的很多入门程序员,尤其是年轻人关心的事情:没有钱买书或其他东西。首先,有许多资源是免费的,包括图书馆和 Macmillan Computer Publishing (他们的网站 www.mcp.com 上有数百本编程的书)。其次,如果你想成为一名优秀的程序员,你不得不考虑在这上面的投资。利用各种手段(合法的 ;<)去弄点钞票来。

  At this point, I want to take a moment and address something that I have seen as a concern for a lot of beginning programmers, especially younger ones: not having money to buy books and other things. First, there are free resources available, including your local library, and Macmillan Computer Publishing, which has hundreds of programming books online at http://www.mcp.com/personal. But second, if you really want to become a good programmer, you have to plan on making an investment in it. Use whatever (legal ;<) means you have to come up with some cash.

  网络上有大量的 C 和 C++ 的学习教程,但是我认为这些教程作为你学习书本的参考要比作为单独的材料好得多。

  There are also a number of tutorials available on the web for learning C and C++, but I have found that tutorials are better for supplementing what you learn in books than for being a stand-alone resource.

2、选择合适的编译器

  Picking the Right Compiler

  你写的程序,或源码是以文本文件存储的,你甚至可以用记事本来写 C/C++ 程序。但是,必须有样东西能把这些源码转化成一个可执行文件。对于 C 和 C++ 来说,这样东西就是一个编译器。

  The programs you write, or source code, is stored as a text file, and you can even use Notepad to write a C/C++ program. But something needs to take that source code and convert it into an executable file. In the case of C and C++, that something is a compiler.

  现在有大量的编译器存在,其中有许多是免费的。选择一个合适的编译器是非常重要的,而免费编译器有个好处就是你能一个一个的试,看哪个你最喜欢。但是,免费编译器经常是比商业编译器功能少或缺少良好的技术支持。幸运的是,大多数商业编译器都有与完整版功能相同,但价格便宜许多的介绍版或学习版,唯一的限制是,你不能发布使用该编译器开发的程序(这点你肯定维持不久)。

  There are a large number of compilers available, including many free ones. It is important to choose a compiler that you are comfortable with, and the free ones have the advantage that you can try them all out and see which one you like best. However, free compilers are often not as full-featured or well-supported as commercial ones. Fortunately, most commercial compilers come in introductory or academic versions, which cost much less and usually have the same features as the full version, with the only restriction being that you cannot distribute programs you create using it (which you are not going to be doing for a while anyway).

  基本上,你选择什么样的编译器取决于你能花多少钱、你将在什么操作系统和平台上开发程序。如果你准备为 Windows 作贡献,我强烈建议使用微软的 Visual C++。它具有一个功能强大的开发环境,能让你倍感轻松,再也没有其他编译器能比它更适合开发 Windows 软件了。如果你是名学生,你可以以极低的价格获得一份拷贝。如果你准备在 DOS 下开发程序,你最好使用免费的 DJGPP。

  Ultimately, the compiler you choose will depend on how much you can spend and which operating system and platform you will be developing for. If you are going to be developing for Windows, I strongly suggest using Microsoft Visual C++. It has a powerful development environment that will make a lot of things easier for you, and there is no question that no other compiler is more well-suited to developing Windows applications. If you are a student, you can obtain a copy for a significantly reduced price. If you are going to program in DOS, your best bet is probably DJGPP, which is free.

3、选择一个目标平台

  Choosing a Target Platform

  虽然你可能最终会为各种平台开发程序,你还是应该选择其中之一进行学习。当你学习语言的时候,在没进入图象编程之前,你大概想使用一个非 GUI 的操作系统,比如 DOS 或 UNIX。这有助于你将注意力集中在语言学习上,从而避开一些高层的问题,如 Windows 编程。

  Although you will probably develop for a number of platforms eventually, you are going to need to pick one to learn in. While you are learning the language, and before you get into any programming involving graphics, you will probably want to use a non-GUI operating system, such as DOS or UNIX. These will avoid the overhead involved with, for example, Windows programming, and let you just focus on learning the language.

  不过,一旦你准备开始制作游戏,你就该考虑转换你的目标平台了。一下是几个常用的平台:

  Once you are ready to start making games, though, you should consider changing your target platform. Let's look at the more prominent options.

  Windows:如果你想在游戏行业里专职工作,或者你想让一大群人玩你的游戏,那么 Windows 是你的首选。你的目标客户大多数使用 Windows,且这个情况不会很快改变。目前大量的 Windows 游戏使用一种你大概听说过的名为 DirectX 的技术。DirectX 是一个允许你直接操作硬件的程序库,你可以依靠它写出高性能的游戏来。

  Windows: If you want to eventually work professionally in the games industry, or if you just want a lot of people to be able to play your game, then this is the platform you want to choose. The majority of your target audience uses Windows, and I don't see that changing any time soon. The vast majority of games today are made for Windows using a technology you have probably heard of called DirectX. DirectX is a library that allows you to access the hardware directly, which means you can write high-performance games.

  DOS:DOS 曾经是游戏的主要平台,但这已是昨日黄花。虽然有些爱好者仍然在为 DOS 开发游戏,但是已经没有商业游戏是为 DOS 开发的了,而且, DOS 正由于微软停止对它的支持而走向衰败。如果你刚开始做游戏,别选择 DOS,如果你已经这样做了,不要再停留了。注意:因为有很多游戏编程的书是为 DOS 写的,学习这些书时可能会认为在 DOS 里开发游戏有理有据。但是,随着 Windows 游戏编程书籍数量的增长,这种争论变得越来越少,也越来越没有意义。

  DOS: DOS used to be the dominant platform for games, but those days are gone. Although some hobbyists are still making games for DOS, no commercial games are being made for DOS, and it will continue to decline as Microsoft stops supporting it. If you are just starting to make games, don't choose DOS, or if you do, don't stay with it for long. Note: because there are a large number of game programming books written specifically for DOS, there may be some justification to developing games in DOS while learning from these books. However, as the number of books for game programming in Windows grows, this argument becomes less and less valid.

  Linux:Linux 是 UNIX 的一个变种,由于它具有稳定、便宜、反微软情节等多个因素,它正变得越来越受欢迎。虽然目前的 Linux 用户还比较少,但是随着它的热爱者和市场的潜在增长,它也成为了作为目标平台的可行选择。

  Linux: Linux is a UNIX variant that has become popular lately for a number of reasons, including stability, price, and anti-Microsoft sentiment. Although the number of Linux users is still relatively small, the enthusiasm surrounding it and the potential growth of the market make it an viable choice as a target platform.

  Macintosh:苹果机拥有一群数量不多但非常忠诚的追随者,几乎每个我见过的苹果机爱好者都有一个强烈渴望更多苹果机游戏的愿望。我没有看过多少在苹果机上开发游戏的资料,但我确信确实有,因此,这也是个合理的选择。

  Macintosh: The Mac has a very loyal following in numbers that are not insignificant, and nearly every Mac enthusiast I have talked to has expressed a desire for more and better games for the Macintosh. I have not seen as many resources for making games for the Mac, but I am sure they are out there, so this may be a valid option too.

  家庭游戏机:游戏机(如 Playstation、N64、Dreamcast 等等)游戏市场非常巨大,前景可观。然而,由于种种原因,开发非商业性的游戏机游戏在目前来说是不太可能的。你为游戏机开发的游戏大多都会被商业游戏公司买走。

  Consoles: The console (i.e. Playstation, N64, Dreamcast, etc.) game market is huge, and there is certainly a future in console game development. However, developing console games in a non-commercial setting is not really plausible at this time, for a number of reasons. If you develop for consoles, it will probably be while employed by a commercial game studio.

4、充足电

  On to the Good Stuff

  是讨论真正做游戏的时候了。虽然我所说的大部分内容适用于其他语言,为简单起见,我将假定你选择了 C/C++ 来进行 Windows 编程。

  Now it's time to discuss actually making games. For simplicity, I'm going to assume that you have chosen to program in C/C++ for Windows, although most of what I say will apply if you chose otherwise.

  首先,在你考虑如何开始做游戏之前,你应该能很好的掌握 C 和 C++。你应该了解并精通指针、阵列、结构、函数,以及类等。做到了这一点,你就可以开始制作游戏了。

  First of all, before you even think about starting to make games, you should have a good command of C and C++. You should understand pointers, arrays, structures, functions, and probably classes, and you should be proficient in using them. If so, you are ready to start making games.

  本文无法教授你关于制作游戏所该了解的一切。幸运的是,这也不是必要的。有很多关于这方面的书,网上也有数以百计的教程。GameDev.net 应该会有目前你所需要的一切。下面是我对你起步的一些建议:

  This article can't possibly teach you everything you need to know about making games. Fortunately, it doesn't have to. There are many books on the subject, and hundreds of tutorials on the web. GameDev.net should have everything you need right here. Here's how I suggest you start:

学习一本或几本书。对于 Windows 游戏的初学程序员,《Tricks of the Windows Game Programming Gurus 》是一本极好的Windows编程入门教程。在这个站点里拥有许多本站 Books section 里所列出的好书。阅读这些书籍,运行所有的例程,反复研读你不理解的章节。

使用网上教程补充书本的不足。书本除了阐明一些你阅读的东西外,通常也会包含一些书本上没有涉及的主题。

找专家进行咨询。如果你无法从书上或教程中找到答案,到本站的留言版或聊天室来,这里有许多乐于提供帮助的人。

Get one or more books. For beginning game programmers in Windows, Tricks of the Windows Game Programming Gurus is the perfect place to start. Besides that, there are a number of other good books in our Books section. Read through the books, trying all the examples, and rereading parts you don't understand.

Supplement what you read with online tutorials. Besides clarifying things you read, they also cover topics not covered in books.

Ask the experts for help. If you cannot find answers to your questions in books or tutorials, take advantage of our message board and chat room. There are a lot of people out there willing to help out.

  不要把上面几点当成是个有序的过程,而应当看作是一个循环往复的并行过程。

  This should not be looked at as a sequential process, but as a silmultaneous process that is repeated continually.

  仅仅是学习、思考是远远不够的,你应当把你所学的东西付诸实践。从一个简单的游戏开始,逐步发展。你可以阅读一下 Geoff Howland 的文章《How do I Make Games? A Path to Game Development》。

  It is not enough to just learn, though, you must apply what you learn. Start off with a simple game, and work up from there. See Geoff Howland's article, How do I Make Games? A Path to Game Development.

  首先,为自己的工作制定一个计划。不要急于加入一个团队,因为那只会减缓你的学习进程。当你囊中拥有数个游戏时,你将为一个团队作出更大贡献。

  At first, plan on working on your own. Don't rush to join a team, because it will only slow down the learning process. Once you have several games under your belt, you can make a much larger contribution to a team anyway.

  关于书本,有件事我要提醒一下:你需要阅读除了游戏编程外的其他书籍。为了制作出你在商店货价里看到的各种游戏,你将不得不钻研那些比大多数游戏编程书籍所授内容更高深的话题。有些可能你能从教程中找到,但是,你还是有必要买几本关于图形、人工智能、网络、物理等等方面的书。这是获得计算机科学学位的必经之路,因为你将被要求学习一些你认为与游戏编程无关的课程,而实际上它们是相关的。

  One thing I'd like to mention about books: You will need to read more than just game programming books. To be able to create the kinds of games you see on store shelves, you are going to have to delve into topics more advanced than those covered in most game programming books. Some of what you need can be found in tutorials, but you are also going to need to pick up some books on graphics, artificial intelligence, networking, physics, and so on. This is where pursuing a degree in Computer Science comes in handy, because you will be required to take classes that you may think don't apply to game programming, but they do.

5、总结

  Wrapping Up

  这里有一些能产生巨大差别的技巧:

  Here's a few more tips that can make a huge difference:

要只知道聚集知识,应用是关键。除非你使用了,否则你无法确实知道和理解这些东西。做一些小的测试程序来应用你所学的东西,并切实完成书上每个章节后的习题。

玩大量的游戏。你会因此找到灵感,从而帮助你制作更优秀的游戏。当然,这也是一种受欢迎的解除编程压力的调剂方式。

帮助别人。在你帮助别人的过程中,你会学到更多东西。

完成你的作品。不要陷入这样一种思想的圈套中:“我知道我可以完成这个游戏,但是我有个更好的主意,我要换做这个好的项目。”如果你能坚持有始有终,你会学到更多的东西,并且你有作品证明你不仅仅是空谈。在你具有丰富的经验之前,做得简单一点,不要尝试制作一个又大又复杂的游戏。

Don't just accumulate knowledge, apply it. You will never really know or understand something until you use it. Make little demo programs that use the things you are learning. Actually do the exercises at the end of the chapters in the books.

Play a lot of games. Doing so will give you ideas and help you make better games. It will also provide a welcome relief from programming.

Finish what you start. Don't fall into the trap of thinking "I know I can finish this game, but I have an idea for a better one, so I'll move on to it instead." You will learn so much more if you

finish the games you start, and you will have something to prove that you are not all talk. To make this a little easier, don't try to make really big or complex games until you are more experienced.

  出发吧!你该动手制作 Quake 4 了。当然,可能不那么容易,但至少你可以从这个方向出发,并且知道去哪里查找更多的信息。经过多年的努力工作,你会成功的!

  There you go! You should now be well on your way to making Quake 4. Well, not quite, but at least you can start on that path and know where to look for more information, and with years of hard work, it can happen.

--------------------------------------------------------------------------------

  作者简介

  Dave Astle 从 1984 年开始制作电脑游戏。白天他在 ROI Systems 公司任软件工程师,晚上他领导 Myopic Rhino Games 的开发小组。有时他也抽空来帮帮 GameDev.net ,使其成为同行中的佼佼者。有时间他也需要休息了。

全看分页树展 · 主题 跟帖


有趣有益,互惠互利;开阔视野,博采众长。
虚拟的网络,真实的人。天南地北客,相逢皆朋友

Copyright © cchere 西西河