14.4 Gaming

Computer gaming is a computer simulation of a virtual world that draws players into the world as participants. Although computer games can be used as teaching tools, their primary function is to entertain.

A virtual world, which is also known as a digital or simulated world, is an interactive, computer-generated environment. Such worlds are often designed to resemble reality, where real-world rules and laws would still be applicable (to the character you are playing, of course), but they can also be built as deep fantasy worlds where such rules do not apply. Although there are many different types of virtual worlds, persistent online virtual worlds all tend to share the same basic features. They are usually active all day, every day, barring any downtime for maintenance; the game continues to be played, whether individual players are logged in or not. Multiple players can participate in the games at the same time, with the entire interaction taking place in real time.

Virtual worlds are highly social places, encouraging players to form teams, guilds, neighborhoods, and clubs within the game. Unlike flat, one-dimensional games such as Solitaire, many of today’s virtual worlds encompass 3D environments that are designed to immerse the player in the world in which he or she is playing.

Creativity and technological savvy are both required to create the virtual world of a computer game. Designers must be cognizant of aspects of computer science such as computer graphics, artificial intelligence, human–computer interaction, simulation, software engineering, and computer security, in addition to the fundamentals of mathematics. To make people, objects, and environments behave realistically in a virtual environment, programmers and designers also need to be aware of the laws of physics relating to gravity, elasticity, light, and sound. Games may use fake physics, but the rules of the fake physics must be consistent and believable within the context of the game.

History of Gaming

The general meaning of gaming has evolved over the past few decades. The first electronic games were developed in the 1940s, using a device that allowed a user to control a vector-drawn dot on the screen to simulate a missile being fired at targets. In 1971, the first coin-operated video game was sold on the commercial market. Gaming didn’t really start to take off until the invention of the Atari 2600 and Pong, its wildly popular game, in 1977. The success of Atari’s game console opened the doors for companies such as Nintendo and Sony, which have since released many popular game consoles, such as Nintendo 64, Nintendo Wii, and Sony Playstation.

One way of classifying games is by the type of platform they use: handheld games such as Nintendo’s Game Boy, consoles such as Nintendo 64 and Microsoft’s Xbox that plug into a television, or computer games that are either self-contained or offered over the Internet. Regardless of the platform, there is always a computer in the background running the simulation.

Another way of classifying games is by genres, based on the gameplay. Gameplay is the type of interactions and experiences a player has during the interaction within the game. Action games require a player to use quick reflexes and timing to overcome obstacles. There are many sub-genres of action games, such as beat ’em up and hack-and-slash games, which include one-on-many close combat situations. In contrast, fighting games emphasize one-on-one combat. Another subgenre of action games places the virtual world entirely within a maze.

Shooter games focus on using projectile weapons in combat. Action-adventure games present both short-term and long-term obstacles that must be overcome to succeed. Life-simulation games allow the player to control one or more artificial lives. Role-playing games allow the player to become a character in the story line of the game. Strategy games require careful problem solving and planning to achieve victory within the confines of the game.

Creating the Virtual World

A game engine is a software system within which games can be created. A game engine provides tools with the following functionality:

  • A rendering engine for graphics

  • A physics engine to provide a collision detection system and dynamics simulation to solve the problems related to forces affecting the simulated objects

  • A sound-generating component

  • A scripting language apart from the code driving the game

  • Animation

  • Artificial intelligence algorithms (e.g., path-finding algorithms)

  • A scene graph, which is a general data structure to hold the spatial representation in a graphical scene

Collectively, these tools enable the game developer to create the virtual world of a game. All game engines need to include a renderer, which uses a large chunk of the CPU’s processing. The renderer actually visualizes the scene, putting the environment up on the screen for the user to view. In addition, 3D objects are kept as vertices in a 3D world, showing the computer where to fill in images on the screen. This is all part of the renderer’s functions.

A physics engine simulates models based on Newtonian physics, using mass, velocity, friction, and wind resistance calculations to determine which effects would occur in the real world, so that those effects can then be duplicated in the game engine. The accuracy of the simulation depends on the processing power of the system being used to create the content. High-precision physics engines use more processing power to determine exact calculations, so they are usually applied to animated movies. The physics engine used for computer gaming simplifies the calculations in the game to make sure that a real-time response to an action is achieved.

Collision detection algorithms check the accuracy of collision points or the intersection of two solids. For example, in a game of bowling, a collision detection algorithm would be used to determine the accuracy of the collision that occurs when the bowling ball intersects with the pins. These calculations can apply to solid objects, liquids, and even “human” characters. Rag-doll physics is a type of simulation used to accurately animate a “dying” character’s movements or the movements of characters who are fighting. Rather than having characters drop limply to the ground, rag-doll physics essentially connects a character’s “bones” through a series of joints (just as an actual human has) to simulate realistic movement.

Artificial intelligence provides the illusion of intelligence in the behavior and actions of nonplayer characters. Essentially, it gives nonhuman entities algorithmic and mathematical solutions for problem solving, simulation of human thought, and decision making. While that might not sound terribly complicated, each idea must be expressed through mathematical expression or a script that calculates the odds and anticipates possible actions of the other human players. These nonplayer characters also need to have “knowledge” of language, planning, recognition, and the ability to learn from the actions of those human players around them.

Game Design and Development

The game design process begins with a concept, preferably one that nobody has seen before. After much brainstorming, the designer completes a game design document, outlining the many different aspects of the game, including its story line, art, characters, and environment. After the initial team is assigned to the project, the technical ideas for the game really start to flow, as designers, programmers, and artists seek to ensure that the most cutting-edge technology that they have at their fingertips is included in the game.

Once the game technology is at the point where actual gameplay can be developed, the game design is often broken down into fundamental tasks, such as construction of a small game segment, with subsequently developed segments then building on that part. For example, when working on character movement, designers would first develop each movement individually. They might start by making the characters move backward and forward and turn in multiple directions, thereby ensuring that basic navigation through the game is functioning. They would then build on that movement by adding options such as running, jumping, or crouching. After each new section of the game is introduced, the team must verify that the parts of the game developed previously still function with the new aspects of the game.

The development of a new virtual environment requires decisions about how advanced the graphics and simulations in the game should be. Developers may need to decide between a 2D and a 3D game, or even whether artificial intelligence technology will be included in the game. 3D images are created through the process of rendering—that is, using computer programs to generate an image from a model. Much like an artist’s rendering of a scene, the computer model would contain geometry, viewpoint, texture, lighting, and shading information, all of which would allow the 3D image to be created with as much detail as possible.

Designers need to develop their ideas beyond the storyline, character descriptions, and environmental specifications. Put simply, they have to think about how the characters and the environment will interact. These very visual aspects of the game may need a great deal of fine-tuning before designers, programmers, and artists are satisfied with the results. Inevitably, some elements will be missing from the design and will need to be added in later. For example, do the characters walk or stroll when they move? Does the clothing move with the characters’ movements? If the game is set outside, are all the true elements of nature included? Does the wind blow? Are there birds and clouds in the sky? Do players design their characters’ history themselves, or is that information written into the script? If the game is a fantasy, which powers will the characters have? The list of elements that designers need to think about is endless.

Although the first level of development sets the basic parameters for the design of the game, the design constantly evolves and changes throughout the development and production process. It is nearly impossible to stick to the original design, as the development of a game involves too many different aspects, such as mechanics, art, pro gramming, audio, video, and scripting. All of these aspects depend on one another, and all of them need to remain flexible as other features of the game advance. A big part of the game design process is being willing to abandon much of the work that has been completed when it becomes evident that the game needs to go in a new direction. The game’s content may need to change as the game evolves, features and levels may be removed or added, art may advance, and the entire backstory of the game may change.

Game Programming

When all the design decisions have been made, programmers produce the code to create the virtual world of the game. The coding process is the single biggest endeavor in game production, as it essentially runs all aspects of the game. Java is typically used for Android games. Apple developers often use Objective C for mobile game development. C# is also popular for game development, along with JavaScript and Lua. Some prominent engine developers have created custom languages for games based on their engines, such as Epic Game’s UnrealScript for the Unreal engine and Unity 3D.

A variety of application programming interfaces (APIs) and libraries are available to assist developers with key programming tasks in the game. The choice of API determines which vocabulary and calling conventions the programmer should employ to use the services. The target game platform determines which service the programmer will use. Some libraries allow for cross-platform development, which streamlines the development pipeline and allows the programmer to program a game in a single language that will run on several platforms (such as Microsoft Windows [for PCs], Nintendo Wii, and Playstation). Also, because graphics are such an important feature in today’s gaming industry, graphic APIs (such as Direct3D) are available to render 3D graphics in advanced applications.

The coding begins with creation of the game loop. The game loop is responsible for managing the game world, regardless of whether the user has provided any input. For example, the game loop might update the enemy movement in the game, check for victory/loss conditions, update the game elements throughout the game world, and process input if provided. In short, the game loop manages the simulation.

Often, large design teams will have different programmers who focus on different aspects of the game. For example, the senior engine programmer may write and maintain the code for the game loop, design in-game engine editors, and make sure that the file formats are acceptable for importing and exporting 2D and 3D art packages and audio/video files. The 3D software programmer may design and implement the 3D graphics component, while the user interface programmer works on the APIs in the game engine. The programmers work together to create a streamlined, working game.

Despite beta testing and demoing, new computer games often have bugs. The beauty of online games is that any “fixes,” maintenance, or addition of new features and upgrades can be performed without interrupting the ongoing action.

SUMMARY

Simulation is a major area of computing that involves building computer models of complex systems and experimenting with those models to observe their results. A model is an abstraction of the real system in which the system is represented by a set of objects or characteristics and the rules that govern their behavior.

There are two major types of simulation: continuous and discrete event. In continuous simulation, changes are expressed in terms of partial differential equations that reflect the relationships among the set of objects or characteristics. In discrete-event simulation, behavior is expressed in terms of entities, attributes, and events, where entities are objects, attributes are characteristics of an entity, and events are interactions among the entities.

Queuing systems are discrete-event simulations in which waiting time is the factor being examined. Random numbers are used to simulate the arrival and duration of events, such as cars at a drive-through bank or customers in a supermarket. Meteorological and seismic models are examples of continuous simulation.

Computer graphics is a fascinating area that combines computers, science, and art. Much of graphics depends on mathematical equations that simulate the natural phenomena presented in the image. Computer graphics combines light interactions, object properties such as transparency and surface texture, object shape, and physical properties to produce images that approach the realism of an actual photograph.

Computer gaming is the simulation of a virtual world within which the players can interact with the system and with each other. A game engine is a software system within which game developers, designers, and programmers create a game’s virtual world.

KEY TERMS

EXERCISES

For Exercises 1–8, match the kind of simulation with the example.

  1. Continuous simulation

  2. Discrete-event simulation

  1.   1. Weather forecasting

  2.   2. Stock portfolio modeling

  3.   3. Seismic exploration

  4.   4. Hurricane tracking

  5.   5. Predicting the number of tellers a new bank needs

  6.   6. Determining the number of waiting rooms necessary for a doctor’s office

  7.   7. Gas exploration

  8.   8. Air pollution movement

For Exercises 9–24, mark the answers true or false as follows:

  1. True

  2. False

  1.   9. Simple systems are best suited to being simulated.

  2. 10. Complex systems are dynamic, interactive, and complicated.

  3. 11. A model is an abstraction of a real system.

  4. 12. The representation of a model may be concrete or abstract.

  5. 13. In computer simulations, the models are concrete.

  6. 14. The more characteristics or features represented in a model, the better.

  7. 15. Continuous simulations are represented by entities, attributes, and events.

  8. 16. Discrete-event simulations are represented by partial differential equations.

  9. 17. CAD stands for computer-aided drafting.

  10. 18. A time-driven simulation can be thought of as a big loop that executes a set of rules for each value of the clock.

  11. 19. A model whose realization is within a computer program is an abstract model.

  12. 20. A concrete model can be realized within a computer program.

  13. 21. Red is the specular highlight on a green plastic ball if the light source is red.

  14. 22. A commonly used illumination model in computer graphics was developed in the 1970s.

  15. 23. Ambient light, diffuse reflection, and specular reflection are three components of a common shading model for computer graphics.

  16. 24. Computer graphics relies on research from other scientific fields for equations used in image creation.

Exercises 25–52 are problems or short-answer questions.

  1. 25. Define simulation and give five examples from everyday life.

  2. 26. What is the essence of constructing a model?

  3. 27. Name two types of simulations and distinguish between them.

  4. 28. What are the keys to constructing a good model?

  5. 29. What defines the interactions among entities in a discrete-event simulation?

  6. 30. What is the relationship between object-oriented design and model building?

  7. 31. Define the goal of a queuing system.

  8. 32. What are the four pieces of information needed to build a queuing system?

  9. 33. What part does a random number generator play in queuing simulations?

  10. 34. Write the rules for a queuing simulation of a one-pump gas station, where a car arrives every three minutes and the service time is four minutes.

  11. 35. Do you think the gas station in Exercise 34 will be in business very long? Explain.

  12. 36. Rewrite the simulation in Exercise 34 such that a car arrives every two minutes and the service time is two minutes.

  13. 37. Write the rules for a queuing system for an airline reservation counter. There are one queue and two reservation clerks. People arrive every three minutes and take three minutes to be processed.

  14. 38. Distinguish between a FIFO queue and a priority queue.

  15. 39. What did SIMULA contribute to object-oriented programming methodology?

  16. 40. In general, meteorological models are based on the time-dependent equations of what fields?

  17. 41. How much study of mathematics is necessary to be a meteorologist?

  18. 42. Why is there more than one weather prediction model?

  19. 43. Why do different meteorologists give different forecasts if they are using the same models?

  20. 44. What are specialized meteorological models, and how are they used?

  21. 45. What are seismic models used for?

  22. 46. A random-number generator can be used to vary service times as well as determine arrivals. For example, assume that 20% of customers take eight minutes and 80% of customers take three minutes. How might you use a random-number generator to reflect this distribution?

  23. 47. Why do we say that simulation doesn’t give an answer?

  24. 48. What do simulations and spreadsheet programs have in common?

  25. 49. Explain why shadows are important in graphics applications.

  26. 50. What type of mathematical objects would you need to use to create a model of a table?

  27. 51. Explain why it is so difficult to get objects to move in computer animation.

  28. 52. Name five areas encompassed by computational biology.

THOUGHT QUESTIONS

  1.   1. Priority queues (PQs) are very interesting structures. They can be used to simulate a stack. How might you use a PQ as a stack?

  2.   2. Priority queues can also be used to simulate a FIFO queue. How might you use a PQ as a FIFO queue?

  3.   3. In Chapter 8, we described the graph data structure. A depth-first traversal of a graph uses a stack, and a breadth-first traversal of a graph uses a FIFO queue. Can you explain why?

  4.   4. In this chapter we described queuing systems where there is a queue for each server. Other types of queuing systems exist as well. For example, in the airport there is usually one queue for many servers. When a server is free, the person at the front of the queue goes to that server. Could you represent this type of system in a simulation?

  5.   5. What other real-life situations can be modeled using a priority queue?

  6.   6. CAD systems are now available for everyday use. Go to your local computer store and see how many programs are available to help you design anything from a kitchen to a guitar.

  7.   7. Do you see video gaming as a problem for you or your friends? Has it affected your own or a friend’s schoolwork?

  8.   8. Do you know anyone whom you might consider to be addicted to video gaming?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.200.136