How to Make a Game Like Space Invaders. What IS Space Invaders? a SHMUP (shoot-em-up) Player has one ship, enemy has many Player and enemies interact.

Slides:



Advertisements
Similar presentations
Introduction Games have always been a fundamental part of human life. Space storm “ عاصفة الفضاء” is a 3D SCI-FI game that consists of two stages presented.
Advertisements

Game Programming Patterns Game Loop
IS660Z Programming Games Using Visual Basic Overview of Cannonball.
This terms course Last term we both worked on learning 2 things –Processing –The concepts of graphics etc. This term will focus more on the basic concepts.
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
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.
Asteroids Games and Simulations O-O Programming in Java The Walker School The Walker School – Games and Simulations
Greenfoot Asteroids Mrs. C. Furman August 16, 2010.
Aim: Use the given examples to record examples and our own ideas in our journal 1.Write technical examples in journal and/or participate in full.
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.
RED DEAD REVOLVER Artificial Intelligence Critique By Mitchell C. Dodes CIS 588.
Virtual Sub-Terrania Kristopher M. Lee. Overview What is Sub-Terrania? What is Sub-Terrania? Virtual Sub-Terrania Virtual Sub-Terrania Plot Plot Objectives.
Joseph Dowden Philip Ho James Gedarovich INDORA. Missiles: Bullets:
CIS Game Design I Chapter 6 and 7 Blake Farrugia 10/24/2011.
MASHOOQ,RAHUL,SANAT AND YIBIN, SAVING MANKIND SINCE SPRING 2011.
Interactive Media and Game Development Project. Game Idea Suggestions Goal: build complete, mini-game –Constrain idea by resources (time) Think small.
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
INTRODUCTION TO SCRATCH. About Me Resources Scratch Website Learn Scratch Washington-Lee Computer.
Main points  Where it started  What is it  Computer animation  Java applets  Flash  Animation process  Optical illusion in motion  Claymation.
Guide to Programming with Python
Lua & Love2D Game Engine GALAGUH
SOURCE 2006 Presentation by Luke Arntson Game Programming Optimization.
MrsBillinghurst. net A2 Computing A2 Computing Projects Game Animation in Pascal.
Collision and Animation Systems in Games Jani Kajala Lead Programmer / Chief Technology Officer, Pixelgene Ltd (0)
Canyon Adventure Technology David Maung, Tristan Reichardt, Dan Bibyk, Juan Roman Department of Computer Science and Engineering The Ohio State University.
How to make Space Invaders
VIDEO GAME PROGRAMMING Video Game Programming Junior – DigiPutt INSTRUCTOR TEACHER’S ASSISTANT.
Game 1: Mr. Happy’s Quest For our original canvas, we had designed a child’s background using simple shapes. For this project, we will add objects that.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 8 "The games of a people reveal.
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.
Application in Computer Vision Final Project Nir Slakman, Oren Zur and Noam Ben-Ari.
CS 4730 Action vs. Interaction CS 4730 – Computer Game Design Credit: Several slides from Walker White (Cornell)
KeyListener and Keyboard Events Another type of listener listens for keyboard entry – the KeyListener which generates KeyEvents –to implement KeyListener,
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 8 "The games of a.
Math / Physics 101 GAM 376 Robin Burke Fall 2006.
Practical Test 2 (2012) Add Light and Camera. Objective Able to add wall and FXfloor Able to add FX light Able to turn off ambient light Able to turn.
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.
Graphics Matrices. Today’s Lecture Brought to you by the integer 6 and letter ‘K’; 2D and 3D points Matrices Rotations Translation Putting it all together.
Game Maker Terminology
Shooters in GameMaker J Parker.
Dead Run James Kelly, Mike Papo, Josh Lovatt. Basic Details Single Player Top Down Action game.
Team 2: Gamers & Coders Final Sprint Presentation.
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
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Action Script 12 "The games of a people.
Marble Racer. The screen where you can see what happens when you play your game is called the STAGE. The SCRIPT BANK is where the types of instructions.
Welcome to... A Game of X’s and O’s. Another Presentation © All rights Reserved
Reflex Math overview and use
Warship C++: An entity of Battleship
Motion Graphics Tony Johnson - Eccleston. Music Video In this video i am talking about all the motion graphic.
Computer Science I Animations. Bouncing ball. The if statement. Classwork/homework: bouncing something. Compress and upload work to Moodle.
Stencyl Visual Programming Dr. Gary Liu. Sections: 1: Game Development Concepts 2: Stencyl and Game Mechanics 3: Stencyl Story and Aesthetics 4: stencyl.
Trigonometry and Applications References: xyz. Review (?) from ETGG1801 Angles – As a measure of rotation and/or orientation – Radians & Degrees (and.
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.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Over the recent years, computer vision has started to play a significant role in the Human Computer Interaction (HCI). With efficient object tracking.
MORE Genre Specific Physics
Collision Theory and Logic
Motion Test Review Game
Collision Theory and Logic
Background Shapes & Collision Resolution (Top-down and Side-scrolling)
CS 134 More Graphics.
Space Invaders inspired game
Peak Of Performance.
Week 6: Time and triggers!
Transparency & magic pixel
Nate Brunelle Today: Games
Presentation transcript:

How to Make a Game Like Space Invaders

What IS Space Invaders? a SHMUP (shoot-em-up) Player has one ship, enemy has many Player and enemies interact by shooting at each other Top-down 2D (usually)

Concepts

Video Frames/Ticks A film is made of 24 still pictures per second Motion is achieved by small changes to each picture, but 24 fps is still fast

Video Frames/Ticks 2 Video games are usually 30 or fps Video games achieve movement by moving each screen object a little bit every frame

Shmups are very object- oriented Ships are objects Bullets are objects The player is an object Explosions are objects Levels can be objects (certainly made of objects)

Question How many bullets can be on the screen at once? Space Invaders = 1 for player, 2 for enemies Modern = completely arbitrary

Lists A great way to store and organize objects Most beginners get hung up here Conceptually harder than arrays C and C++ use linked lists (with pointers) BlitzBasic has list:TList

What is a ship? Is-dead flag Health value X and Y positions Path logic and data Reference to the art Animation state Bullet/missile launch state Bullets and Explosions are very similar to ships!

What is a player ship? Not as much, surprisingly Path logic is in your fingers, not in code So keyboard state checks (for avatar control) go here

What is a bullet/missile? Like a ship, but (usually) simpler movement Erased when it goes off screen, not when it reaches the end of its path State: Player shot or Enemy shot Each Player-bullet collides against every enemy Each Enemy-bullet collides against player

So, to make space invaders… Make a player Make a bunch of enemies Move them every frame, have them create bullets Move the bullets every frame Check for enemy-bullet collision every frame Keep going, even if all the enemies or the player is dead

Programming

Main loop in Pseudocode Main() { SetupEverything(); CreatePlayer(); CreateAllEnemies(); done = false; while (done == false) { TickPlayer(); TickEnemyList(); TickBulletList(); DrawPlayer(); DrawEnemyList(); DrawBulletList(); if (EscapeKeyPressed() == TRUE) done = TRUE; WaitForNextFrame(); } ShutDownEverything(); }

Timer callback version TimerFunction() { TickPlayer(); TickEnemyList(); TickBulletList(); // some systems, like Flash and Torque, do the drawing for you DrawPlayer(); DrawEnemyList(); DrawBulletList(); if (EscapeKeyPressed() == TRUE) done = TRUE; }

TickBulletList() { ForEach( bullet) { x = x + dx; y = y + dy; if (BulletOffScreen()) { isDead = TRUE; } ForEach(enemy) { if (Collides(enemy, bullet)) { isDead = TRUE; DamageEnemy(enemy); } RemoveDeadBulletsFromList(); }

Basic Math

Vectors and Offsets Where is your Ship? X and Y

Vectors and Offsets 2 Where is your bullet? Also X and Y Where is your bullet in relation to your ship? bulletX – shipX and bulletY – shipY

Vectors and Offsets 3 How far apart are they? Pythagorean theorem (sqr(a) + sqr(b) = sqr(c)) This requires a slow square root function

Vectors and Offsets2 What direction from the ship to the bullet? Arctangent Atan2(bulletX – shipX, bulletY – shipY)

Arctangent Usually gives a direction in radians, from 0- (2*PI) PI is (= 180 degrees) Radian to degrees = dir / (PI*2) * 360

Vectors and Offsets3 So you can describe the relationship between two objects on the screen in two different ways

Offsets Offset = x and y coordinates (or differences)

Vectors Vector = direction and distance

Translate Offsets to Vectors Get distance with Pythagoras Get direction with Atan2 (Arctangent)

Translate Vectors to Offsets X = sin(direction) * distance Y = cos(direction) * distance

Vectors & Offsets = important Shooting bullet directly at the player Homing missiles Collision detection (is bullet close enough?) Enemy follows path

What is TurnTowardsPoint() If you want the homing missile to turn slowly towards the enemy (instead of instantly) what do you do? The answer is the TurnTowardPoint() algorithm.

Designing Your Game

Bosses Traditional part of shmups Each one is a love letter to the player Multiple weapons Multiple parts Multiple Modes Its a boss, not just an extended enemy

Powerups Functionally just like Bullets Give expanded powers to the player Key to one of the basic metagames

The Game Modes Play mode Start mode Results mode (you are dead, howd you do) Pause mode Credits mode Options mode

Game Modes 2 Recognize that game modes are just states Completely different states than game states

Scrolling Background Space Invaders background was black Galaga and others had winking, scrolling stars Zaxxon and others started making the background complex and interactive Treasure games are famous for complex, puzzle-like environments

What are Shmup levels? Hand-crafted definitions of when each enemy shows up The things that happen before a boss shows up Divisions of art Scoring opportunities

How are levels made? Make the editors yourself, for yourself Ship path editor (mirror-able) Level editor Place art tiles Place ship spawn points Place camera path Boss editor