CECS 455 Final Study Guide Spring 2010 (tentative 3-26-10) Chapter 11 Creating a 2D Game In the ScrollingBackgroundManager from the XELibrary a. describe (no code) what the Update method does b. The Draw method calls batch.Draw twice. Describe what these calls do using a diagram. Explain (no code) how a collision is detected. Platformer Starter Kit Explain how text files are used to determine the layout of each level. a. Explain how physics is applied to determine the vertical motion (both up and down) of the player. b. Explain how physics is applied to determine the horizontal motion of the player. Chapter 17 Finite State Machines and Game State Management In the GameStateManager from the XELibrary a. explain the purpose of DrawOrder and how it affects drawing b. explain what happens when OnStateChange is called c. explain what OnStateChange += state.stateChanged; from the AddState does d. explain the difference between ChangeState and PushState e. when do states get removed from the stack? Where does the TitleIntroState from the GameStateDemo get its StateChanged method? Explain what that method does and its effect. The PlayingState from the GameStateDemo does have a StateChanged method. Explain what that method does and its effect. Supplement: Playing Background Music Write the XNA code that will load the content and play tune.mp3 in the background, repeating when it is finished. Supplement: Playing Sound Effect (linked from Playing Background Music) Write the XNA code that will load the content and play boom.wav. Use the four argument method that will allow the sound to loop. Supplement: Beginning Game Development: Part VI - Lights, Materials and Terrain Lighting, Materials, Color, Color Types. Describe each of the three types of directional light. Describe each of the four color types. Chapter 14 HLSL Basics Understanding the Shader Process. Diagram the flow of data from an XNA games to the graphics card and finally onto the rendering surface. Vertex Shaders. Suppose a shader declares float4x4 Projection; Write the XNA code that will pass the value from the game to the shader. What is the most important function of a vertex shader. Pixel Shaders. Given the pixel shader float4 pixelShader(PixelInput input) : COLOR { return tex2D(TextureSampler, input.TexCoord) * AmbientColor; } a. Is tex2D an intrinsic function or a user-defined function? b. What type does input.TexCoord have? c. What is the float4 that the shader returns? Chapter 15 Advanced HLSL Vertex Displacement The book describes a vertex displacement shader. a. Describe the displacement of the object that takes place. b. How does this shader get the value of the time? Supplement: Game Trees. Alpha-beta search Minimax search In the game of NIM several piles of sticks are given. A player may remove, in one turn, any number of sticks from one pile of his or her choice. The player who takes the last stick loses. Starting with 113, (one stick, one stick, and three sticks) draw the tree of possible moves. Assuming the root is the MAX player mark each node of the tree with the minimax value where 0 is a loss for the MAX player and 1 is a win. Supplement: Minimax Search and Alpha-Beta Pruning Minimax search. Static evaluation. Assuming the root is the MAX player, mark each node of the following tree (links from parent to chilren are not shown) with the minimax value. _ _ _ _ _ _ _ _ _ _ _ _ _ 10 50 5 -10 7 5 -50 -7 -5 Supplement: A* Pathfinding for Beginners Use the Manhattan method to find the path from the start to the goal. The start square is S, the goal is G, O is an obstacle, and E is empty. EEEEE EEOEE ESOGE EEEEE Chapter 18 AI Algorithms Suppose the player and the enemy each have a Position vector. Write an expression for the direction in which the enmy should proceed to track the player. Chapter 22 Creating a 3D Game In the TunnelVision game a. How is it determined if an enemy collides with the player? b. What effect is used for the missile and why was it chosen? In the TunnelVision game the PhysicalObject Move method is public virtual void Move(float elapsed) { Velocity += Acceleration; Position += elapsed * Velocity; World = Matrix.CreateScale(Scale) * Rotation * Matrix>CreateTranslation(Position); BoundingSphere = new BoundingSphere(Position, Radius); } The Enemy move method finishes by calling the above Move. What two quantities does it calculate that are used directly in the above Move? The first parameter in the Level constructor ranges from 50 for level 1 to 3 for level 10. Explain carefully what this parameter represents. In the playing state the StateChanged method sets Visible = true if the playing state is not the current state. a. What effect does setting Visible to true have in terms of which method is called? b. When is the method mentioned in part a called? c. For the playing state what does calling that method do? The following code is part of the UpdateEnemies method. if (totalCreatedEnemies < Levels[CurrentLevel].Enemies) { if (enemyManager.Enemies.Count < EnemyManager.MAX_ENEMIES { ..... a. What does Levels[CurrentLevel].Enemies represent? b. What does EnemyManager.MAX_ENEMIES represent? Consider MissileManager. a. The Load method contains the line missles = new Missile[capacity] Explain carefully what 'capacity' represents. b. The AddMissile method contains for (int i = 0; i < missiles.Length; i++) { if (!missiles[index].IsActive) break; .... Explain carefully why the 'break' is executed.