Game programming

from Wikipedia, the free encyclopedia

UnrealEd , level editor of the Unreal Development Kit

Game programming is a part of game development and is the process of programming a computer game . Computer games are developed for a wide variety of platforms such as PCs , game consoles or smartphones . The most commonly used programming language is C or C ++ , because when developing games, the focus is primarily on speed. Demanding games in particular require the most direct and efficient access possible to the hardware of the system, this applies in particular to the graphics hardware . Special APIs have been developed for this purpose for the PC and now also for other platforms . The two best known for accessing graphics hardware are DirectX and OpenGL . Since these APIs are limited to the bare essentials, many program libraries have emerged over time , such as B. Allegro , SDL , SFML , which are based on DirectX or OpenGL.

Development process

It is estimated that up to 30 programmers often write over a million lines of source code for a modern commercial computer game . This requires good project planning and the use of version control software , bug trackers , automated creation processes and game engines .

planning

A professional game programming is based on the game design document. Due to this, more detailed plans for the implementation of the game functions are drawn up. Most of the phases of development are run through several times, as there are always changes in all phases . Being able to react quickly to such changes is of particular importance for the entire project.

implementation

The source code for a computer game is normally structured according to a layer model. At the lower end are the drivers , they offer direct access to the hardware. A hardware-related API such as B. DirectX or OpenGL, which is used by the most important element in the whole game project, the game engine above , which is mainly composed of the graphics engine , a sound engine, a possible physics engine and other systems for collision , animation , Controls, network , etc. and forms the core of the game. A game engine is mostly used for several games and can therefore be used universally within a limited framework . The scripting system, which provides a scripting language and uses parts of the game engine, but is only used in special areas, can be seen as the part above the game engine . The final step is the source code for the game logic, which is written individually for the respective computer game.

In addition, certain tools are specially written for the development (and possibly the expansion) of games . These help with the creation of elements that recur frequently in the game but have to be built and adapted individually, such as graphic elements or entire levels . An implementation at the programming language level is too complex and confusing here; Specially generated WYSIWYG editors (e.g. level editors ) enable easier and more effective creation of the corresponding content.

test

The exact procedure for testing can vary from developer to developer. On the programming side, procedures known from software development such as test-driven development can be used.

Frequently, specially employed testers are commissioned to test the games, who take care of the planning, coordination and execution of the tests. In contrast to the programmers, who can, for example, test the components of the game individually with the help of module tests , the testers receive a built version of the game, which is checked for errors without deeper knowledge of the internals (see black box test ).

Depending on the type of game, but often when a multiplayer mode is at the core of the game, alpha and beta tests are used, which give players the opportunity to play the game before it is released. Developers are interested in errors or problems that occur, as these can then be fixed before the game is released. Possible problems include errors in the game itself (see program errors ), unbalanced balancing, which can be traced back to the game or level design, for example, or excessive demands on the hardware due to insufficient computing power or network bandwidth. The alpha and beta test phases can be public or closed and are then referred to as either “open” or “closed alpha / beta”. In the case of a public test phase, the players usually have the opportunity to take part in it without any major fuss, while in the case of a closed participation usually an invitation is required, which can be awarded through raffles, among other things.

Tools and aids

The source code for a computer game can be written with any text editor and then compiled with a compiler . For a professional and effective working process is an integrated development environment such as MS Visual Studio , Eclipse , Netbeans , Xcode so that a variety of tools for developing software provide essential.

Programming languages

The most important decision factors for the choice of the programming languages ​​to be used are the speed, the amount of work, the target platforms and the languages ​​in the APIs and program libraries used.

language Strengthen weaknesses
Assembler fast error prone, slow development, difficult for beginners, not portable
C. high profile, numerous tools no integrated OO , problematic for large projects or multiple platforms
C ++ integrated OO , mostly used, numerous tools no built-in GC , or protection against memory leaks
C # very OO, RAD language, easy to use high memory consumption
Java very OO, easy to use, portable Generally not available on game consoles, decompilable
Eiffel , Smalltalk , Ada etc. rarely used, few game development tools
Script languages ​​like Lua , Python etc. often used for gameplay scripting, but not most of the game source code
Shader languages ​​such as Cg , HLSL , GLSL etc. almost indispensable for modern 3D game programming, but is not used for the main part of the game source code

Programming interfaces

graphic

Interfaces are addressed in order to execute the necessary drawing operations on the respective end device, which ensure the display of the game content . The driver of the graphics card or a comparable unit with graphics processor makes the functionalities of the graphics hardware available to the operating system, which, depending on the system, can be addressed via DirectX or OpenGL . There are also many frameworks that abstract these functionalities and system functionalities and make them available via a uniform interface, such as SFML , SDL , Allegro , XNA , LibGDX , OGRE or Irrlicht .

physics

Many games use physical simulations internally, which more or less realistically calculate the movement of objects, their collisions and connections and various other things. Libraries that do these calculations are called physics engines .

Game programming as a hobby

The most commonly used platforms for hobby development are operating systems for the PC and for mobile phones, such as Windows , Linux , Android (operating system) or iOS , as development for these devices either does not require a license or is relatively easy and inexpensive to obtain. Game consoles are seldom the target of game projects, since developer licenses are required for development, for execution on a test device and / or for sales, which are associated with costs and are often only granted to companies, but not to private individuals. Exceptions are Xbox Live indie games or open source consoles such as Ouya , as games can be published on there relatively easily.

See also

Web links

Individual evidence