►
From YouTube: RustConf 2020 - My First Rust Project: Creating a Roguelike with Amethyst by Micah Tigley
Description
My First Rust Project: Creating a Roguelike with Amethyst by Micah Tigley
One of the biggest challenges to learning Rust is finding a project to continuously practice that newfound knowledge on. As someone with a background in front-end web development, the world of Rust was new and exciting to someone with limited systems programming experience. There were a number of open-source projects to choose from and so many areas to explore, it was a bit intimidating. I finally settled on Rust's game development community. This talk looks at my journey diving into game development with Rust by building my first roguelike game with the Amethyst game engine.
A
Another
was
documentation.
I
think
most
people
will
appreciate
that
in
any
area
of
software
development
and
being
someone
who
likes
to
do
independent
reading
and
research
on
a
topic
at
my
own
pace,
it
really
helps
to
have
accessible
documentation
to
refer
to
and,
finally
having
a
welcome
community
helps
lower
the
barrier
to
learning.
This
was
actually
one
of
the
biggest
reasons
that
got
me
interested
in
rust,
since
the
community
surrounding
it
is
dedicated
to
making
it
a
fun
and
safe
place
to
be
so.
A
So
I
think,
like
most
people
who
are
getting
it
started
with
rust.
One
of
the
first
things
I
did
to
jumpstart.
My
learning
was
a
combination
of
reading
the
rust
programming
language
and
trying
out
some
of
the
concepts
in
the
rust
playground,
and
this
was
a
good
way
for
me
to
get
a
bit
of
a
foundation
before
jumping
into
actual
rest
projects,
and
once
I
felt
like
I
had
some
of
the
basics
of
rust,
I
decided
to
contribute
to
a
few
open
source
projects.
A
One
of
the
first
things
I
did
was
update
the
standard
library
documentation
for
the
string
slice
type
and
later
on.
I
made
some
contributions
to
the
servo
web
browser
engine
project,
where
I
implemented
a
few
of
the
missing
attributes
on
the
mouse
event,
interface
and,
unfortunately,
I
haven't
been
able
to
contribute
to
other
open
source
projects
this
year.
But
hopefully
I
can
find
some
time
in
the
future,
but
of
course,
there's
just
so
much
to
know
about
rust
and
so
much
to
learn
about
it
and
it's
hard
to
keep
track
of
what
I've
learned.
A
A
And
I
wanted
to
do
this
in
rust,
and
so
one
of
the
first
places
I
went
to
get
some
information
was
checking
out
the
are
we
game
yet
website.
I
thought
this
was
a
good
place
to
get
some
ideas
of
what
I
might
need
to
build
a
2d
game
using
rust,
but,
of
course,
the
game
development
space
can
be
pretty
intimidating
in
itself
and
as
someone
with
basic
knowledge
of
computer
graphics,
amongst
other
things,
it
was
difficult
knowing
where
to
start.
A
So
when
looking
for
a
game
engine
to
use,
I
was
more
concerned
about
finding
one
that
provided
accessible
documentation
and
hands-on
learning
and
some
examples
to
help
demonstrate
certain
concepts
and
from
the
are
we
game
yet
website.
I
was
able
to
find
the
amethyst
game
engine.
This
is
a
screenshot
of
the
project's
landing
page
at
amethyst.rs.
A
As
I
researched
the
project,
I
found
that
it
checked
off
everything
I
was
looking
for
in
a
game.
Development
written
in
rust
and
the
documentation
for
amethyst
was
easily
available
through
the
project's
website.
I
never
really
felt
the
resources
they
provided
were
scattered,
which
is
a
huge
plus
for
me,
and
some
of
the
things
I
found
really
nice
is
that
amethyst
provides
a
book
that
entails
not
only
how
to
use
the
engine,
but
also
talks
a
little
bit
about
ecs,
which
is
a
topic
I
will
talk
about
later.
A
A
A
A
Let's
talk
about
animal
crossing
new
horizons
on
the
switch
animal
crossing
is
a
cute
laid-back
game
where
you
get
to
build
an
island
society
of
cute
anthropomorphic
animals,
and
in
this
image
and
the
game
in
general,
we
can
probably
apply
some
of
the
ideas
of
ecs
to
help
build
our
understanding
of
it
and
there's
a
lot
of
things
on
the
island
that
we
can
identify
as
objects
which
are
represented
by
entities
in
the
world
of
animal
crossing
new
horizons.
For
example,
the
player
character
is
an
entity.
Isabella
is
an
entity.
A
Timmy
and
tommy
are
entities,
and
even
this
tree
is
an
entity.
You
get
the
point,
but
it
feels
wrong
to
describe
our
island
residents
as
just
entities.
After
all,
an
entity
is
usually
represented
by
a
single
id
that
has
a
number
of
components
associated
with
it.
We
need
to
be
able
to
associate
some
data
with
them
and
to
keep
things
simple.
I
wanted
to
focus
on
describing
data
for
the
villagers
in
animal
crossing
for
some
context.
A
Villagers
are
non-playable
characters
that
can
move
to
your
island
by
either
randomly
moving
there
or
finding
them
on
another
island.
The
player
is
exploring
and
they
become
residents
of
the
little
town
you've
created.
They
can
also
do
activities
similar
to
the
player
such
as
fishing,
gardening
and
exploring,
and
the
player
can
interact
with
these
villagers
and
even
develop
friendships
with
them.
A
And
this
being
my
first
animal
crossing
game,
I
thought
what
made
a
villager
special
is
that
they
added
more
characters
to
the
island
by
well
being
cute,
and
though
I've
learned
recently
that
each
villager
shares
attributes
that
are
unique
to
each
of
them
that
actually
influence
how
they
interact
with
other
villagers
on
the
island,
and
so
here's
one
of
the
first
villagers
that
moved
to
my
island.
Her
name
is
flurry
and
she's
a
hamster,
and
the
moment
I
found
her
while
exploring
another
island.
I
just
had
to
take
her
home
home
with
me.
A
I
just
love
how
she
has
those
cute
little
blue
eyebrows
and
paws
and
red
t-shirt
and
she's
just
the
cutest
thing
ever
anyway.
There
are
specific
attributes.
Villagers
have-
and
I
didn't
list
all
of
them
here
since
I
wanted
to
keep
this
simple
attributes
that
specifically
describe
a
villager
will
be
its
species,
personality
and
hobby.
A
These
attributes
will
be
contained
by
what
I
will
call
a
villager
component
and
you'll
notice
that
the
name
and
birthday
attributes
weren't
included,
because
I
think
these
attributes
should
be
included
in
a
separate
component,
which
we
will
talk
about
later.
A
And
once
the
underlying
data
for
the
component
is
defined,
we
then
have
to
implement
the
component
traits
for
the
villager.
The
storage
type
determines
how
the
component
will
be
stored
and
in
this
example,
the
dense
vector
storage
type,
which
is
where
elements
are
stored
in
a
contiguous
vector.
It
allows
for
lower
use
memory
usage
and
it
also
like
and
for
also
dealing
with
larger
components.
A
Villagers
and
so
to
do
this
with
amethyst,
we
have
to
get
a
reference
to
the
world
which
acts
as
a
container
for
resources
in
your
game
to
create
a
new
entity
in
the
game.
We
first
need
to
import
the
builder
trait,
which
allows
us
to
create
the
entity
builder
using
create
entity
using
the
entity
builder.
We
can
add
component
to
that
entity
and
in
this
example
we
add
the
villager
component
we
defined
earlier.
A
Now
we
can
extend
this
by
using
the
name
and
birthday
attributes
in
another
component.
I
decided
to
call
it
the
resident
component,
since
it
generically
describes
any
character
on
the
island
and
in
this
example,
I've
added
another
entity,
entity
3
meant
to
represent
the
player
character
and
since
villagers
also
have
names
and
birthdays.
The
resident
component
can
also
be
reused
and
attached
to
entities
with
the
villager
component.
A
A
The
first
is
the
animation
component,
which
has
attributes
frames,
frame,
duration
and
index
frames.
Describe
the
number
of
sprite
images
for
one
animation
cycle
frame.
Duration
describes
how
long
each
image
should
be
shown
for
an
index
indicates
where,
in
the
sprite
sheet,
the
first
image
of
the
animation
is,
and
the
second
component
is
provided
by
an
amethyst,
it's
responsible
for
containing
data
about
the
sprite
sheet
and
which
image
from
the
sheet
to
draw
to
the
screen
the
data
used
to
describe.
This
is
a
sprite.
A
A
A
A
Resources
in
amethyst
are
containers
of
data
that
are
not
associated
with
an
entity,
and
then
the
animation
system
reads
from
the
animation
component
storage
and
finally,
the
animation
system
will
write
to
an
entity
sprite
render
component.
In
particular
the
sprite
render.
Sprite
number
value
will
be
modified
to
tell
amethyst
to
draw
the
next
image
in
the
animation
sequence,
to
the
screen.
A
And
this
is
what
the
animation
system
would
look
like
using
amethyst
implementing
a
system
involves
implementing
the
system
trait
on
a
struct,
and
this
system
is
then
executed
during
each
iteration
of
the
game
loop
and
when
we
define
the
system.
Amethyst
requires
us
to
define
a
type
called
system
data
which
tells
the
system
what
data
from
the
engine
it
should
expect
to
get
and
how
it
should
be
interacting
with
it.
A
On
the
flip
side,
there
is
also
the
right
storage
data
type,
which
gives
us
a
mutable
reference
to
the
entire
storage
containing
the
sprite,
render
components,
and
then
there's
the
read
data
type,
and
this
gives
us
an
immutable
reference
to
the
time
resource
and
now
the
next
step
is
to
implement
the
systems
run.
Method
in
our
animation
systems
run
method.
We
get
all
entities
with
an
associated
animation
and
sprite
render
component.
A
This
is
done
using
join,
and
this
allows
for
the
joining
of
components
for
iteration
over
entities
with
specific
components,
and
now
that
we
have
that
entity,
we
need
to
find
which
frame
to
use
for
the
sprite
render's
number
value,
depending
on
the
game's
elapsed.
Time
and
finally,
we
can
modify
the
entity's
sprite
render
to
draw
the
new
sprite
image
and
here's
the
final
result
of
an
idle
m
animation
for
the
wizard
sprite.
A
A
The
transform
component
storage
is
available
through
amethyst
and
it's
a
common
component
to
use.
This
is
because
transform
can
describe
an
entity's
position,
rotation
scale
and
much
more
and
for
this
game.
We're
really
only
concerned
about
modifying
an
entity's
position
and
rotation
in
response
to
user
input,
and
now
that
a
system
is
in
place
for
the
player
to
move
around,
it
might
be
nice
to
have
another
system
that
consists
of
a
camera
that
tracks
the
player's
movement
within
the
environment.
A
In
particular,
I
created
a
player
subject
component
that
I
associated
with
an
entity
designated
as
a
player.
The
camera
subject
component
is
also
associated
with
an
entity
designed
as
the
camera
view,
and
the
camera
follow
system
would
then
modify
the
associated,
transform
components
for
both
the
player
and
camera
entities.
A
A
And
there's
also
a
few
things
I
wanted
to
say
about
this
demo
earlier
in
this
talk,
I
mentioned
how
I
dabbled
a
bit
developing
a
simple
roguelike,
and
one
thing
that
I
became
particularly
interested
in
is
being
able
to
generate
a
random
tile
map
that
would
act
as
the
environments
the
player
could
move
around
in
and
so
as
another
mini
side
project.
That
was
separate
from
my
project
that
used
amethyst.
A
I
played
around
with
developing
a
tile
map
generator
that
I
could
use
potentially
in
my
game,
and
the
image
I
have
here
is
a
generated
background
image
used
in
the
demo
and
for
this
small
project.
I
used
a
crate
called
image
to
extract
pixel
data
from
a
source
sprite
sheet
and
had
it
put
into
an
image
buffer,
and
this
image
buffer
would
then
be
outputted
as
a
png
image
local
to
the
project
directory.
A
The
generated
map.
Images
aren't
perfect,
but
it
was
a
fun
way
to
learn
and
see
different
layouts
for
the
game
environment,
and
since
these
are
only
images,
I
I'd
have
to
still
extend
my
game
and
develop
some
sort
of
collision
system
so
that
that
the
player
cannot
move
through
tiles
that
are
considered.
Walls.
A
Prior
to
this
talk,
I
actually
wrote
a
blog
post
documenting
how
I
implemented
2d
sprite
animations,
using
amethyst,
and
one
of
the
things
I
really
appreciated.
My
pastel
for
doing
was
taking
the
time
to
establish
context
and
also
outline
her
thought
process
throughout,
and
this
was
the
most
difficult
part
and
also
the
most
time
consuming
part
of
writing
this
otherwise
short
blog
post,
because
I
really
wanted
to
find
a
perfect
balance
between
providing
enough
context,
while
also
being
forthright
in
my
content
and
if
anyone's
interested.
A
And
I
wanted
to
touch
on
writing
with
the
intent
to
teach
someone
like
it's
very
useful.
It's
even
if
it's
just
for
yourself,
because
it
will
help
really
ease
doubts.
You
have
about
your
knowledge
and
one
way
to
do
this
is
to
keep
a
series
of
blog
posts
and
over
time,
you'll
have
created
your
own
repository
of
knowledge
and
who
knows,
maybe
someone
will
find
what
you
wrote
about
really
useful.