【正文】
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! 確切的說,任何你能在其他語言里做到的事情,匯編都能做,只是不那么簡單 — 這是當(dāng)然,就像說你既可以開車到某個地方,也可以走路去,只是難易之分?! 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. 匯編語言(Assembly) 顯然,匯編是第一個計算機語言。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并使用它來寫程序,從而節(jié)省一大堆的時間,不過使用這種方法有兩個弊端: I thought this bore mentioning, as it39。t. By far the best groundup C++ tutorials are Who39。作為教程,有兩個陣營,一個假定你知道C,另外一個假定你不知道。因為它具有與C語言相同的缺點,大多數(shù)可移植性用戶界面庫都使用C++對象實現(xiàn)。與C語言一樣存在語法濫用問題。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)點:組織大型程序時比C語言好得多。同樣的爭論發(fā)生在六十年代高級程序語言如COBOL和FORTRAN開始取代匯編成為語言所選的時候。這將是一個還在進行,而且不可能很快得出結(jié)論的爭論。比如說,有很多的GUI和數(shù)據(jù)庫的庫實現(xiàn)為對象的集合。s C Primer Plus].C++ C++語言是具有面向?qū)ο筇匦缘腃語言的繼承者。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?! isadvantages: Does not easily support objectoriented techniques. Syntax can be difficult and lends itself to abuse. 移植性:C語言的核心以及ANSI函數(shù)調(diào)用都具有移植性,但僅限于流程控制、內(nèi)存管理和簡單的文件處理。很容易與匯編語言結(jié)合。事實上,C仍然具有GOTO語句,不過它的功能被限制了,僅當(dāng)結(jié)構(gòu)化方案非常復(fù)雜時才建議使用。C語言是第一個使得系統(tǒng)級代碼移植成為可能的編程語言。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語言 如果說FORTRAN和COBOL是第一代高級編譯語言,那么C語言就是它們的孫子輩。在某些應(yīng)用程序中,總有一些計算機語言優(yōu)于其他語言。我該使用何種語言 這是每個游戲編程FAQ里都有的問題。下面是幾種用于編寫游戲的主要編程語言的介紹及其優(yōu)缺點。C語言是Dennis Ritchie在七十年代創(chuà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?! 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和匯編語言進行結(jié)合是相當(dāng)容易的。具有很高的標(biāo)準(zhǔn)化,因此其他平臺上的各版本非常相似。其他的東西都跟平臺有關(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語言編寫的游戲:非常非常多?! esources: The classic book about C is [The C Programming Language].It39。面向?qū)ο缶幊?,或稱OOP是結(jié)構(gòu)化編程的下一步?! ++ 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++總是辯論的主題,尤其是在游戲開發(fā)論壇里。 C++ 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。批評家正確的指出使用高級語言編寫的程序天生就比手寫的匯編語言來得慢,而且必然如此。很好的支持面向?qū)ο髾C制。比C慢?! ortability: 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