CSE 380 – Computer Game Programming Sprite Animation

Slides:



Advertisements
Similar presentations
CSE 380 – Computer Game Programming Tile Based Graphics Legend of Zelda, by Nintendo, released 1987.
Advertisements

Using 2D sprite with OpenGL 2003 team Koguyue. Overview Motivation and basic concepts Advantages with using OpenGL Basic requirements of implementation.
2D Platform Games: Tiles & Scrolling
UNIVERSITY OF KARACHI DEPARTMENT OF COMPUTER SCIENCE BSCS 514 KING OF FIGHTER GROUP MEMBER MUHAMMAD NOMAN SIDDQUI SYED BILAL RAZA TAHA HASSAN.
3.1. G RAPHICS I The use of images within games. Reflections and advice on the games proposed in the Week 2 Hand-in.
Game Rules Implementation Lecture 5 1. Revisit 2  Lab 4 – Other Input Methods  Touches Basics  Relationship between TouchesBegan, TouchesMoved, and.
CS 180 Problem Solving and Object Oriented Programming Fall 2011 Notes for the Final Lecture Dec 7, 2011 Aditya Mathur Department of Computer Science Purdue.
How do games work? Game Workshop July 4, Parts Sprites/pictures Map/background Music/sounds Player character Enemies Objects.
Building Memory… Day 5 – November 27, Need to flip cards Create a remove method to remove from drawing canvas Call a show method to show on the.
Lec 5 Feb 10 Goals: analysis of algorithms (continued) O notation summation formulas maximum subsequence sum problem (Chapter 2) three algorithms image.
CIS Game Design I Chapter 6 and 7 Blake Farrugia 10/24/2011.
AGD: 5. Game Arch.1 Objective o to discuss some of the main game architecture elements, rendering, and the game loop Animation and Games Development.
Text. Graphics Images – photos Animation Video Audio Text Copyright issues.
2D Physics and Camera Systems For CSE 3902 By: Matt Boggus.
PacMan by Midway, released 1980 CSE 380 – Computer Game Programming Real-Time Game Architecture.
CSE 380 – Computer Game Programming AI & Collision Strategy Erin Catto’s Box2D.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
Creative Commons Attribution 3.0 creativecommons.org/licenses/by/3.0 Key Abstractions in Game Maker Foundations of Interactive Game Design Prof. Jim Whitehead.
VIDEO GAME PROGRAMMING Video Game Programming Snowball Wars INSTRUCTOR TEACHER’S ASSISTANT.
CS 101: Arrays Abhiram Ranade. Computers manipulate many objects Given the position, masses, and velocities of all stars, where will they be after the.
Tennis for Two, 1958, by William Higinbotham, Brookhaven National Lab CSE 380 – Computer Game Programming Graphics Device Management.
VIDEO GAME PROGRAMMING Video Game Programming Level One – Breakout INSTRUCTOR Big Dan Teague TEACHER’S ASSISTANT Delmar O'Donnell.
9.3. P ARTICLE S YSTEMS Development of a particle system.
User Input and Collisions COSC 315 Fall 2014 Bridget M. Blodgett.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
CSE 380 – Computer Game Programming Artificial Intelligence Murloc, Blizzard Entertainment.
Institute for Personal Robots in Education (IPRE)‏ CSC 170 Computing: Science and Creativity.
 The creation of moving pictures one frame at a time Literally 'to bring to life' e.g. make a sequence of drawings on paper, in which a character's position.
11 Adding Tomato Targets Session Session Overview  We now have a game which lets a player bounce a piece of cheese on a bread bat  Now we have.
CS 4730 Game Architecture CS 4730 – Computer Game Design Credit: Some slide material courtesy Walker White (Cornell)
Sprites, User Input, and Collision COSC 315 Fall 2014 Bridget M. Blodgett.
Reference: The Game Loop Animation / Game loop 1. Update variables 2. [Get input from the user] (GameLoop only) 3. Draw (using variables)
Guide to Programming with Python Chapter Twelve Sound, Animation, and Program Development: The Astrocrash Game.
CIS 3.5 Lecture 2.2 More programming with "Processing"
1 Frisbee Physics Simulation Charles George Advisor: Brian Postow 03/05/05.
CSE 380 – Computer Game Programming Player Controls & Scrolling Mega Man, by Capcom, released 1988.
CSE 380 – Computer Game Programming Tile Based Graphics & Scrolling Legend of Zelda, by Nintendo, released 1987.
Final 5 Question Slide Show Edited By- Crystal David.
XNA Basic Displaying Image & Collision Detect. What’s format image that XNA support? XNA support only.bmp.png and.jpg image..PNG have transparent region.
Game Maker Galactic Mail Advanced Group: Complete Galactic Mail, then start developing an independent project.
CSE 380 – Advanced Game Programming Sweep & Prune.
Lesson 3: Arrays and Loops. Arrays Arrays are like collections of variables Picture mailboxes all lined up in a row, or storage holes in a shelf – You.
T HE G AME L OOP. A simple model How simply could we model a computer game? By separating the game in two parts: – the data inside the computer, and –
Opening Title Fire'nIce Team Member: Zhang Yujie Wang Huan Xiao Fei Cheng Peng Tutor: Alexandre Devert SSE USTC Team Leader: Wei Qiang.
Overview  Basic requirements of implementation  Image resource  Texture mapping  Advanced requirements of implementation  KGL sprite class.
Graphics for Games Particle Systems CO2301 Games Development 1 Week 23.
XNA ● Proprietary Microsoft framework ● C#. Interface.
Fall UI Design and Implementation1 Lecture 13: Animation.
XNA Tutorial 1 For CS134 Lecture. Overview Some of the hard work has already been done for you. If you build and run your game now, the GraphicsDeviceManager.
Computer Science I Animations. Bouncing ball. The if statement. Classwork/homework: bouncing something. Compress and upload work to Moodle.
The Stingray Example Program CMT3311. Stingray - an example 2D game May be useful as a simple case study Most 2D games need to solve generic problems.
Reference: What is it? A multimedia python library – Window Management – Graphics geometric shapes bitmaps (sprites) – Input Mouse Keyboard.
MORE Genre Specific Physics
2D Physics and Camera Systems
Where are we ? Setup Sprites Input Collision Drawing Sprites
Week 2 - Monday CS361.
Background Shapes & Collision Resolution (Top-down and Side-scrolling)
Game Loops + Part II Reference:
Frame Update, Level Representation & Graphics
Game and animation control flow
2.02C Frame-by-Frame Computer Animation Using PowerPoint
Tutorial on using Java Sprite Animation
Game Loop Update & Draw.
Week 6: Time and triggers!
Transparency & magic pixel
Development of a particle system
Game Programming Algorithms and Techniques
Unity Game Development
Animation Translation.
Presentation transcript:

CSE 380 – Computer Game Programming Sprite Animation Space Quest, by Sierra, released 1986

Sprites We’ve used LPD3DXSPRITE to draw tiles. Why? it has easy to use methods for drawing automatic clipping What is a sprite really? a series of 2D images that makeup an animated character

What can sprites be used for? Main character Enemies Any living thing Projectiles (rockets, bullets, arrows, rocks, etc.) Vehicles And more

Works just like traditional cartoon animation Animation must be: Animating Sprites As a sprite moves, we must display it using different “frames of animation” this means slightly different images Works just like traditional cartoon animation Animation must be: tied to timer tied to movement (for main character)

Sprite Data Suppose we wanted to draw an animated Mario, what data might we need? position z-order (huh?) velocity Texture(s) array of Textures if using individual images each index represents a frame of animation possible states of sprite current state of sprite (standing, running, jumping, dying, etc.) animation sequences for different states. Huh? current frame being displayed (an index) animation speed

Animation Sequence Example 1 2 3 4 5 Condor Frames indices 0-5 Condor Living [0,1,0,2] Condor Dying [3,4,5] Easy way of doing this: 2D data structure state X frame sequences

Defining your own sprite class We only want to use Direct3D’s Sprite class for drawing No class exists to store all the data we want So, define your own AnimatedSprite Draw using Direct3D Sprite

How do we advance animation frames? Sprites should also have an animation speed Every game loop iteration, for each visible animated sprite: Is the sprite currently in an animated state? If yes, has enough time has passed since last frame advance? (use animation speed to judge) If yes, advance frame according to current animation in use

How do we change sprite states? Each game loop iteration: get user input Does user input change sprite state? If no, change sprite values per current state e.g., change location using velocity & direction If yes, change sprite state and reset animation in use Change states of all sprites as well based on AI Then we would perform collision detection and any necessary corrections (next time)

What do we do with dead sprites? most likely remove them from memory perhaps have a newly dead state keep the corpse around a little while visible dead sprites use resources most games, new and old, have vanishing dead guys Legend of Zelda to Call of Duty: Big Red One

Sprite states and movement Sprites movement may be tied to state E.g., in game loop, how should one: update the position of a bullet add velocity to position in constant direction update the position of a walking Mario add velocity to position in current direction update the position of a jumping Mario change direction & velocity add new velocity to position in new direction

The Big Picture in UML GameStateManager SpriteManager 1 1 * SpriteManager AnimatedSpriteType 1 1 1 * Bot 1 1 AnimatedSprite CollidableObject PhysicalProperties 1 * BoundingVolume

SpriteManager class SpriteManager { private: vector<AnimatedSpriteType*> *spriteTypes; list<Bot*> *bots; AnimatedSprite player; BotRecycler recyclableBots;

AnimatedSprite class AnimatedSprite : public CollidableObject { private: AnimatedSpriteType *spriteType; int alpha; wstring currentState; unsigned int frameIndex; unsigned int animationCounter;

AnimatedSpriteType class AnimatedSpriteType { private: int spriteTypeID; map<wstring, vector<unsigned int>*> animationSequences; int textureHeight, textureWidth;

CollidableObject class CollidableObject { protected: bool currentlyCollidable; BoundingVolume bv; PhysicalProperties pp;

PhysicalProperties class PhysicalProperties { protected: float buoyancy; float mass; bool collidable; float coefficientOfRestitution; float x; float y; float z; float velocityX; float velocityY; float accelerationX; float accelerationY;

Next Lectures Physics Review Collision Detection Collision Responses