Danh mục

3D Game Programming All in One- P12

Số trang: 30      Loại file: pdf      Dung lượng: 414.41 KB      Lượt xem: 19      Lượt tải: 0    
Hoai.2512

Phí tải xuống: 12,000 VND Tải xuống file đầy đủ (30 trang) 0
Xem trước 3 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

3D Game Programming All in One- P12: During the past several years while working on the Tubettiland “Online Campaign” softwareand more recently while working on the Tubettiworld game, I figure I’ve receivedmore than a hundred queries from people of all ages about how to get started makinggames. There were queries from 40-year-olds and 13-year-olds and every age in between.Most e-mails were from guys I would estimate to be in their late teens or early 20s.
Nội dung trích xuất từ tài liệu:
3D Game Programming All in One- P12 Game Initialization 237 Exec(./server/missionDownload.cs); Exec(./server/clientConnection.cs); Exec(./server/kickban.cs); Exec(./server/game.cs);}//-----------------------------------------------------------------------------package Common {function DisplayHelp() { Parent::DisplayHelp(); Error( Common Mod options: @ -fullscreen Starts game in full screen mode @ -windowed Starts game in windowed mode @ -autoVideo Auto detect video, but prefers OpenGL @ -openGL Force OpenGL acceleration @ -directX Force DirectX acceleration @ -voodoo2 Force Voodoo2 acceleration @ -noSound Starts game without sound @ -prefs Exec the config file );}function ParseArgs(){ Parent::ParseArgs(); // Arguments override defaults... for (%i = 1; %i < $Game::argc ; %i++) { %arg = $Game::argv[%i]; %nextArg = $Game::argv[%i+1]; %hasNextArg = $Game::argc - %i > 1; switch$ (%arg) { //-------------------- case -fullscreen: $pref::Video::fullScreen = 1; $argUsed[%i]++; Team LRN238 Chapter 7 ■ Common Scripts //-------------------- case -windowed: $pref::Video::fullScreen = 0; $argUsed[%i]++; //-------------------- case -noSound: error(no support yet); $argUsed[%i]++; //-------------------- case -openGL: $pref::Video::displayDevice = OpenGL; $argUsed[%i]++; //-------------------- case -directX: $pref::Video::displayDevice = D3D; $argUsed[%i]++; //-------------------- case -voodoo2: $pref::Video::displayDevice = Voodoo2; $argUsed[%i]++; //-------------------- case -autoVideo: $pref::Video::displayDevice = ; $argUsed[%i]++; //-------------------- case -prefs: $argUsed[%i]++; if (%hasNextArg) { Exec(%nextArg, true, true); $argUsed[%i+1]++; %i++; } else Error(Error: Missing Command Line argument. Usage: -prefs ); } Team LRN Game Initialization 239 }}function OnStart(){ Parent::OnStart(); Echo( --------- Initializing MOD: Common ---------); InitCommon();}function OnExit(){ Echo(Exporting client prefs); Export($pref::*, ./client/prefs.cs, False); Echo(Exporting server prefs); Export($Pref::Server::*, ./server/prefs.cs, False); BanList::Export(./server/banlist.cs); OpenALShutdown(); Parent::OnExit();}}; // Common packageactivatePackage(Common);Two key things that happen during game initialization are calls to InitBaseServer andInitBaseClient, both of which are defined in common/main.cs. These are critical func-tions, and yet their actual activities are not that exciting to behold.function InitBaseServer(){ Exec(./server/audio.cs); Exec(./server/server.cs); Exec(./server/message.cs); Exec(./server/commands.cs); Exec(./server/missionInfo.cs); Exec(./server/missionLoad.cs); Exec(./server/missionDownload.cs); Exec(./server/clientConnection.cs); Exec(./server/kickban.cs); Exec(./server/game.cs);} Team LRN240 Chapter 7 ■ Common Scripts function InitBaseClient() { Exec(./client/message.cs); Exec(./client/mission.cs); Exec(./client/missionDownload.cs); Exec(./client/actionMap.cs); Exec(./editor/editor.cs); Exec(./client/scriptDoc.cs); } As you can see, both are nothing more than a set of script loading calls. All of the scripts loaded are part of the common code base. We will look at selected key modules from these calls in the rest of this section. Selected Common Server Modules Next, we will take a close look at some of the common code server modules. The modules selected are the ones that will best help illuminate how Torque operates. The Server Module InitBaseServer loads the common server module, server.cs. When we examine this mod- ...

Tài liệu được xem nhiều: