Build your own 2D Game Engine and Create Great Web Games using HTML5, JavaScript, and WebGL. Sung, Pavleas, Arnez, and Pace, 2015. Chapter 5 Examples 3.

Slides:



Advertisements
Similar presentations
RAPTOR Syntax and Semantics By Lt Col Schorsch
Advertisements

Information Representation
1 Drawing C Sc 335 Object-Oriented Programming and Design Rick Mercer.
More Java Drawing in 2D Animations with Timer. Drawing Review A simple two-dimensional coordinate system exists for each graphics context or drawing surface.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
The Web Warrior Guide to Web Design Technologies
Morphing and Animation GPU Graphics Gary J. Katz University of Pennsylvania CIS 665 Adapted from articles taken from ShaderX 3, 4 and 5 And GPU Gems 1.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Chapter 12: Making the Applications Interesting.
IMGD 1001: The Game Art Pipeline. IMGD (Visual) Art Courses  AR Essentials of Art.  AR Digital Imaging and Computer Art.  IMGD/AR.
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.
Week 1 - Friday.  What did we talk about last time?  C#  SharpDX.
1. 2  A computer is a device capable of storing data  in a format suited to the computer,  which is then processed by mathematical manipulation and.
Chapter 4 Dreamweaver: Part II The Web Warrior Guide to Web Design Technologies.
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
CS 480/680 Computer Graphics Course Overview Dr. Frederick C Harris, Jr. Fall 2012.
Java Programming, 3e Concepts and Techniques Chapter 2 - Part 2 Creating a Java Application and Applet.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 8 This presentation © 2004, MacAvon Media Productions Animation.
Computer Graphics Texture Mapping
Chapter 1 What is Programming? Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
COP 4331 – OOD&P Lecture 6. Review Midterm Review Complete sample application –See SwingColorTest.java.
JavaScript Professor Robin Burke. 2 Outline Quiz Tables JavaScript.
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.
Department of Information Technology Chapter 9 – Creating Tables Lecturer: Ms Melinda Chung.
QML Qt Quick with QML and you can use JavaScript for engine along C++ Started to be released since late 2009 (Qt 4.7) Nokia focused on that for the Symbian/Meego.
1 Introduction to Computer Graphics SEN Introduction to OpenGL Graphics Applications.
 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.
3D Graphics for Game Programming Chapter IV Fragment Processing and Output Merging.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
11 Making a Sprite Session 4.2. Session Overview  Describe the principle of a game sprite, and see how to create a sprite in an XNA game  Learn more.
Games Development Game Architecture: Entities CO2301 Games Development 1 Week 22.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
1 GUIs, Layout, Drawing Rick Mercer. 2 Event-Driven Programming with Graphical user Interfaces  Most applications have graphical user interfaces (GUIs)
Texture Mapping CAP4730: Computational Structures in Computer Graphics.
Applets, Images, and Audio Chapter 14 CSCI CSCI 1302 – Applets, Images, and Audio2 Outline Introduction The Applet Class –The init Method –The start.
Creating a Java Application and Applet
Computer Graphics Matrices
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
1 CSC 221: Computer Programming I Fall 2009 Introduction to programming in Scratch  animation sprites  motion, control & sensing  costume changes 
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
By: Eliav Menachi.  Android custom 2D graphics library  OpenGL ES 1.0 for high performance 3D graphics.
Build your own 2D Game Engine and Create Great Web Games using HTML5, JavaScript, and WebGL. Sung, Pavleas, Arnez, and Pace, Chapter 6 Examples 1,
Build your own 2D Game Engine and Create Great Web Games using HTML5, JavaScript, and WebGL. Sung, Pavleas, Arnez, and Pace, Chapter 7 Manipulating.
Build your own 2D Game Engine and Create Great Web Games using HTML5, JavaScript, and WebGL. Sung, Pavleas, Arnez, and Pace, Chapter 5 Examples 1.
Build your own 2D Game Engine and Create Great Web Games using HTML5, JavaScript, and WebGL. Sung, Pavleas, Arnez, and Pace, Chapter 4 Implementing.
Build your own 2D Game Engine and Create Great Web Games using HTML5, JavaScript, and WebGL. Sung, Pavleas, Arnez, and Pace, Chapter 7 Examples 3.
Reference: What is it? A multimedia python library – Window Management – Graphics geometric shapes bitmaps (sprites) – Input Mouse Keyboard.
CSI 32 Lecture 20 Chapter 8 Input, Output, and Files 8.1 Standard Input and Output (review) 8.2 Formatted Strings 8.3 Working with Files 8.5 Case Studies.
Build your own 2D Game Engine and Create Great Web Games using HTML5, JavaScript, and WebGL. Sung, Pavleas, Arnez, and Pace, Chapter 8 Illumination.
Chapter 1 Introduction.
Object Oriented programming
Implementing Common Components of Video Games
Textures, Sprites, and Fonts
Textures, Sprites, and Fonts
Week 2 - Monday CS361.
Lecture 8: Graphics By: Eliav Menachi.
The Basics: HTML5, Drawing, and Source Code Organization
Chapter 3 Drawing In the World.
Counted Loops.
Design considerations
Graph Paper Programming
Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
Display Lists & Text Glenn G. Chappell
Lecture 8: Graphics By: Eliav Menachi.
ATEC Procedural Animation
03 | Creating, Texturing and Moving Objects
Game Programming Algorithms and Techniques
CSC 221: Introduction to Programming Fall 2018
Chapter 1 Introduction.
Animation Translation.
Presentation transcript:

Build your own 2D Game Engine and Create Great Web Games using HTML5, JavaScript, and WebGL. Sung, Pavleas, Arnez, and Pace, Chapter 5 Examples 3 and 4 Sprite Animations, and Fonts

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, Sprite Animations Strategically drawn Sprite Sheets Sequence through elements strategically Similar to stop-frame animations Explicit communications with creating artists are required to decode

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, Organization Conventions Not “laws,” something people seem to follow Rows x Columns: Fixed size on a sheet m-pixels by n-pixels Paddings around each elements Single row (or part of a row) defines action Almost never cross rows

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, Parameters of Sprite Animation Direction: Forward (Left towards right) Backward (Right towards left) Swing Speed: rate at which to change

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, : Sprite Animation Project

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, : Goals gain understanding of animated sprite sheets experience the creation of sprite animations define abstractions for implementing sprite animations

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, Implementation consideration New shader? NO!! Access/update SpriteShader’s mTexCoordBuffer Change per animation update!

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, SpriteAnimateRenderable: Define animation type/speed Support defining and moving of sprite elements UV-area

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, SpriteAnimateRenderable: constructor

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, SpriteAnimateRenderable: constructor Using SpriteShader!! no need for anything new from the shader!

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, SpriteAnimateRenderable: constructor

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, SpriteAnimateRenderable: constructor UV-area for first sprite element AND Padding information (so that it is possible to advance) Number of sprite elements in the animation

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, SpriteAnimateRenderable: constructor

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, SpriteAnimateRenderable: constructor Animation characteristics Type: Left-ward, Right-ward, or Swing How fast is the animation (unit in “update()” calls! Or 1/60 second)

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, SpriteAnimateRenderable: constructor

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, SpriteAnimateRenderable: constructor Animation-time state variables

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, SpriteAnimateRenderable: utilities

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, Defines a sequence In pixel space Notice, must convert to UV SpriteAnimateRenderable: utilities

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, Update reference Re-computes UV Sends new UV SpriteAnimateRenderable: animate!

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, Testing Sprite Animation To create

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, Testing Sprite Animation To change and update (in MyGame.js::update()) NOTE: must call obj.updateAnimation() to see animation!

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, Fonts Can be important in games Especially for debug output Pain to support Hack: Bitmap fonts Image + Instruction (to decode)

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, : Font Support

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, : Goal Drawing text is not as interesting as the problem at hand Designing a text solution based on what we have Given a “string”: find UV for first character from the bitmap font image Set the sprite element UV values of a SpriteRenderable draw the SpriteRenderable: one character Compute space to skip Repeat for next character Abstract the above: FontRenderable

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, Procedure of working with fonts Similar to _ALL_ external resources Load: DefaultResources: default system font Per game scene font (if you have any) Create a Renderable to draw with it Slightly different …

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, FontRenderable: NOT a subclass or Renderable Instead: has an instance of SpriteRenderable: mOneChar mText: is the string we want to draw Note: FontRenderable: has a transform (this.mXform) mOneChar: has a separate transform!!

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, FontRenderable::draw()

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, FontRenderable::draw() xPos: x Position of the first character yPos: y position of _all_ of the characters Limitation!: Cannot span more than one line!

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, FontRenderable::draw()

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, FontRenderable::draw() For each character Compute the xform of the character (mOneChar.xForm) Draw the character Limitation: String is not an entity (e.g., cannot rotate the string)!

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, Font rotation In FontRenderable.draw() Must pass rotation from FontRenderable.mXform to mOneChar.mXform

Ch 5: Textures, Sprites, and FontsBuild your own 2D Game Engine. Sung, Pavleas, Arnez, and Pace, Chapter 5: learned? Use resource manager Texture mapping UV Coordinate System Sprite elements in a Texture Drawing with sprites Sprite Sheet for animation Sprite Animation Bitmap font Next: Simple behavior (collision)!