1. Trang chủ
  2. » Giáo án - Bài giảng

All in one

4 309 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 4
Dung lượng 72 KB

Nội dung

Terraforming 537 Table 18.3 Terrain Editor Functions Function Description Select Selects grid points that will be painted with the brush. Adjust Selection Raises or lowers the currently selected grid points as a group. Add Dirt Adds "dirt" to the center of the brush. Excavate Removes "dirt" from the center of the brush. Adjust Height Drags the brush selection to raise or lower it. Flatten Sets the area bounded by the brush surface to be a flat plane. Smooth Smoothes, within the bounds of the brush, rough areas of varying terrain height. Set Height Sets the terrain within the brush to a constant height as specified in the Terrain Editor settings. Set Empty Converts the squares covered by the brush into holes in the terrain. Clear Empty Makes the squares covered by the brush solid. Paint Material Paints the current terrain texture material with the brush. Table 18.4 Terrain Terraform Editor Functions Function Description fBm Fractal Creates bumpy hills. Rigid Multifractal Creates ridges and sweeping valleys. Canyon Fractal Creates vertical canyon ridges. Sinus Creates overlapping sine wave patterns with different frequencies useful for making rolling hills. Bitmap Imports an existing 256 by 256 bitmap as a heightfield. Turbulence Perturbs another operation on the stack. Smoothing Smoothes another operation on the stack. Smooth Water Smoothes water. Smooth Ridges/Valleys Smoothes an existing operation on edge boundaries. Filter Filters an existing operation based on a curve. Thermal Erosion Erodes an existing operation using a thermal erosion algorithm. Hydraulic Erosion Erodes an existing operation using a hydraulic erosion algorithm. Blend Blends two existing operations according to a scale factor and mathematical operator. Terrain File Loads an existing terrain file onto the stack. Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Moving Right Along So, you've now seen how you can create and modify your game environment. The three main environmental elements are Sky, Clouds, and Water. We looked at the different ways each of those three elements can be created using tools and techniques available in Torque. In most cases, you will probably use some form of all of those techniques when you cre- ate your game. For example, you would judiciously mix overhead cloud layers with sky- box renderings of distant clouds on the horizon. We've also looked at the combined weather effects involved in storms, and how you can initiate an automated process to start and end storms over time using Torque Script. In this chapter, we were introduced to sounds in the form of thunder for the lightning strikes. In the next chapter we will more thoroughly explore how to incorporate sounds in our game. Chapter 18 ■ Making the Game World Environment538 Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 539 Creating and Programming Sound chapter 19 A s I mentioned in Chapter 1, audio artists compose the music and sound in a game. Good designers work with creative and inspired audio artists to create musical compositions that intensify the game experience. It also bears repeating that audio artists work closely with the game designers determining where the sound effects are needed and what the character of the sounds should be. They often spend quite a bit of time experimenting with sound-effect sources, looking for differ- ent ways to generate the precise sound needed. Visit an audio artist at work and you might catch him slapping rulers and dropping boxes in front of a microphone. After capturing the basic sound, an audio artist will then massage the sound with sound-editing tools, varying the pitch, speeding up the sound or slowing it down, removing unwanted noise, and so on. It's often a tightrope walk balancing Áp dụng kiến thức tổng hợp giải thích tượng sống    Câu chuyện: Mất bớt cá vận chuyển từ cực xích đạo bà buôn cá Hiện tượng ù tai bạn máy bay Một số tượng khác a Câu chuyện: Mất bớt cá vận chuyển từ cực xích đạo bà buôn cá:  Trái đất có dạng hình cầu  Trọng lực nơi  Tại vĩ tuyến khác lực ly tâm khác: - Càng tiến gần hai cực lực ly tâm yếu dần - Lực xích đạo MAX  Chính trái đất quay quanh trục gây lục ly tâm lớn nhỏ khác vị trí mặt đất giải thích rõ tượng giảm cân ( bớt cá) b Hiện tượng ù tai bạn máy bay:  Càng xa khỏi bề mặt trái đất áp suất giảm  Màng nhĩ tai màng chắn mỏng  Khi máy bay thay đổi độ cao, áp suất không khí tai ta chênh lệch đột ngột  Do đó, ta bị ù tai c Một số tượng khác:  Cập nhật học sau LIÊN HỆ   Mọi câu hỏi đặt để giải đáp xin gởi mail: WNghia@yahoo.com $TypeMasks::TerrainObjectType | $TypeMasks::ShapeBaseObjectType; %scanTarg = ContainerRayCast(%x SPC %y SPC "500", %x SPC %y SPC "-100", %search- Masks); if(%scanTarg && !(%scanTarg.getType() & $TypeMasks::InteriorObjectType)) { %newpos = GetWord(%scanTarg,1) SPC GetWord(%scanTarg,2) SPC GetWord(%scanTarg,3) + 1; } %coin = new Item("Copper "@%i) { position = %newpos; rotation = "1 0 0 0"; scale = "5 5 5"; dataBlock = "Copper"; collideable = "0"; static = "0"; rotate = "1"; }; MissionCleanup.add(%coin); CoinGroup.add(%coin); } } The first thing this function does is to obtain the particulars of the MissionArea . For this game, you should use the Mission Area Editor (press F11 followed by F5) to expand the MissionArea to fill the entire available terrain tile. The %H and %W values are the height and width of the MissionArea box. The variables %west and %south combined make the coordinates of the southwest corner. We uses these values to constrain our random number selection. Then we set up a search mask. All objects in the Torque Engine have a mask value that helps to identify the object type. We can combine these masks using a bitwise-or opera- tion, in order to identify a selection of different types of interest. Then we use our random coordinates to do a search from 500 world units altitude down- ward until we encounter terrain, using the ContainerRayCast function. When the ray cast finds terrain, we add 1 world unit to the height and then use that plus the random coordinates to build a position at which to spawn a coin. Then we spawn the coin using the appropriate datablock, which can be found in your new copy of item.cs. Next, we add the coin to the MissionCleanup group so that Torque will automatically remove the coins when the game ends. We also add it to the CoinGroup in case we want to access it later. Triggering Events 627 Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. After putting that code in, copy C:\3DGPAi1\RESOURCES\CH22\ITEM.CS over to C:\koob\control\server\misc. You will find the datablocks for the coins (where the coin values are assigned) in there. Note that when we added the coins in the preceding code, the static parameter was set to 0. This means that the game will not create a new coin at the place where the coin was picked up, if it is picked up. The weapons of the ammo do this, but we don't want our coins to do it. It's a game play design decision. In addition to the datablocks for the coins in item.cs, you will also find this code: if (%user.client) { messageClient(%user.client, 'MsgItemPickup', '\c0You picked up %1', %this.pickup- Name); %user.client.money += %this.value; %user.client.DoScore(); } The last two statements in there allow the player to accumulate the money values, and then the server notifies the client of the new score. Note that it is similar in that small way to the checkpoint scoring. Again, until the client code is in place, you can insert echo statements there to verify that things are working properly. Deaths We want to track the number of times we die to further satisfy requirements, so open C:\koob\control\server\server.cs, locate the method GameConnection::onDeath , and add these lines at the end: %this.deaths++; %this.DoScore(); By now these lines should be familiar. We can expand the player death by adding some sound effects and animation. Add the following to the end of C:\koob\control\server\ players\player.cs: function Player::playDeathAnimation(%this,%deathIdx) { %this.setActionThread("Die1"); } datablock AudioProfile(DeathCrySound) { fileName = "~/data/sound/orc_death.wav"; description = AudioClose3d; Chapter 22 ■ The Game Server628 Team LRN Please purchase PDF Final Change The final, very, very last piece of code we are going to change will allow us to remain in the program after we exit a game. Previously, when we exited a game using the Escape key, the program quit. This final change tidies that up for us. Open the file C:\koob\control\ client\misc\presetkeys.cs and locate the function DoExitGame() and change it to match the following: function DoExitGame() { if ( $Server::ServerType $= "SinglePlayer" ) MessageBoxYesNo( "Exit Mission", "Exit?", "disconnect();", ""); else MessageBoxYesNo( "Disconnect", "Disconnect?", "disconnect();", ""); } This function now checks to see if we are in single- or multiplayer mode. It does this to provide a customized exit prompt depending on which mode it is. In any event, the disconnect function is called to break the connection with the game server. Moving Right Along So there you have it. I hope your fingers aren't worn to the bone. You can see that there is a great deal of power available to those worn fingertips. I'm sure that as you've progressed through the preceding chapters, your head began to fill with all sorts of ideas about things you might want to do. In the next and final chapter of the book, I have a few things I want to say on that topic. Moving Right Along 657 Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. This page intentionally left blank Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 659 The End Game chapter 24 B y now you've worn many hats, as programmer, 2D artist, 3D modeler, sound engi- neer, and level designer, to mention just the big ones. It should be fairly evident that each of these specialties has a great deal of depth, and it is hard to do justice to any one of them in a book like this. However, it should also be apparent that you can make complex and feature-rich games without the need for million-dollar budgets. In this chapter we'll look at some of the things that didn't quite fit as topics in the earlier chapters. A great deal of the work is done for us by the Torque Engine, but that's just where the process starts—the end is wherever you want it to be. There are other game engines out there, ranging from free to expensive, but the relationship between the end result and the price of the engine is not a linear one. The result is dependent on the amount of effort and inspiration you bring to the table. Making successful games is about transforming a great idea into a great game, and that operation can't be bought with mere money. If you are going to put together a small team to develop a game using Torque, I would sug- gest you fill the artistic slots first—at least sign up a dedicated 3D modeler. You will also need one programmer to manage your script work. Finally, you need someone responsi- ble for doing map layout, creating game rules, and managing the relationship between the models and the code. This makes a three-person team, which is probably as close to an ideal size as you're going to get for a small, low-budget development team. If you have the luxury of adding another team member, make sure you give him the sound-engineer responsibilities. Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Testing To properly test your game you are going to need to go back to your requirements and review them. For each specific requirement you have to decide what procedure someone else would need to perform to prove to you that their software fulfilled that requirement. Write the pro- cedure down, and move on to the next requirement. Be hypercritical, a skeptic's skeptic. Basics There are many formalized testing methodologies, but the basic need when Torque Console Script Command Reference 687 FindFirstFile (pattern) Parameters: pattern String pattern. Return: string The file's name. Description: Finds the name of the first file in the Torque Script file name buffer matching the given pattern . Supports "*" to match any number of any characters and "?" to match any single character. Usage: %result = FindFirstFile("/common/*.cs"); FindNextFile (pattern) Parameters: pattern String pattern. Return: string The file's name. Description: Finds the name of the next file in the Torque Script filename buffer matching the search by immediately previous call to FindFirstFile . Supports '*' to match any number of any characters and '?' to match any single character. Usage: %result = FindNextFile("/common/*.cs"); FirstWord(text) Parameters: text String with space-delimited words. Return: string The resultant string. Description: Gets the first word-string within text . Usage: %tgt = FirstWord(%text); FlushTextureCache() Parameters: none Return: nothing Description: Deletes cached textures from memory. Usage: FlushTextureCache(); FreeMemoryDump() Parameters: none Return: nothing Description: Prints free memory statistics. Usage: FreeMemoryDump(); Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Appendix A ■ The Torque Game Engine Reference688 GetBoxCenter(box) Parameters: box String containing two 3D tuples defining the box. Return: string Description: Computes the center of a box. Usage: %c = GetBoxCenter("10,10,10,50,50,50"); GetBuildString() Parameters: none Return: string Description: Obtains the BUILD type (Release or Debug) of the current build. Usage: %bs = GetBuildString(); GetCompileTimeString() Parameters: none Return: string Description: Obtains the compile time and date of the current build. Usage: %ct = GetCompileTimeString(); GetControlObjectAltitude() Parameters: none Return: numeric Description: Obtains the altitude of the player object. Usage: %altitude = %player.GetControlObjectAltitude(); GetControlObjectSpeed() Parameters: none Return: numeric Description: Obtains the speed of the player object. Usage: %speed = %player.GetControlObjectSpeed(); Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Torque Console Script Command Reference 689 GetDesktopResolution() Parameters: none Return: string Description: Reports the current desktop resolution. Usage: %res = GetDesktopResolution(): GetDisplayDeviceList() Parameters: none Return: string Description: Obtains the device name for each display device. Usage: %name = GetDisplayDeviceList(); GetField(text, index) Parameters: text String with field-delimited words. index Field-based offset into the text string. Return: string Contains the found field-string. Description: Gets the field-string at index within text . In the usage example that follows, if %text equaled "Of Mice and Men", then %word would be set to "and" when the function returned. Usage: %field = GetField(%text, 0); GetFieldCount (text) Parameters: text String with field-delimited words. Return: numeric Description: Gets the number of field-strings within text . Usage: %count = GetFieldCount( %text ); Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Appendix A ■ The Torque Game Engine Reference690 GetFields(text, first [, last]) Parameters: text String with space-delimited fields. first Field-based offset into the text string specifying the first field to extract. last Field-based offset into the text string specifying the last field to extract. Return: string Contains the found fields. Description: Gets one or more field-strings at index within text .If count is specified, gets count number of field-strings. Usage: %position = GetFields(%obj.getTransform(), 0, 2); GetFileCount (pattern) Parameters: pattern Torque Console Script Command Reference 717 SetOpenGLMipReduction(level) Parameters: level Mipmap level (0 = minimum detail, 5 = maximum detail). Return: nothing Description: Sets shape texture detail to level. Usage: SetOpenGLMipReduction(2); SetOpenGLSkyMipReduction(level) Parameters: level Mipmap level (0 = minimum detail, 5 = maximum detail). Return: nothing Description: Sets skybox and cloud texture detail. Usage: SetOpenGLMipReduction(2); SetRandomSeed([seed]) Parameters: seed Starting point. Return: nothing Description: Sets the current starting point for generating a series of pseudo-random numbers. Usage: SetRandomSeed(); SetRecord (text, index, subst) Parameters: text String with new line-delimited records. index Record-based offset into the text string. subst Substitute string. Return: string The resultant string. Description: Substitutes the record-string sub for the record-string found at index in the string text . Usage: %str = SetRecord(%text, 0, "blah"); SetOpenGLTextureCompressionHint(hint) Parameters: hint The compression level hint. Choices: GL_DONT_CARE GL_FASTEST GL_NICEST Return: nothing Description: Suggests texture compression mode. Usage: SetOpenGLTextureCompressionHint(GL_NICEST); Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Appendix A ■ The Torque Game Engine Reference718 SetResolution(width, height, bpp) Parameters: width Screen width. height Screen height. bpp Bits per pixel. Return: numeric 1 = success, 0 = fail. Description: Sets the screen resolution to specified values. Usage: %result = SetResolution(640,480,32); SetScreenMode(width, height, bpp, fullScreen) Parameters: width Screen width. height Screen height. bpp Bits per pixel. fullScreen 1 enables, 0 disables. Return: numeric 1 = success, 0 = fail. Description: Sets up the screen with specified values. Usage: %result = SetScreenMode( 800, 600, 32, true ); SetServerInfo(index) Parameters: index Row of interest in the server list. Return: numeric 1 = success, 0 = fail. Description: Changes our indexed reference into the ServerList . Usage: %result = SetServerInfo(%index); SetShadowDetailLevel(level) Parameters: level Numeric range 0.0 to 1.0. Return: nothing Description: Sets the level of detail for shadows. Usage: SetShadowDetailLevel( 1.0 ); SetVerticalSync(switch) Parameters: switch 1 enables, 0 disables. Return: numeric 1 = true ,0 = false . Description: Enables or disables the use of VerticalSync . Usage: SetVerticalSync(true); Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Torque Console Script Command Reference 719 SetZoomSpeed( speed ) Parameters: speed Transition speed. Ranges from 0 to 2,000 milliseconds. Return: nothing Description: Sets the transition speed when changing field of view. Usage: SetZoomSpeed( speed ); StartHeartbeat() Parameters: none Return: nothing Description: Begins periodic messages to the master server that show that this server is still alive. Usage: schedule(0,0,StartHeartbeat); StartRecording(filename) Parameters: filename String containing file name. Return: nothing Description: Records a demo and saves it as f ilename . Usage: StartRecording(myDemo); StopHeartbeat() Parameters: none Return: nothing Description: Stops the heartbeat messages. Usage: StopHeartbeat(); SetWord(text, index, subst) Parameters: text String with space-delimited words. index Word-based offset into the text string. subst Substitute string. Return: string The resultant string. Description: Substitutes the word-string sub for the word-string found at index in the string text . Usage: %str = SetWord(%text, 0, "blah"); Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Appendix A ■ The Torque Game Engine Reference720 StopRecording() Parameters: none Return: nothing Description: Stops the currently recording demo. Usage: StopRecording(); StopServerQuery() Parameters: ... ta bị ù tai c Một số tượng khác:  Cập nhật học sau LIÊN HỆ   Mọi câu hỏi đặt để giải đáp xin gởi mail: WNghia@yahoo.com

Ngày đăng: 26/04/2016, 12:00

Xem thêm