Scratch - Sulley

minedesertΛογισμικό & κατασκευή λογ/κού

31 Οκτ 2013 (πριν από 4 χρόνια και 8 μήνες)

250 εμφανίσεις

Game Production

Lecture 1

Welcome and Introduction, Review of Syllabus,

Introduction to Scratch

2011
-

Dr. McDaniel

Agenda


Review of Syllabus



Overview of Course



Overview of Game Groups



Major Assignments



Introduction to Game Production



Prototyping with Scratch

2011
-

Dr. McDaniel

Review of Syllabus


The syllabus is available via our class web site:
http://www.dm.ucf.edu/~rmcdaniel/courses/dig4715c/spring2011



Please print out a copy for your records.



“M” model course


Webcourses

link:
https://
webcourses.ucf.edu/webct/logon/8804002625091
.



Check the sites frequently for notes, assignments, and changes to
the class schedule.



I will use your official registered
MyUCF

email address and the class
listserv to communicate with you about the course.

2011
-

Dr. McDaniel

Grade Breakdown


Final Project is a huge part of your overall grade (60%):


Milestone 1: 20% (rough build 1 w/ prototype & playtesting)


Milestone 2: 20% (rough build 2 w/ prototype & playtesting)


Final Game: 20% (final polished build)



You will also build a smaller individual game using Scratch or a
similar technology (e.g., Flash). Your individual game must be
programmed (i.e., level design or mod is not okay). This is
worth an additional 20%.



Your final 20% will come from class and online participation.
Make sure you do the online work each week!




2011
-

Dr. McDaniel

Anonymous Feedback Tool

INTRODUCTION TO GAME
PRODUCTION

Programming, Art, and Technical Direction

2011
-

Dr. McDaniel

What is Game Production?

2011
-

Dr. McDaniel

Why Game Production is Hard



We have to get inside
the minds of our
players!



Not only that, but we
have to anticipate their
every move and
program interactions for
each of them!

Image credit:
http
://fuffer.wordpress.com/2008/10/08/dog
-
video
-
game
/


2011
-

Dr. McDaniel

This Class


The bulk of what you learn in this class will be game scripting
and production. However, you will also learn how to
integrate art assets and work as a team.



We’ll use
Scratch

and
Unity3d
for this, but these are just
tools. The techniques you’ll learn will generalize to most any
other high
-
level language you want to build games in.



Unity3d

is a good choice because it is cross
-
platform, easy to
deploy on the web, has flexible options for scripting, and is
well
-
supported.

2011
-

Dr. McDaniel

What do Producers Do?

Typical “producing
” responsibilities:

http
://
en.wikipedia.org/wiki/Video_game_producer


Core Issues:


Gameplay

mechanics


Inventory


Profile


HUD


Combat


Movement


Artwork


Scoring


AI


Environment


Physics


World


Art


Collision detection


Particle effects


Story


Protagonist


Antagonist


Plot


2011
-

Dr. McDaniel

It’s All about the
Detail
!

2011
-

Dr. McDaniel

Interactions!


Here is the fundamental challenge of
becoming a game developer:



The folks funding your game want it to be as
profitable (read: cheap) as possible.



The folks playing your game want it to be as
nonlinear, dynamic, complex, and fun as
possible.

2011
-

Dr. McDaniel

AN Old Engineering Maxim

INTRODUCTION TO SCRATCH

2011
-

Dr. McDaniel

Scratch


Developed by the MIT Lifelong Kindergarten Group



Available at
http://scratch.mit.edu

(Mac, Windows, Ubuntu)



The current version as of 6 Dec 2010 is Scratch 1.4

2011
-

Dr. McDaniel

Why Scratch?


Easy to learn and use


visual, drag
-
and
-
drop programming
environment. Designed especially for young people.
See
http://
info.scratch.mit.edu/About_Scratch
.



Great for rapid prototyping of game mechanics.



Many of the concepts translate well to more robust and
sophisticated languages. You learn
concepts
, not tricky code
gotchas and confusing syntax.



We’ll start out simple. By the time you get to the scripting
tutorials in Unity, you should have a pretty good grasp of basic
game programming techniques.

2011
-

Dr. McDaniel

How It Works: Coding


Coding is done
visually
, with
eight blocks of
commands
listed in the
upper LHS.

2011
-

Dr. McDaniel

Sprites and the Stage


Sprites

can be
added to the
stage
, which can
then have units of
code applied to
them.

2011
-

Dr. McDaniel

New Sprites


New sprites can
easily be added
using the New
Sprite icon.

2011
-

Dr. McDaniel

Saving


Saving files saves your project in a proprietary Scratch file format
(.
sb
). A blank project is around 50kb.

2011
-

Dr. McDaniel

Attaching Code


Code can be attached to the
stage

or to individual
sprites. Each has its own code area.

2011
-

Dr. McDaniel

A Simple Example


Click on the Control block, then drag over a “when green flag
clicked” block onto the Scripts panel. Be sure the sprite is selected.

2011
-

Dr. McDaniel

Jigsaw Puzzles


Scratch makes it easy for you to build programs. Only certain
pieces will snap together, minimizing the tendency to make
errors.



In this case, we’re going to make our sample kitty say “hello”
when the green flag is clicked.



What type of block will we need to generate output?

2011
-

Dr. McDaniel

Looks


From the Looks block, drag over a “Say Hello! For 2
secs

block.”

2011
-

Dr. McDaniel

Clicking Blocks Together


Once you drag the box close enough to the original When Clicked
box, they will snap together. This is the technique you will use to
build your programs.

2011
-

Dr. McDaniel

Running the Program


To run your
program, just
click the green
flag in the upper
right hand
corner of the
stage.


2011
-

Dr. McDaniel

Editing Values


Click in the text areas to change the text boxes to make the
kitten say “
Que

Pasa
?” for 10 seconds. Easy enough, huh?

2011
-

Dr. McDaniel

A Simple Game


Okay, so let’s make this program a little more
game
-
like. Let’s edit the values so that our kitten
has some knowledge about us as the player.
We’ll make a lock
-
key scenario, where
information is revealed only if we hold the
appropriate item.



First, we’re going to add a variable to keep track
of some of the things going on in
-
world.

2011
-

Dr. McDaniel

Making Variables


Making a variable is as easy as clicking a button and providing
a name.

2011
-

Dr. McDaniel

First Variable


We’ll use our first variable to keep track of the player’s name.

2011
-

Dr. McDaniel

Working With Variables


After a variable has been
added, new functionality
appears. For now, we can
ignore these commands.



We want to use player
input to set this variable.

2011
-

Dr. McDaniel

Here is the Code


Take a look at how more complex code blocks are constructed.
Next, we’ll break this down piece by piece.

2011
-

Dr. McDaniel

Color Coding


Note how different units of code represent different types of
operations in different colors.

Control

operations

2011
-

Dr. McDaniel

Color Coding


Note how different units of code represent different types of
operations in different colors.

“Looks”

Operations

2011
-

Dr. McDaniel

Color Coding


Note how different units of code represent different types of
operations in different colors.

“Sensing”

Operations

2011
-

Dr. McDaniel

Color Coding


Note how different units of code represent different types of
operations in different colors.

Variable

Operations

2011
-

Dr. McDaniel

Color Coding


Note how different units of code represent different types of
operations in different colors.

Operators

2011
-

Dr. McDaniel

Getting Input


Notice how the input dialog is automatically assigned to the
answer block.

2011
-

Dr. McDaniel

Assigning Input to Variables


We can then drag our answer block out to use in variable
assignments.

2011
-

Dr. McDaniel

Concatenation


We use the “join” operator to concatenate our new variable’s
value with some text of our choice.

2011
-

Dr. McDaniel

Putting It All Together


Now, we have a simple, interactive application.



We can assign variables, collect input, and respond differently
to a player depending on what input is provided.



It still isn’t a game, though, so we need to keep working.

2011
-

Dr. McDaniel

A New Sprite


Let’s add a new sprite to our project. Choose New Sprite, Choose
New Sprite from File.

2011
-

Dr. McDaniel

We Have No Bananas


Let’s add a banana clump.

2011
-

Dr. McDaniel

Naming Sprites


It is a good idea to give our
sprites descriptive names.



Here, we have replaced
“Sprite2” with “bananas”.

2011
-

Dr. McDaniel

Hiding and Showing Sprites

2011
-

Dr. McDaniel

A New Variable


We’ll make a new variable to keep track of whether or not the
player “has” the bananas.



Note how local and global scope are handled here.

2011
-

Dr. McDaniel

Player Score


We’ll also use a variable to keep track of player score and make
it so that when the banana clump is clicked, we hide it.

2011
-

Dr. McDaniel

Broadcasting Events


On the main stage, we’ll add some code to initialize the
player’s score to zero and then broadcast an
event

when the
player presses the spacebar.

2011
-

Dr. McDaniel

Listening for Events


When our cat sprite “hears” this event being broadcast, it
knows to respond in a certain way.

2011
-

Dr. McDaniel

Putting it Together


Now, we simply
make a few
modifications to the
code attached to our
cat sprite.



We have now
created a very basic
game.



Would
Salen

&
Zimmerman agree?

2011
-

Dr. McDaniel

Hep

Cat

2011
-

Dr. McDaniel

Homework


Modify the scratch_lecture1_tutorial program (linked from our
course web site) to make it a better game.



Complete Unity3d tutorial modules and the “game plan for
milestone 1” assignments noted in the Webcourses week 2
module.



Start thinking about your individual games and start work on
your group game design projects.



Remember, plan
iteratively
! Rough builds first, then add
polish.