Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.

Slides:



Advertisements
Similar presentations
GAME:IT Junior Learning Game Maker: The Control Tab.
Advertisements

Understanding an Apps Architecture ASFA Computer Science: Principles Fall 2013.
Threads, Surface Views and Real-Time Games. Background Most of the Android apps we’ve covered so far have been single threaded – And Event driven – An.
COMPUTER PROGRAMMING I Essential Standard 5.02 Understand Breakpoint, Watch Window, and Try And Catch to Find Errors.
Introduction to Computing Science and Programming I
Asteroids Games and Simulations O-O Programming in Java The Walker School The Walker School – Games and Simulations
Code Club Session 3 Shark Eats Fish. Picture of finished product here.
Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.
Lecture19 Java Game Programming II – Example Continued.
Game Design and Programming. Objectives Classify the games How games are design How games are implemented What are the main components of a game engine.
How to Debug VB .NET Code.
Cosc 4755 Phone programming: GUI Concepts & Threads.
Wizard Game: Class-Level Variables in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July
SE320: Introduction to Computer Games Week 8: Game Programming Gazihan Alankus.
Mr. Wortzman. Tabs (Block Categories) Available Blocks Script Area Sprite Stage All sprites in this project.
GameMaker.  A lot of Different Definitions  Easier to Say What is NOT a Game  Movie is Not a Game  No Active Participation  Final Outcome is Fixed.
Game Design Creating a game called PING Phase 3: Steps for building basic game.
MrsBillinghurst. net A2 Computing A2 Computing Projects Game Animation in Pascal.
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
Introduction to TouchDevelop
6-2 2D Graphics CSNB544 Mobile Application Development Thanks to Utexas Austin.
VIDEO GAME PROGRAMMING Video Game Programming Junior – DigiPutt INSTRUCTOR TEACHER’S ASSISTANT.
Iteration. Adding CDs to Vic Stack In many of the programs you write, you would like to have a CD on the stack before the program runs. To do this, you.
Introduction to Arrays. definitions and things to consider… This presentation is designed to give a simple demonstration of array and object visualizations.
Visual Basic .NET BASICS
KeyListener and Keyboard Events Just as we can implement listeners to handle mouse events, we can do the same for keyboard events (keypresses) –to implement.
Art 315 Lecture 5 Dr. J. Parker AB 606. Last time … We wrote our first program. We used a tool called GameMaker. The program we wrote causes a ball to.
KeyListener and Keyboard Events Another type of listener listens for keyboard entry – the KeyListener which generates KeyEvents –to implement KeyListener,
User Input and Collisions COSC 315 Fall 2014 Bridget M. Blodgett.
VB Games: Preparing for Memory Brainstorm controls & events Parallel structures (again), Visibility, LoadPicture, User-defined procedures, Do While/Loop,busy.
By Melissa Dalis Professor Susan Rodger Duke University June 2011 Multiplication Table.
Sample Video Game & Sound. The Plan 1.Game Theme 2.Game Structure 3.Sprites 4.Trackers 5.Collisions 6.Score 7.Levels 8.Splash Screens 9.Design 10.Implementation.
Cosc 4730 Android Fragments. Fragments You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own.
Microsoft® Small Basic Collision Detection Estimated time to complete this lesson: 1 hour.
Looping and Counting Lecture 3 Hartmut Kaiser
Piñata Game: Keeping Score in Alice By Maggie Bashford Professor Susan Rodger Duke University July
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 9 "The games of a.
Game Maker – Getting Started What is Game Maker?.
2.3. A RCHITECTURAL D ESIGN I Example approach for game screen management.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 9 "The games of a people reveal.
Graphics Concepts CS 2302, Fall /17/20142 Drawing in Android.
Game Maker Galactic Mail Advanced Group: Complete Galactic Mail, then start developing an independent project.
Advanced Stuff Learning by example: Responding to the mouse.
Conditional Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
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.
Game Programming Patterns Game Loop From the book by Robert Nystrom
Intro CS – Screens and Variables Lesson Plan 9. Goals  Using sprites as full screens (Start screen, Game over)  Using layering to control ordering of.
Lesson 2: Reading a program. Remember: from yesterday We learned about… Precise language is needed to program Actors and Classes Methods – step by step.
Random Numbers Random numbers are extremely useful: especially for games, and also for calculating experimental probabilities. Formula for generating random.
5 Event Handling Interactive Programming Suggested Reading Interaction: Events and Event Handling, Supplemental Text for CPSC 203 Distributed this term.
Galactic Mail Part 2. Winning and Losing Exploding Asteroids Including Scoring Adding Levels And more.
Checkers A Matlab Project by Spenser Davison, Edward Dyakiw, Justin Pezzi, and Scott Wu.
LO: We’re learning to outline a program using Pseudo Code.
CS320n –Visual Programming Execution Control with If / Else and Boolean Functions (Slides 6-2-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
11. Skier Let’s Learn Saengthong School, June – August 2016 Teacher: Aj. Andrew Davison, CoE, PSU Hat Yai Campus
Objective of the lesson Use Blockly to make a dice for Snakes and Ladders All of you will: – Make an image which displays when you press a button Most.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
School of Computer Science Space School 2015 Programming a Lunar Lander Game.
Android Application 2D Graphics cs.
Intro CS – Screens and Variables
PYGAME.
WITH PYGAME ON THE RASPBERRY PI
Android Layouts 24 July 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS 1.
Project Snake. Project Snake Snake For this project, we’re going to make Snake This includes Making the overall game logic (using a 2D array) Handling.
Introduction to TouchDevelop
Game Loop Update & Draw.
Week 6: Time and triggers!
Creating a Simple Game in Scratch
Presentation transcript:

Cosc 5/4730 Game Design

A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated – User interaction may change “objects” Depends on game state (is user playing, demo mode, etc). – Code then draws/paints/repaints the game screen – Code loop sleeps for a short period of time, which controls the game rate.

Basic Game layout Assuming a game where app does something based on a user’s “move” (like Tic-Tac-Toe) 0. Initial setup of the game, variables etc. Display splash screen if needed. 1.Now wait for user input Easily done with input listeners 2. Based on user input Determine if valid move Change game state, move stuff around Determine if end of game state(winner, loser, tie) If end of game – Call end of game code (reset for next game or exit app) Else – Update screen and return to 1.

Basic Game layout (2) Where the app is more of an arcade, like space invaders or pong – Initial setup of the game, variables etc. Display splash screen if needed. – Initialize the animation thread – Start the animation thread Like in the android SurfaceView

Basic Game layout (3) Animation thread does all the work now, but the main code is not stop. – For 2+ player over the “network” games another thread is listening for the other players moves as well. While(game_running) { – Verify game state, “move” objects, etc This also where end of game is determine and game_running will be set to false. – Check for user input (maybe listeners or manually) They may not be any, but the game continues. – Update screen – Sleep for a period of time to control the game refresh rate } End of game code for play again or exit app.

Example Game The example for the rest of the lecture will be a simple space invaders game. – Your ship at the bottom can move left and right – You can have at most 3 shots on the “board” at any given time – There will be at most 5 aliens on the screen at any time. If no aliens, then 1 is generated. The game ends if an aliens lands.

A Note on touch Where to touch In games, you almost never want people to touch the objects – Their hand/finger will now cover the screen – Makes it difficult to see Whenever possible find a way to have an offset location that won’t cause the screen to be covered by the touch event. – There should also be some audible/visual way to see they are touching the correct spot as well.

A Note on touch (2) Where to touch Another way would be to have the user touch where the wanted to ship to move too

Android Game Using the surfaceView Screen size issues with the surfaceView Simulator issues – The game runs very slow in the simulator – But at the “correct” speed on device.

SurfaceView myThread Used to control the speed of the game. In the SurfaceView code in previous lecture: – Add checkGameState() Moves ship, aliens, checks for collisions, etc… Input handled by overriding listeners – onKeyDown and onTouchEvent We use the sleep to control the game speed.

Overriding OnDraw we override the method that draws the game. – onDraw(Canvas c) – Since the surfaceView fills the whole screen: We have to draw the background and score – Draws the objects (ship, aliens, shots) on the screen Use the canvas draw methods to draw the text and all the images – If gameover, also draws “GAME OVER” on the screen.

checkGameState Move the ship (based on User input) – make sure ship doesn’t go out of “bounds” add new shots (based on User input) – remove shot if reaches top of the screen. Move any aliens (not out of bounds either) – Add a new alien to the screen if are no aliens – add new aliens up to 5 (added on random number of 97 out of 100) Move shots Check for collisions – remove alien and shot if they collide – add to score.

checkGameState (2) If while moving an alien, it reaches the bottom – set gameover variable to true. – This will be the last time checkGameState is called. – As note, the user uses the menu to exit the game, so game over will display.

Menu Menu code is not written in the surfaceView code. – In the Activity code. Only exits the game – If we wanted the menu to interact with the game, we’ll need to change the way the surfaceView is declared in the activity.

Look at the gameAnd code

For lastly. Of course, while this is a “complete” game – The aliens should be able to shot at the ship. – The aliens tend to collide with each other. And randomly head down the screen. – Nothing happens when an alien collides with a ship either! Should also have lives. Add a loop to check and see if an alien collided with the ship and a variable for lives. – The android and storm code does not use the accelerometer, instead only uses touch.

Useful References So useful information: – Math & Physics oryid=28 oryid=28 – Essential Math for Games Programmers – 2D Game Physics 101

Q A &