►
From YouTube: Lisa Passing - Making a game in Rust
Description
When you’re trying to learn a new programming language it makes sense to start with a small project. A lot of developers would write an API server or a Twitter bot. When I try to learn a new language I start by writing a game. Let me show you how I wrote my first game in Rust with Piston.
Lisa Passing
https://lislis.de/
https://github.com/lislis
https://users.rust-lang.org/users/lislis/activity
A
A
Nonetheless,
we're
going
to
talk
about
making
a
game
and
rust
I
don't
have
a
lot
of
time
and
so
I'm
going
to
make
everything
like
quite
short
and
but
try
not
to
race
through
it.
So
I'm,
this
or
Lisa
or
Liz's
and
I
think
I'm.
The
only
speaker
whose
handle
is
on
the
schedule
and
not
like
real
name,
but
it's
fine,
I
work,
a
travesty
I
and
we
do
continuous
integration.
I
dropped,
a
bunch
of
stickers
and
I.
A
Think
there's
still
some
left
yeah,
but
my
day
job
mostly
consists
of
front-end
work,
so
javascript
in
the
browser
and
pushing
pixels
I
actually
like
CSS.
Believe
me:
I
do
nonetheless
I
have
a
different
hobby,
and
that
is
everything
about
video
games
playing
and
for
this
talk,
more
importantly,
making
video
games.
So
you
might
wonder
why
I'm
making
video
games
like
the
programming
is
awesome
like
do
this
as
a
hobby.
Well,
there's
a
couple
of
reasons.
A
So
there's
like
a
couple
things
that
you
need
to
consider
that,
just
like
don't
appear
in
my
day,
job
which
is
I
find
like
this
is
something
that's
really
interesting
and
also
on
the
challenging
part
of
size.
This,
like
it's
not
just
like
the
logic
of
the
game,
that
you
need
to
take
care
of
their
selves
like
graphics
and
they
might
be
sound
and
hopefully
their
sound
and
like
interaction,
but
that
just
like
interaction
player
with
like
your
game
software,
but
this
could
also
mean
interaction
with
hardware.
A
Do
you
use
a
keyboard
or
I
have
made
a
game
that
uses
an
immediate
eboard
so
like
an
actual
like
piano
like
keyboard
as
an
input
device
and
like
all
these
kinds
of
things
that
you
can
like
be
creative
about
and
can
like
toy
around
with.
So
everything
is
basically
about
fun
in
learning
stuff.
So
now
you
know
why
we
should
make
a
game.
Why
would
you
want
to
use
rust
for
it?
A
So
generally,
it's
like
people
won't
say
to
me
like
Oh,
like
I'm
gonna,
make
games
like
what
language
should
that
should
I
write
them
in
I,
usually
say
like
for
the
scope
of
like
an
indie
game,
any
language
we
do
ethnic
games
in
Lua
and
Ruby
and
JavaScript
in
closure,
and
it's
all
fine
like
because
until
like
speed
and
like
all
these
things
actually
matter
like
you,
don't
have
the
time
to
the
game.
That
is
that
complex
that
you
actually
care
about
these
things.
A
That
being
said,
like
the
big
titles
that
you
play
on
PlayStation
or
on
your
xbox
or
pc,
or
whatever
they
usually
code
it
in
C
and
C++,
where
the
engineers
try
to
like
get
every
computation
out
of
every
clock
cycle
and
it's
like
very,
very
low
level
and
like
hard
on
the
on
the
actual
hardware
of
the
system
and
well
all
the
rest
of
the
system
of
the
language
I
was
like.
Oh,
we
could
actually
like
think
about
making
big
titles
in
rust.
A
Also
Brussels,
new
and
shiny
and
I
always
try
to
like
learn
things,
and
this
was
like
the
perfect
opportunity
to
like
get
interested
like
okay.
I
can
make
a
game
in
it.
Here's
a
brief
intermission
because,
like
I
started
researching
like
how
to
make
games
like
a
few
years
ago,
and
every
book
I
ever
read
on
it
at
code,
examples
in
C++
and
while
it
was
fine
like
reading
the
book
and
I'm
like
reading
the
narrative
to
like
the
cows
like
yeah
I
can
sort
of
follow
it.
I
was
like
I
cannot.
A
I
cannot
code
this
on
my
own,
so
I,
like
years
ago,
I
tried
learning
C++
like
the
hard
way
and
there's
a
series
about
it,
but
it
was
actually
hard-
and
this
was
mostly
because,
like
every
time,
I
was
stuck
and
I
didn't
understand
something.
I
asked
like
programmers
that
I
know
from
like
various
communities
like
Isis
problem
in
C++.
You
studied
computer
science,
like
you
sure,
know
how
to
solve
this
and
like
don't
you
want
to
like
try.
Ruby,
maybe
like
I,
can
explain
your
Ruby
I.
A
Think
no,
but
like
I
need
help
in
c,
plus
plus
something
ya
know
so
I
stopped
and
never
learned
C++.
So
this
sad
story,
the
positive
story
expect
to
the
wire
you
thrust.
People
are
excited
about
it
and
then,
if
it
tells
people,
oh
like
I'm,
trying
to
make
a
game
and
rust
they're
like
awesome,
tell
me
all
about
it.
A
It's
like
I,
actually,
don't
know
what
I'm
doing,
but
I
can
tell
you
about
it
and,
as
part
of
like
the
welcoming
community
that
you
are
and
we've
like
heard
it
a
couple
of
times
during
the
day.
This
is
not
like
a
given
for
other
communities
and
I
think
it's
really
exciting.
This
is
like
probably
what
will
make
me
stick
around
in
the
rest
community.
A
So
all
this
aside,
it's
actually
make
a
game
to
make
a
game.
You
usually
need
three
things.
You
want
to
use
an
engine
because
if
you
don't
use
an
engine
and
you
start
making
a
grain
game
from
scratch,
you
will
end
up
making
a
game
engine
people
are
laughing
is
like
I
was
like
yeah,
and
so,
if
you
want
to
make
a
game,
you
pick
an
engine
probably-
and
you
might
wanna
have
an
idea.
A
A
Okay,
picking
on
engines-
and
this
is
very
cool
site
that
I
found,
which
is
called.
Are
we
game
yet
calm,
which
lists
yet
game
related
resources
in
the
rust
ecosystem?
So
crate
said
you
might
want
to
use
this
of
games
that
are
already
out.
There
was
like
perfect.
This
is
just
what
I
need
so
I
went
to
the
list
of
game
engines
and
I
picked
the
first
one
piston
which
like
for
some
reasons
it
seemed
kind
of
cool.
It's
for
the
short
lifetime
of
rust
itself.
A
Piston
has
been
around
for
quite
a
long
time
and
it's
still
very
actively
like
maintained
and
developed,
and
just
like
now.
This
is
a
good
indicator.
I
like
like
the
modularity
approach
that
says
that
we
have
a
couple
of
like
small
focus,
crates
that
you
can
use
in
like
pluck
your
engine
together.
So
there's
like
modules
that
you
can
use
for
3d
stuff,
but
I
will
focus
on
the
two
details
like
other.
This
is
cool,
so
in
case
I
end
up
learning,
3d
modeling
at
some
point,
I
could
still
use
the
same
engine.
A
There's
already
like
a
few
games
listed
on
the
on
the
wiki
that
use
piston.
Most
of
them
are
snake
or
Tetris,
but
that's
those
are
still
valid
games
and
there's
a
couple
of
like
new
one.
A
All
this
way,
so
you'll
be
fine.
Honorable
mention
for
an
engine
called
GG,
easy
good
games,
easy
I
think
is
what
it
stands
for
and
because
they
describe
like
their
their
mission
or
their
design.
Inspiration
was
love
2d,
which
is
a
very
popular
2d
game
engine
in
Lua,
so
every
game
engine
that
tries
to
be
like
love,
2d,
is
probably
on
a
very
good
way
and
I
would
probably
try
it
next
for
the
next
game.
Okay,
we
have
our
engine.
A
Now
we
need
to
get
an
idea
and
just
like,
as
I
already
said,
it
could
be
about
anything.
You
want
an
experience.
Just
make
games
about
a
joke
that
I
heard
and
like
it
could
be
anything
so.
The
game
that
I
made
for
this
talk
is
called
Montana
attack.
Montana
is
Spanish
for
Apple
and
it's
based
on
a
true
story
which
I'm
going
to
tell
you.
A
Where
did
that
come
from
looking
up
no
tree
likes
like
the
next
tree,
was
like
ten
meters
away
and
was
an
olive
tree.
What
and
we
like
looked
up
at
the
buildings
like
someone
just
threw
an
apple
out
of
the
window
with
like
not
caring
at
all.
For,
like
what
happens,
it
was
like
it
wasn't.
Just
like
you
know,
a
piece
of
Annapolis
like
an
entire
Apple.
We
like
looked
at
the
scraps,
açaí
quiet
and
it
was
very
surreal
and
the
next
day
is
like.
A
A
A
So
what
you
see
is
the
house
wares
actually
happened,
and
it
happens
that
the
windows
of
the
house
make
this
nice
three
by
four
grid,
in
which
me
the
player
represented
by
the
black
square,
is
moving
around
and
you
see
down
at
the
floor.
There's
red
rectangles,
walking
from
right
to
left
left
to
right
at
various
speeds,
so
I
can
move
around
and
when
I
press,
M,
F
or
an
apple,
damn
it
so
like.
Here.
Your
game
is
to
like
time
these
and
like
actually
hit
the
people.
A
Thank
you,
let's
quickly
run
through.
How
would
you
build
such
a
thing?
So
here's
an
ingredients
list
also
known
as
cargo
tunnel
and
I
have
only
three
dependencies
which
are
piston
window,
fine
folder
for
like
finding
efforts
and
random
for
all
things,
randomness,
and
you
might
wonder
why
it's
only
piston
window.
Didn't
you
talk
about
like
modularity
in
crates
and
stuff
piston
window.
Is
a
convenience
wrapper
that
like
when
you're
starting
you
don't
have
no
choice
like
what
crate
or
like
what
back-end
for
Windows?
A
Do
you
want
to
use
like
I,
don't
know
so
piston
windows
there
to
like
gives
you
like
a
nice
choice
of
things
that
you
probably
want
to
use
which
I
use.
This
is
like
nice.
It's
nice
try
to
flight
okay.
They
made
some
choices
for
me
because,
as
a
complete,
beginner,
I,
don't
know
so
in
later
games,
you
can
like
start
using
the
goop
core,
piston
engine
and
then
put
stuff
together
as
you
go.
A
Okay,
let's
quickly
talk
about
some
other
game
fundamentals
and
a
game
usually
consists
of
like
four
four
main
parts
and
that
you
need
to
consider.
One
of
them
is
load
which
is
like
initializing,
your
window,
loading
all
the
assets
and
all
that
stuff,
and
then
you
have
update
and
render,
which
are
most
engines
they're
like
callbacks
or
events
that
happen
60
times
a
second.
So
in
render
you
just
like
draw
stuff
and
because
it
happened
so
fast
that
are
the
human
eye
cannot
see
that
you
like
redrawing
this
very
fast.
A
You
see
this
movement
because,
like
value
slowly,
change
and
the
change
of
values
is
usually
computed
in
the
update
cycle,
which
also
happens
60
times
per
second.
Hopefully,
what
makes
this
thing
interesting?
So
all
of
this
would
make
super
awesome,
generative,
art
and
the
things
that
makes
it
a
game
is
like
events
or
inputs
where
we
interact
with
the
game.
So
I
am
in
my
game,
like
I,
move
around
the
player
and
press
em
to
throw
up
the
Apple.
A
So
let's
look
at
some
code-
and
this
is
a
boiled
down
version
of
my
a
Maine
RS.
We
just
say
like
extinct,
right,
piston
and
use
system
window
everything
there's
like
in
the
code
on
github.
You
can
see
that
there's
also
like
the
random
crate
and
then
find
folder,
but
this
doesn't
matter
right
now
and
in
the
main
function.
A
A
You
say
if
you
want
to
exit
on
escape,
it
can
say
true,
which
is
what
I
used
and
then
built
and
then
unwrap,
and
then
you
have
like
our
piston
window
for
the
game
and
the
actual
nice
thing
happens
next,
which
is
a
while
loop
and
that
iterates
over
all
the
events
that
the
window
for
was
at
us.
So
the
piston
window
would
give
us
all
the
events
that
happen,
and
then
we
have
like
a
match
statement
where
we
like
sort
these
events.
Okay,
is
this
an
update
event
then
do
this
or
like?
A
Is
it
a
render
event
or
is
it
an
release
event
and
in
my
game,
I
only
use
release
events
because
that's
worked
for
me,
but
you
can
also
use
I,
keep
press
events
or
mouse
button,
click,
events
or
scrolling
or
just
mouse
movement
and
other
things
are
supported,
but
I
just
need
these
and
the
rest
of
them
like
happens.
Basically
inside
of
these
event,
hooks
I
would
call
them,
maybe
so
far
so
good.
Let's
take
it
look
at
the
structure.
A
I
made
a
couple
of
structs.
Most
of
them
are
just
there
to
keep
track
of
the
positioning
within
the
game,
so
just
like
absolute
pixel
values,
so
I
have
the
main
game
struct,
but
I
should
probably
say
that
folk
or
the
folks
in
the
game
are
the
red
squares
or
the
people
that
walk
around
the
street.
So
the
game
main
games
track
keeps
track
of
or
like
contains
the
vector
of
folks
or
a
folks
vector
of
folk
of
type
folk
and
and
the
player
and
the
player
then
has
shops
and
apples
shots.
A
A
The
key
M
like
then
only
then
call
the
throw
and
on
the
player
struct
I
have
a
throw
method
that
there's
some
code
that
calculates
the
new
position
of
the
Apple
that
is
going
to
be
thrown,
and
then
we
call
just
like
self
shop
start
fire
which
is
like
on
the
shop
struct
or
like
in
the
shops.
Thing
decreases.
The
counter
and
in
the
echo
vector,
are
just
like
push
a
new
Apple
that
will
then
be
updated
by
the
update
loop,
but
to
go
to
that
and
one
in
a
second.
A
But
it
works
and
then
I'm
going
to
check
if
the
the
value
exceeds
a
certain
amount
which,
aside
towards
the
I'm
gonna
kind
of
deactivate
the
Apple
instead
of
to
false.
And
so
then
like
the
apples,
inactive.
So
similar
thing
happens
when
I
update
the
folks
that
run
around
the
street
also
going
to
like
check.
If
the
fog
is
still
active
and
then
I
have
the
property
on
them,
which
is
called
ltrs
or
left
to
right,
which
is
either
true
or
false.
A
So
and
when
they
come
from
the
right
side
or
from
the
left
side
difference
whether
I
need
to
increase
or
decrease
the
value
on
the
x-axis
and
also
depending
on
that,
I
have
the
condition
for
when
to
like
the
activate
from
like
when
they
walk
out
of
the
the
screen.
Basically,
yes,
I
also
at
the
time
like
a
time
mechanic
for
spawning
new
folks,
which
is
right
now
directly
in
the
game,
structs
updates
methods,
which
would
probably
go
to
like
a
folk
controller,
abstraction
thing.
A
A
So
this
is
like
somewhere
in
the
milliseconds
like
sphere
and
just
like
call
up
all
the
milliseconds,
and
if
the
counter
is
like
greater
than
some
interval,
that
I
chose,
for
example,
I,
think
it's
two
seconds
or
in
the
game
every
two
seconds
a
new
person
respond
somewhere
and
like
if
we
actually
like,
if
the
two
seconds
are
exceeded,
I'm
going
to
reset
the
counter.
So
I
can
like
start
from
zero
and
the
next
and
the
next
round,
but
I'm
also
going
to
call
self
spawn
folks.
A
So
like
a
new
folk
is
pushed
into
the
ends
of
the
games.
Folk
vector
and
like
the
spawn
method
itself.
Like
just
does
all
the
random
stuff
like
choose
a
random
direction
like
either
go
from
left
to
right
and
like
what
speed?
You
should
walk
it,
because
the
speed
is
also
varying
a
bit
and
what's
also
happening
on.
Every
update
loop
is
checking
for
collision,
which
is
this
very
verbose.
A
Code
of
two
nested
for-loops
imma
draining
over
all
folks
and
check
is
like
they're,
still
active
and
then
I'm
going
to
iterate
over
all
the
apples
and
check
of
the
Apple
estate
active,
still
active,
and
then
there's
like
a
collision
detection
of
like
two
rectangles,
which
is
very
nice.
If
you
just
use
rectangles,
because
the
geometry
for
overlapping
rectangles,
with
where
the
XS
are
lined
in
the
same
way,
is
fairly
trivial
to
just
six
like
this,
with
like
greater
than
the
other
widths.
A
And
then
it's
just
like
four
lines
in
the
fifth
statement
and
and
if
those
match,
so
if
the
rectangles
actually
overlap
kind
of
deactivates,
both
the
folk
and
the
Apple,
which
is
also
like
setting
the
active
flag
to
false
and
then
this
is
also
where
the
scoring
should
happen.
Ideally,
but
yes,
scoring
is
a
different
thing.
A
There's
a
couple
of
things
that
I
do
not
like
about
this
game.
At
the
moment
they
were
missing
and
had
sound
effects.
I
I
already
picked
the
sound
effects
there
in
the
git
repo,
but
I
couldn't
make
the
Krait
ears
to
work
for
ears.
Just
the
crate
was
like
a
little
like
load,
some
sound
acid
and
then
play
it,
but
it
didn't
work.
I'm,
blaming
I
tried,
install
supercollider
on
my
computer,
which
is
like
this
gigantic
music
library,
and
it
didn't
work
at
all
and
I'm
blaming
this.
For
that.
A
So
not
sure
if
this
ever
works,
I
really
want
is
sophisticated,
scoring
logic
based
on
the
height
of
the
upper
and
where
you
from
where
you
drop
it
and
the
speed
of
the
folk
that
she
actually
hit.
So
if
you
have
a
Apple
that
you
throw
from
higher
up
the
building
and
exponentially
hit
like
a
very
fast-moving
folk
at
the
bottom,
you
should
get
more
points
of
like
encourage.
Moving
around
a
lot
and
I
want
some
logic
to
prevent.
A
Windows
swatting
I
had
some
people
play
the
game
and
they
would
just
like
sit
in
a
window
where
that
I
felt
comfortable
like
gauging
the
the
falling
of
the
Apple
side.
Okay,
if
I
like
now
release
the
Apple,
then
it's
like,
probably
they
will
I
hit
this
person,
but
I
don't
want
this.
You
should
move
around
a
lot,
so
I
thought
about
maybe
having
something
else
like
opening
and
closing
windows,
and
you
can
only
use
the
windows
that
are
open
at
the
current
point
in
time
and
not
when
they're
closed.
A
But
this
is
all
future
and
that's
how
I
made
a
game
in
rest.
It
was
quite
hard.
I
ran
into
all
the
things
that,
like
beginners,
probably
run
into
us
like
it
right
over
something
while
it's
mutable
for
like
I
found
it.
Your
mute
strings
like
every
like
everywhere
would
have
reduced
strings
in
a
different
language.
I
used
numbers
instead
here
or
like
integers,
because
it's
like
so
hard
I
can't
I
can't
figure
it
out,
but
it
worked
in
the
end
and
I'm
with
all
the
talks
that
I've
listened
to
today.