【正文】
utines that are called a few thousand times a second, so making the routine as tight as possible really helped the performance of the game. It39。游戲使用匯編主要是使用它那些能提高性能的零零碎碎的部分。t it! 確切的說(shuō),任何你能在其他語(yǔ)言里做到的事情,匯編都能做,只是不那么簡(jiǎn)單 — 這是當(dāng)然,就像說(shuō)你既可以開(kāi)車到某個(gè)地方,也可以走路去,只是難易之分?! y default, assembly was the first puter language. Assembly language is actually a mandbased representation of the actual instructions that your puter39。ll really be doing it the hard way if you push off learning OO. 匯編語(yǔ)言(Assembly) 顯然,匯編是第一個(gè)計(jì)算機(jī)語(yǔ)言。OO是仿真(游戲)的完美方法,如果你不學(xué)習(xí)OO,你將不得不“辛苦”的工作。re missing out on what will likely be a much more effective way of modeling the data in your game. By not learning OO programming off the bat, you could be enforcing bad programming habits that you39。你可以自學(xué)C并使用它來(lái)寫程序,從而節(jié)省一大堆的時(shí)間,不過(guò)使用這種方法有兩個(gè)弊端: I thought this bore mentioning, as it39。t. By far the best groundup C++ tutorials are Who39。作為教程,有兩個(gè)陣營(yíng),一個(gè)假定你知道C,另外一個(gè)假定你不知道。因?yàn)樗哂信cC語(yǔ)言相同的缺點(diǎn),大多數(shù)可移植性用戶界面庫(kù)都使用C++對(duì)象實(shí)現(xiàn)。與C語(yǔ)言一樣存在語(yǔ)法濫用問(wèn)題。s when highlevel programming languages like COBOL and FORTRAN started to displace handcoded assembly as the language of choice. Critics correctly pointed out that programs written in highlevel languages were inherently slower than handtuned assembly and always would be. Highlevel language advocates pointed out, however, that the slight performance hit was worth it because COBOL and FORTRAN programs were much easier to write and maintain. 優(yōu)點(diǎn):組織大型程序時(shí)比C語(yǔ)言好得多。同樣的爭(zhēng)論發(fā)生在六十年代高級(jí)程序語(yǔ)言如COBOL和FORTRAN開(kāi)始取代匯編成為語(yǔ)言所選的時(shí)候。這將是一個(gè)還在進(jìn)行,而且不可能很快得出結(jié)論的爭(zhēng)論。比如說(shuō),有很多的GUI和數(shù)據(jù)庫(kù)的庫(kù)實(shí)現(xiàn)為對(duì)象的集合。s C Primer Plus].C++ C++語(yǔ)言是具有面向?qū)ο筇匦缘腃語(yǔ)言的繼承者。s C Primer Plus》?! ortability: While the core of the language and the ANSI function calls are very portable, they are limited to controlflow, memory management, and simple filehandling. Everything else is platformspecific. Making a program that39。 Disadvantages: Does not easily support objectoriented techniques. Syntax can be difficult and lends itself to abuse. 移植性:C語(yǔ)言的核心以及ANSI函數(shù)調(diào)用都具有移植性,但僅限于流程控制、內(nèi)存管理和簡(jiǎn)單的文件處理。很容易與匯編語(yǔ)言結(jié)合。事實(shí)上,C仍然具有GOTO語(yǔ)句,不過(guò)它的功能被限制了,僅當(dāng)結(jié)構(gòu)化方案非常復(fù)雜時(shí)才建議使用。C語(yǔ)言是第一個(gè)使得系統(tǒng)級(jí)代碼移植成為可能的編程語(yǔ)言。s a good question, though, and not one with an easy answer. There are puter languages that work better for some applications than others. Here is a list of the major programming languages used to write games along with descriptions, advantages, and disadvantages. Hopefully this list will help you make a decision.C語(yǔ)言 如果說(shuō)FORTRAN和COBOL是第一代高級(jí)編譯語(yǔ)言,那么C語(yǔ)言就是它們的孫子輩。在某些應(yīng)用程序中,總有一些計(jì)算機(jī)語(yǔ)言優(yōu)于其他語(yǔ)言。我該使用何種語(yǔ)言 這是每個(gè)游戲編程FAQ里都有的問(wèn)題。下面是幾種用于編寫游戲的主要編程語(yǔ)言的介紹及其優(yōu)缺點(diǎn)。C語(yǔ)言是Dennis Ritchie在七十年代創(chuàng)建的,它功能更強(qiáng)大且與ALGOL保持更連續(xù)的繼承性,而ALGOL則是COBOL和FORTRAN的結(jié)構(gòu)化繼承者?! f FORTRAN and COBOL were the first piled highlevel languages, then C is their grandchild. It was created in the 7039。 C is a language that supports structured programming. That is to say that C programs are written as collections of disconnected function calls that run topdown rather than a single monolithic block of code with program controlflow happening via GOTO statements. Hence, C programs are generally easier to follow than monolithic FORTRAN and COBOL spaghetticode. Actually, C still has a GOTO statement, but its functionality is limited and it is only remended as a last resort if structured solutions are much more plicated. 正由于它的系統(tǒng)編程根源,將C和匯編語(yǔ)言進(jìn)行結(jié)合是相當(dāng)容易的。具有很高的標(biāo)準(zhǔn)化,因此其他平臺(tái)上的各版本非常相似。其他的東西都跟平臺(tái)有關(guān)。s portable between Windows and the Mac, for instance, requires that the userinterface portions be using systemspecific function calls. This generally means that you need to write the userinterface code twice. There are libraries, though, that make the process a bit easier. 用C語(yǔ)言編寫的游戲:非常非常多?! esources: The classic book about C is [The C Programming Language].It39。面向?qū)ο缶幊蹋蚍QOOP是結(jié)構(gòu)化編程的下一步。 C++ is the objectoriented successor to C. Objectoriented, or OO, programs are the next step beyond structured programming. OO programs are built out of objects, which are packages of data and functions collected into discrete units. There are many libraries of objects available that make writing programs as simple as pulling together a collection of program building blocks (at least in theory). For example, there are many GUI and database libraries that are implemented as collections of objects. C++總是辯論的主題,尤其是在游戲開(kāi)發(fā)論壇里?! ++ is the subject of controversy, especially in the game development munity. There are features of C++, like virtual functions, that add an extra layer of decisionmaking to function calls, and critics are quick to point out that C++ programs can be larger and slower than C counterparts. C++ advocates point out, however, that coding the equivalent of a virtual function in C requires the same overhead. It39。批評(píng)家正確的指出使用高級(jí)語(yǔ)言編寫的程序天生就比手寫的匯編語(yǔ)言來(lái)得慢,而且必然如此。很好的支持面向?qū)ο髾C(jī)制。比C慢。 Portability: Better than C, but still not great. While it shares the same disadvantage as C, most of the portable userinterface libraries are implemented as collections of C++ objects. 使用C++編寫的游戲:非常非常多。到目前為止,最好的C++教程是《Who39。s Afraid of C++ and Who39。s the second most monly asked question next to which programming language should I