Game programming

Game programming

Game programming, a subset of game development, is the programming of computer, console or arcade games. Though often engaged in by professional game programmers, many novices may program games as a hobby. Some software engineering students program games as exercises for learning a programming language or operating system.[citation needed]

Contents

Development process

Professional game development usually begins with a game design, which itself has several possible origins. Occasionally the game development process starts with no clear design in mind, but as a series of experimentations. For example, game designer Will Wright began development of The Sims—the best-selling PC game of all time—by getting programmers to experiment with several ideas.

Prototyping

Programmers are often required to produce prototypes of gameplay ideas and features. A great deal of prototyping may take place during pre-production, before the design document is complete, and may help determine what features the design specifies.

Prototypes are developed quickly with very little time for up-front design and mostly act as a proof of concept or to test ideas.

Game design

Though the programmer's main job is not to develop the game design, the programmers often contribute to the design as do game artists. The game designer will solicit input from both the producer and the art and programming lead for ideas and strategies for the game design. Often individuals in non-lead positions also contribute, such as copywriters and other programmers and artists.

Programmers often closely follow the game design document. As the game development progresses, the design document changes as programming limitations and new capabilities are discovered and exploited.

Production

During production, programmers churn out a great deal of source code to create the game described in the game's design document. Along the way, the design document is modified to meet limitations or expanded to exploit new features. The design document is very much a "living document" much of whose life is dictated by programmer's schedules, talent and resourcefulness.

While many programmers have some say in a game's content, most game producers solicit input from the lead programmer as to the status of a game programming development. The lead is responsible for knowing the status of all facets of the game's programming and for pointing out limitations. The lead programmer may also pass on suggestions from the programmers as to possible features they'd like to implement.

With today's visually rich content, the programmer must often interact with the art staff. This very much depends on the programmer's role, of course. For example, a 3D graphics programmer may need to work side by side with the game's 3D modelers discussing strategies and design considerations, while an AI programmer may need to interact very little, if at all, with the art staff. To help artists and level designers with their tasks, programmers may volunteer or be called upon to develop tools and utilities. Many of these may be ad-hoc and buggy due to time constraints (time for development of such tools is often not included in a game's schedule) as well as because they are only for in-house use anyway. Many game tools are developed in RAD languages for quicker development and may be discarded after the completion of the game.

Testing

The formal quality assurance testing process, performed by professional game testers, begins well into game development. High-budget titles may begin testing with the first playable alpha, while low-budget and casual games might not enter testing until a release candidate is ready. The programmers' task is to fix errors and bugs as such are discovered by the QA teams.

Nearing completion

Final tasks include "polishing" the game, such as programmers fixing occasional bugs—from minor to catastrophic—that may arise during the last phases of testing.

Game developers may have a beta testing period, but the definition of such varies from developer to developer. Often a beta contains all of the game's features, but may have a few bugs or incomplete content. Few games are given a public beta period, for example, to measure stress tolerance for game servers.

When the game is deemed complete, it is said to have "gone gold" and is shipped off to the publisher. Depending on circumstances, the publisher may then subject it to its own quality assurance or may begin pressing the game from the gold master.

Maintenance

Once a game ships, the maintenance phase for the video game begins. Programmers wait for a period to get as many bug reports as possible. Once the developer thinks they've obtained enough feedback, the programmers start working on a patch. The patch may take weeks or months to develop, but it's intended to fix most bugs and problems with the game. Occasionally a patch may include extra features or content or may even alter gameplay.

Duration

Most modern games take from one to three years to complete. The length of development depends on a number of factors, but programming is required throughout all phases of development except the very early stages of game design.

Tools

Game development programs are generated from source code to the actual program (called the executable) by a compiler. Source code can be generated by almost any text editor, but most professional game programmers use a full Integrated Development Environment (IDE). Once again, which IDE one uses depends on the target platform. Popular ones for Xbox and Windows development are Microsoft Visual Studio and CodeWarrior.

In addition to IDEs, many game development companies create custom tools developed to be used in-house. Some of these include prototypes and asset conversion tools (programs that change artwork, for example, into the game's custom format). Some custom tools may even be delivered with the game, such as a level editor.

Game development companies are often very willing to spend thousands of dollars to make sure their programmers are well equipped with the best tools. A well outfitted programmer may have two to three development systems dominating his office or cubicle.

Programming languages

Language Strengths Weaknesses
Assembly Low overhead Error-prone, slow development, difficult for novices, not portable
C Widely known, numerous tools No built-in OO support, difficult for large projects or multiple platforms.
C++ Built-in OO support, widely used, numerous tools No protection from memory leaks
C# Very OO, RAD language, easy to use High memory usage
Java Very OO, easy to use[citation needed], portable Not generally available on game consoles
Eiffel, Smalltalk, Ada, etc. Fringe game languages, few game development tools
Scripting languages like Lua, Python, etc. Often used for gameplay scripting, but not for the bulk of the game code itself

Once the game's initial design has been agreed upon, the development language must be decided upon. The choice depends upon many factors, such as language familiarity of the programming staff, target platforms (such as PlayStation or Microsoft Windows), the execution speed requirements and the language of any game engines, APIs or libraries being used.

Today, because it is object oriented and compiles to binary (the native language of the target platform), the most popular game development language is C++[citation needed]. However, Java and C are also popular, but inappropriate for some projects. Assembly language is necessary for some video game console programming and in some routines that need to be as fast as possible, or require very little overhead. Fringe languages such as C#, Ada and Python have had little impact upon the industry[citation needed] and are primarily used by hobbyists familiar with the languages, though C# is popular for developing game development tools.

High-level scripting languages are increasingly being used as embedded extensions to the underlying game written in a low or mid-level programming language such as C++. Many developers have created custom languages for their games, such as id Software's QuakeC and Epic Games' UnrealScript. Others have chosen existing ones like Lua and Python in order to avoid the difficulties of creating a language from scratch and teaching other programmers a proprietary language.

Vertex and pixel shaders are increasingly used in game development as programmable GPUs have become more prevalent. This has led to the increasing use of High Level Shader Languages in game programming, such as nVidia's Cg, though it cannot be used for all of game logic.

APIs and libraries

A key decision in game programming is which, if any, APIs and libraries to use. Today, there are numerous libraries available which take care of key tasks of game programming. Some libraries can handle sound processing, input, and graphics rendering. Some can even handle some AI tasks such as pathfinding. There are even entire game engines that handle most of the tasks of game programming and only require coding game logic.

Which APIs and libraries one chooses depends largely on the target platform. For example, libraries for PlayStation 2 development are not available for Microsoft Windows and vice-versa. However, there are game frameworks available that allow or ease cross-platform development, so programmers can program a game in a single language and have the game run on several platforms, such as the Wii, PlayStation 3, Xbox 360, Xbox, PSP and Microsoft Windows.

Graphic APIs

Today, graphics are a key defining feature of most games. While 2D graphics used to be the norm for games released through the mid-1990s, most games now boast full 3D graphics. This is true even for games which are largely 2D in nature, such as Civilization III.

The most popular personal computer target platform is Microsoft Windows. Since it comes pre-installed on almost ninety percent of PCs sold, it has an extremely large user base. The two most popular 3D graphics APIs for Microsoft Windows are Direct3D and OpenGL. The benefits and weaknesses of each API are hotly debated among Windows game programmers. Both are natively supported on most modern 3D hardware for the PC.

DirectX is a collection of game APIs. Direct3D is DirectX's 3D API. Direct3D is freely available from Microsoft, as are the rest of the DirectX APIs. Microsoft developed DirectX for game programmers and continues to add features to the API. The DirectX specification is not controlled by an open arbitration committee and Microsoft is free to add, remove or change features. Direct3D is not portable; it is designed specifically for Microsoft Windows and no other platform (though a form of Direct3D is used on Microsoft's Xbox and portable devices which run the Pocket PC operating system). The DirectX API is updated far more often than OpenGL implementations. As a result, new features of the latest 3D cards are included in the API much faster than with OpenGL.[citation needed]

OpenGL is a portable API specification. Code written with OpenGL is easily ported between platforms with a compatible implementation. Quake II was, ported from Windows to Linux by a fan of the game. OpenGL is a standard maintained by the OpenGL Architecture Review Board (ARB). The ARB meets periodically to update the standard by adding emerging support for features of the latest 3D hardware. Since it is standards based and has been around the longest, OpenGL is used by and taught in colleges and universities around the world.[citation needed] In addition, the development tools provided by the manufacturers of some video game consoles (such as the Nintendo GameCube, the Nintendo DS, and the PSP) use graphic APIs that resemble OpenGL. OpenGL often lags behind on feature updates due to the lack of a permanent development team and the requirement that implementations begin development after the standard has been published. Programmers who choose to use it can access some hardware's latest 3D features, but only through non-standardized extensions. The situation may change in the future as the OpenGL architecture review board (ARB) has passed control of the specification to the Khronos Group in an attempt to counter the problem.[1]

Other APIs

For development on Microsoft Windows, the various APIs of DirectX may be used for input, sound effects, music, networking and the playback of videos. Many commercial libraries are available to accomplish these tasks, but since DirectX is available for free, it is the most widely used.

For console programming, the console manufacturers provide facilities for rendering graphics and the other tasks of game development. The console manufacturers also provide complete development systems, without which one cannot legally market nor develop games for their system. Third-party developers also sell toolkits or libraries that ease the development on one or more of these tasks or provide special benefits, such as cross-platform development capabilities.

Game structure

The central component of any game, from a programming standpoint, is the game loop. The game loop allows the game to run smoothly regardless of a user's input or lack thereof.

Most traditional software programs respond to user input and do nothing without it. For example, a word processor formats words and text as a user types. If the user doesn't type anything, the word processor does nothing. Some functions may take a long time to complete, but all are initiated by a user telling the program to do something.

Games, on the other hand, must continue to operate regardless of a user's input. The game loop allows this. A highly simplified game loop, in pseudocode, might look something like this:

while( user doesn't exit )
  check for user input
  run AI
  move enemies
  resolve collisions
  draw graphics
  play sounds
end while

The game loop may be refined and modified as game development progresses, but most games are based on this basic idea.[2]

Game loops differ depending on the platform they are developed for. For example, games written for DOS and most consoles can dominate and exploit available processing resources without restraint. However, game for a modern PC operating system such as Microsoft Windows must operate within the constraints of the process scheduler. Some modern games run multiple threads so that, for example, the computation of character AI can be decoupled from the generation of smooth motion within the game. This has the disadvantage of (slightly) increased overhead, but the game may run more smoothly and efficiently on hyper-threading or multicore processors and on multiprocessor platforms. With the computer industry's focus on CPUs with more cores that can execute more threads, this is becoming increasingly important. Consoles like the Xbox 360 and PlayStation 3 already have more than one core per processor, and execute more than one thread per core.

Hobbyists

The only platforms widely available for hobbyists to program are consumer operating systems. This is because development on game consoles requires special development systems that cost thousands of dollars. Often these must be obtained from the console manufacturer and are only sold or leased to professional game development studios. However, Microsoft distributes a game development framework, XNA, which runs on both Microsoft Windows and Xbox 360. Games written for Windows often can be ported to Xbox with few changes. This allows individuals and small teams to develop games for consoles. Some hobbyists also develop homebrew games, especially for handheld systems or obsolete consoles.

See also

  • List of gaming topics

References

External links

Wikis


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Java 4K Game Programming Contest — The Java 4K Game Programming Contest (aka Java 4K and J4K ) is an informal contest that was started by the Java Game Programming community to challenge their software development abilities. The goal of the contest is to develop the best game… …   Wikipedia

  • Game artificial intelligence — refers to techniques used in computer and video games to produce the illusion of intelligence in the behavior of non player characters (NPCs). The techniques used typically draw upon existing methods from the academic field of artificial… …   Wikipedia

  • Game Oriented Assembly Lisp — (or GOAL) is a computer game programming language developed by Andy Gavin and the Jak and Daxter team at Naughty Dog. It was written using Allegro Common Lisp and used in the development of the entire Jak and Daxter series of games. Syntactically …   Wikipedia

  • Game development — is the process by which a game is produced. Today this term most commonly refers to the development of video games.OverviewDevelopment of video games is undertaken by a developer, which may be a single person or a large business. Typically, large …   Wikipedia

  • Game developer — can refer to:* Video game developer, a person or company that develops computer or video games ** generically, as a reference to a game designer, game programmer, or game producer * Game Developer (magazine), a monthly trade periodical for the… …   Wikipedia

  • Game programmer — Part of a series on …   Wikipedia

  • Game testing — Part of a series on …   Wikipedia

  • Game design — This article is about video game design, and does not deal with the design of other forms of game, such as board games and card games …   Wikipedia

  • Game producer — A game producer is the person in charge of overseeing development of a video game. The earliest documented use of the term producer in games was by Trip Hawkins, who established the position when he founded Electronic Arts in 1982. His vision… …   Wikipedia

  • Game development tool — A game development tool is a specialized software application that assists or facilitates the making of a computer or video game. Some tasks handled by tools include the conversion of assets (such as 3D models, textures, etc.) into formats… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”