►
Description
How coding a system with so many independently moving parts is less about the bits and bytes but more about the high-level capabilities rust offers.
In this talk Stefan Schindler @dns2utf8 focused on how he designed the whole system from concept to implementation including hosting it on a CO2 neutral server.
Join the Zürisee Community on Matrix:
#rust-zuerisee:matrix.coredump.ch
Checkout https://rustfest.global/
A
B
To
the
other
things,
removing
the
title
picture
and
making.
A
So,
let's
resize
the
camera
that
doesn't
work.
A
I've
started
a
professional
I.t
14
years
ago,
which
is
when
you
think
about
it
before
the
crash
of
of
2007
2008,
so
yeah,
that's
a
really
long
time
ago.
Since
then,
I
gained
a
bachelor's
degree
in
computer
science
and
yeah
been
using
rust
since
2016.
A
I
got
into
that
with
the
core
dump
hackerspace,
which
I'm
still
with
today
and
since
2017,
and
we
quickly
get
up
here,
I'm
with
rustfest.
As
you
can
see
here.
This
is
the
first
shirt
I
owned
as
a
as
a
host.
A
Okay,
so
table
of
contents.
What
are
we
looking
at
tonight?
So
the
topic
is
how
to
build.
Multiplayer
systems
and
multiplayer
games
are
complicated
because
you
have
timing
restraints
and
you
have
people
that
don't
like
it
when
your
software
randomly
crashes
so
to
meet
this
goal.
This
top
goal
to
play
the
game
with
friends.
A
We
need
a
server,
we
need
infrastructure
and
we
need
a
client
and
I've
written
down.
What
what
we
need
like
the
in
this
order
from
goal
to
implementations
and
in
the
end,
we'll
have
some
conclusions
and
oh
by
the
way,
if
you're
bored
for
any
reason,
I
have
the
chat
open,
as
you
can
see,
you
can
just
say
so
and
then
I
will
happily
hand
out
the
the
url
to
the
current
demo,
so
you
can
actually
play
the
game
right
now.
If
you
choose
to
to
do
so.
A
So
sounds
like
a
lot,
oh
by
the
way,
if
you
have
any
questions
just
type
it
into
the
chat,
I
will
be
happy
to
respond
to
that.
A
A
There's
a
button
on
the
stream
page,
I'm
not
sure,
oh
maybe
anyway,
here
is
sorry
for
the
typing.
A
Here's
the
game
url,
so
we
would
like
to
see
everything
right.
We
need
to
have
a
mental
picture
of
what
we
are
going
to
do
and
how
complicated
can
that
be
well,
we
need
server
infrastructure
and
server
configuration
and
game
server
and
actually,
let's
look
at
this
picture
real,
quick,
my
pick,
so
this
picture
is
what
happened
in
one
round
just
one
round
like
from
oh,
I
don't
know
because
fro
from
like
it
starts
from
the
top
see.
If
I
can.
A
A
It
fires
a
tick
event.
Tick
event
is
a
normal
rust
data
structure,
it's
derived
from
actix
message,
so
this
one
gets
sent
to
the
arena,
which
is
the
three
by
six
grid.
The
arena
then
creates
a
decision
collector
and
a
next
step
collector.
A
So
it's
for
me
way
easier
to
just
write
down
all
the
messages
in
this
picture
and
then
just
fire
them
and
think
about
okay.
How
can
I
collect
them?
So,
let's,
let's
follow
one
tick,
so
the
timer
goes
off.
The
arena
creates
the
decision
collector
and
the
next
step
collectors.
These
are
like
the
little
ceelo
box
and
the
arrow
in
roughly
the
middle,
both
of
them
again
get
sent
to
the
snakes.
All
of
the
snakes
that
are
in
the
game
currently
and
each
snake
may
have
players
attached.
A
So
then
the
snake
goes
to
the
player,
the
black
plug
yeah,
the
wall
plug
and
the
player
is
represented
on
the
server
by
the
websocket
actor,
which
is
also
normal,
rust
data
structure
designed
the
system
like
this,
because
I
originally
had
feared
that
if
someone
spams
the
websocket,
then
it
will
trigger
a
flood
of
messages,
and
I
didn't
want
that.
So
what
happens
when
you
press
a
button
in
the
game?
A
It
just
reaches
your
actor
and
that
actor
stores
your
vote
or
your
action
until
the
timer
and
the
tick
and
everything
passes
through
and
then
collects
this
information
from
the
actor,
so
the
amount
of
processing
needed
and
the
amount
of
communication
needed
after
the
user
clicks
once
is
very
limited,
and
that
makes
the
system
super
efficient
all
right.
So
the
websocket
now
has
the
decision
collector.
I
drew
it
again,
it's
the
little
tube
on
the
left,
so
it's
the
same.
A
A
This
one
will
go
to
the
will
have
a
collected
direction,
so
all
websockets
connected
to
that
snake
have
decided.
So
we
have
a
vote
we
know
now.
Does
the
majority
of
the
players
of
that
snake
want
to
go
left
or
right
or
straight
ahead?
A
That
decision
is
then
collected
into
the
arrow
into
the
next
step
collector,
and
this
collector
you
can
guess
it
collects
all
the
decisions
from
all
the
snakes.
So
now
we
have
all
the
information
that
we
need
for
the
calculation
and
then
you
can
see
this
little
rounded
arrow
on
the
top
right
it.
If
this
one
the.
If
the
next
step
collector
decides
it's
finished,
then
it
will
feed
it
back
into
the
arena
and
the
arena
is
now
able
to
have
without
any
synchronization
from
our
part.
Just
with
messages
sent,
it
can
now
say:
okay.
A
A
So
I
say
if
I
think
it
is
10
or
50
of
the
time
has
passed,
we'll
just
ignore
all
the
remaining
answers
and
decide,
so
the
other
players
still
have
decent
information.
A
A
A
A
Oh,
it
doesn't
work
and
now
it
works
so
configuration
everybody
has
to
do
some
configuration
and
if
you
have
lots
of
little
projects,
then
you
notice
at
some
point.
You
have
mostly
the
same
because
you
have
your
style,
but
sometimes
you
have
these
little
differences
and
it's
really
annoying
so
yeah
pretty
pretty
annoying.
If
you
forget
this
little
details,
so
I
put
it
into
unsymbol
until
is
a
configuration
tool
that
does
not
require
an
agent
on
the
system.
A
It's
just
over
ssh,
so
my
laptop
has
a
folder
that
I
check
in
to
get
and
then
it
goes
out
to
all
my
servers,
configures
them
with
engine
x.
Let's
encrypt
in
this
case,
sometimes
not
dns
openssh
is
also
configured
so,
for
instance,
I
disable
password,
logins
and
stuff
like
that.
So
if
this
machine
ever
goes
down-
or
I
say
I
have
this
one
service-
maybe
the
snake
service
wasn't
like
as
efficient
as
I
imagined.
I
have
to
move
that
to
another
system.
A
So
if
I
change
the
role
from
one
system
to
another,
these
keys
will
follow
and
just
be
there
and
then
I
can
deploy
this
from
my
laptop
or
from
continuous
integration
or
whatever
creating
unix
accounts
and
systemd
and
whatnot.
Yes,
by
the
way
the
server
has
not
crashed,
since
I
started
it
like
ever,
but
if
it
did,
systemd
would
restart
it
within
one
millisecond.
So
users
would
experience
a
reconnect,
but
the
service
should
always
be
around,
so
that's
pretty
cool.
A
I
have.
This
is
a
little
bit
cropped
off,
because
I
create
everything
with
unsymbol.
I
create
this
proxy
url
txt.
This
is
not
a
standard,
it's
just
my
idea,
but
what
this
does
is
configures
nginx
and
this
file
that's
residing
inside
the
unix
account
for
each
service
onto
the
same
path.
Right
so
nginx
needs
to
know
where
the
reverse
proxy
will
be
because
nginx
handles
the
encryption
and
all
the
certificates
and
my
service
needs
to
know
which
port
to
bind.
So
I
output
this
proxy
url
into
the
user
and
then
on
startup.
A
A
Full
screen
nah
doesn't
work.
I
hope
you
can
read
it.
So
this
function
extract
bind
is
basically,
we
read
the
string,
backend
url
txt
and
then
trim
it
drop
off
the
http
drop
off
the
last
slash,
and
then
we
get
an
address
out
that
any
normal
tool
can
parse,
including
actix.
A
B
A
A
All
right,
this
is
all
we
need.
What
this
will
return
is
a
string.
That's
in
my
case,
opening
bracket,
colon
colon,
one
closing
bracket
colon
and
then
some
random
integer.
That's
a
port
number.
A
Anyhow,
let's
continue,
we
have
talked
about
this
picture
so
core
logic,
so
I
explained
how
we
we
reach
all
this
data,
how
we
just
collect
all
the
information,
and
now
here
we
are
in
the
arena,
the
back
of
the
the
circle.
Let
me
show
you
so
we're
back
here
in
the
middle
of
this
circle,
and
now
we
get
this
collected
snake
bodies
message
and
now
we
have
to
do
the
steps
and
the
steps
are
relatively
easy.
We
just
say:
okay,
we
figure
out,
because
the
messages
may
be
reordered
right.
A
We
don't
know
which
snake
is
the
fastest.
Maybe
one
of
the
the
snakes
for,
for
some
reason,
has
hundred
players
and
the
other
one
has
just
one.
The
one
with
one
player
is
most
likely
faster
than
the
one
with
hundred,
so
they
might
arrive
out
of
order.
So
we
have
to
look
up
all
the
snakes
here
first,
so
they
are
in
the
same
order
as
they
are
stored
in
our
arena
actor.
A
Then
we
also
have
to
take
care
of
wrapping
around
so
you're.
If
you-
I
don't
know
if
you're
playing
right
now,
but
you
can
go
out
the
top
and
then
you
will
enter
from
the
bottom
again
same
on
the
sides,
and
that
is
done
here.
This
is
way
easier
because
then
the
snakes
don't
have
to
know
how
big
the
arena
is
right.
The
arena
will
then
just
tell
the
snake
hey.
Did
you
know
that
your
head
is
now
no
longer
outside
the
arena?
A
Right
flocky
says:
the
mobile
version
is
a
bit
broken,
apparently
is
hot
fixing
it.
So
if
your
stream
is
working
for
you,
don't
reload
the
page,
just
stick
with
us.
Moving
on.
A
A
This
is
actually
old
code,
but
yeah
to
be
safe.
I
never
want
this
to
panic.
I
left
it
in
because
after
this
I
do
an
access,
and
I
can't
remember
why,
but
for
some
reason
I
was
too
lazy.
Oh
yeah,
that's
why
I
considered
switching
that
to
an
iflit,
but
if
let
would
then
have
required
me
to
do
this
comparison
that
we
have
here
on
the
right
where
the
next
fruit
is
said
to
have
that
inside
another.
A
If
so,
this
is
just
lazy
me
saying
I
want
to
have
this
in
one
if,
instead
of
two
so
tedam,
that's
the
whole
thing,
we
have
to
do
some
bookkeeping
for
the
trashes,
so
we
truncate
the
length
of
the
bodies
here
as
well,
and
then
we
just
save
whatever
it
is.
So
this
function
decides
whether
the
the
fruit
has
to
be
reset
because
it
has
been
eaten,
and
this
part
is
if
it
has
not
been
eaten.
A
A
Maybe
yeah,
I'm
not
sure.
Okay,
before
we
lose
ourselves
in
this,
can
you
write
me
a
merge
request?
The
code
is
on
gitlab
on.
A
A
Okay,
so
now
we
have
our
step.
The
other
part
of
the
core
logic
is
detecting
collisions
and
I
went
through
some
iterations
with
that
and
I
got
stuck,
but
luckily
I
could
ask
some
friends
and
they
said
hey:
why
aren't
you
using
indexes
right?
The
snakes
are
in
order
anyway,
just
like
make
indexes
like
yeah.
Actually,
that's
true,
that's
way
better
than
having
two
mutable
iterators
fighting
over
who's
more
right
and
who
owns
the
data
more
than
the
other
one.
A
Let
me
just
move
myself
out
of
the
way,
so
someone
was
kind
enough
to
write
the
same
thing
with
rust.
It's
called
default
hash
map,
it's
just
a
hashmap
that
uses
this
closure
or,
if
any
other
function.
So
whenever
I
access
a
thing
that
doesn't
exist,
we'll
just
create
a
vector
with
a
capacity
of
snakes.
A
A
Second,
I
see
there
are
some
people
against
the
debian
or
systemd.
Well,
I
had
great
experience
with
dbn,
especially
because
I
can
set
up
a
server,
let
it
run
for
two
years
and
then
update
it
and
it
hasn't
been
hacked
and
it
still
works.
So.
A
Moving
on
so
here
we
are,
most
of
you
know.
Four,
you
know
four
in
is
syntactic
sugar
for
using
iterators
underneath,
so
we
can
still
do
that.
We
can
still
say,
let's
iterate,
and
why
would
you
do
that?
Because
of
this
enumerate
enumerate
shows
us
the
index.
This
may
not
true
for
all
data
structures,
but
it's
true
for
vectors.
So
in
vectors
we
always
have
this
index
and
enumerate
just
shows
us
that
there
are
other
iterators
which
don't
have
this
index
variable
like.
A
A
A
We
iterate
over
the
the
body
and
say:
okay,
let's
flag,
all
the
fields
that
this
snake
occupies.
So
we
populate
that
and
after
we
have
done
that
for
every
snake,
we
have
all
the
fields
that
are
occupied
by
all
the
snakes.
This
means,
if
one
field
is
occupied
by
more
than
one
snake,
we
have
a
collision.
This
also
means
if
a
snake
occupies
a
field
twice,
it
has
a
collision
with
itself
and
we're
done.
We
have
this
one
field
and
we
have
to
check
it.
A
A
A
I
could
optimize
that,
probably
a
bit
more,
so
I
don't
if
I
realize
that
all
the
snakes
have
crashed
that
I
don't
look
into
the
other
fields.
But,
let's
be
honest,
this
is
so
little
code
and
I've
noticed
that
if
there
are
more
than
like
four
or
five
snakes
in
the
game,
it's
already
almost
unplayable.
So
this
is
fine.
A
Don't
over
optimize
things.
Now
we
have
checked.
Where
are
the
collisions?
Now
we
walk
through
all
the
snakes
again,
but
this
time
we
just
look
at
who
has
collided.
Why
this
way
around?
Why
not
the
other
way
around?
Well,
because
then
I
can
just
say:
snake
dot
address
send
reset
and
the
reset
is
the
command
for
the
snake.
Hey
you've
died,
I'm
sorry
go
tell
all
your
clients
that
you
have
died
and
that's
what
the
responsibility
of
the
snake
is,
and
so
the
snake
goes
on
doing
that,
but
we
don't
have
to
care.
A
So
if
we
add
some
fancy
features
later
in
the
future,
we
say
hey
if
the
snake
dies,
maybe
add
fireworks
or
whatever
this
logic
has
no
need
for
change.
We
don't
need
to
update
anything
in
here.
Just
say:
do
send
reset
at
and
the
reset
add
structure
is
known
to
be
used
only
for
snakes
that
have
diets.
Okay,
almost
done
with
the
core
logic.
A
We
broadcast
all
the
snake
bodies,
which
basically
looks
like
this
just
like
buffer
all
the
bodies
into
a
structure
send
all
the
messages
out
to
all
the
clients.
We
don't
need
to
involve
the
snakes
for
that
process
because
we
all
know
all
the
clients
in
the
arena
as
well,
so
we
just
send
them
directly.
Here's
the
update
and
if
the
fruit
has
changed,
we
get
a
new
position.
A
We
cannot.
I
also
added
a
feature
where
I
say:
don't
use
the
old
position
just
anything,
but
the
all
the
old
position,
and
then
we
broadcast
the
arena.
A
So
game
client:
what
do
we
need
for
the
game?
Client?
Well,
we
need
all
the
rendering
and
we
need
user
input
and
we
need
server
input
and
we
don't
want
the
people
to
install
much.
So
it's
a
website
of
course.
Naturally,
it's
javascript
so
yeah.
These
are
the
three
types
of
events:
user
input,
buttons,
key
presses,
clicks
and
the
server
inputs
is
all
the
messages
they
come
over
network
and
then,
of
course,
connection
established
lost.
A
That's
really
handy.
Currently,
it's
still
a
bit
in
development
mode,
because
if
I
lose
the
connection,
there
is
a
retry
and
as
soon
as
the
client
is
able
to
connect
again,
it
will
throw
away
the
cache
and
reload
the
whole
thing,
which
is
really
great,
because
when
I
implemented
the
css
changes
for
rust
fest,
then
suddenly
it
popped
up
with
the
correct
colors
all
the
time.
People
did
not
have
to
do
anything
at
all.
So
that's
great.
A
So
how
do
we
do
that?
How
do
we
keep
the
same
infrastructure
that
we
have
on
the
server?
Also
on
the
client?
Well,
for
starters,
we
can
just
root
the
messages
so
when,
whenever
we
get
the
message
in
we
say
okay,
this
is
update
field
in
for
update
snakes.
Who
does
need
to
know
about
this,
so
we
have
the
renderer
that
needs
to
know
about
these
two
and
we
need
the
buttons
to
know
about
these.
So
the
the
player
knows:
oh
okay,
from
my
decision
to
go
right.
Now,
it's
back
to
center.
A
A
Controller
caller
a
feature
that
I
added
late
like
really
late.
It's
just
a
message:
it
updates
one
color,
but
it
also
needs
to
say
the
renderer
hey
did
you
know
that
the
player
is
now
controlling
a
different
snake,
so
you
should
mark
the
different
snake
with
a
triangle
instead
of
a
circle
like
all
the
others.
Oh
yeah,
I'm
really
bad
with
graphics.
A
So
all
the
artistic
stuff
is
basic
shapes
lines,
squares
circles
triangles
can't
be,
do
anything
same
with
pink
features
and,
of
course,
a
default
case,
erroring
the
whole
thing
and
a
catch-all
because
it's
javascript,
if
it
throws
an
exception
in
the
wrong
moment,
the
update
doesn't
work
anymore,
and
that
would
be
sad.
People
will
be
sad,
so
don't
want
that
we
rather
log
it
and
maybe
implement
some
remote
logging
in
the
future
than
having
old
clients
crash
because
of
http
caches.
A
This
is
a
little
bit
misaligned,
I'm
sorry.
It
features
a
canvas
and
some
buttons
and
down
here
we
have
the
current
stats.
That's
it.
We
don't
need
more.
A
David
asks:
is
it
being
recorded
yes,
and
if
we're
lucky
I
haven't
tested
it,
then
it
will
be
recorded
in
very
good
quality
whatever
that
is
so
all
this
effort.
Why
not
just
use
node.js
and
hack
the
thing
together
and
be
done
with
it
in
a
day?
Why
take
so
much
time?
Well,
you
can
see
the
load
here,
it's
zero
and
it's
0.1,
because
I
logged
in
and
started
top.
So
this
is
all
the
processes
that
belong
to
that
user
and
that's
it
there's
there's
basically
no
load.
A
A
Zoom
in
here
so
now
you
have
to
the
live
version,
so
we
have
a
load
of
zero
and
the
cpu
usage
was
0.3,
so
yeah
there's.
This
is
one
part
right.
This
is
the
we
don't
use
energy.
It's
fast.
We
have
super
response
times,
but
if
someone
in
the
chat
wants
to
guess
what
else
do
we
get
from
from
rust?.
A
No
guesses,
or
maybe
the
street
has
crashed.
I
don't
know
so.
The
other
thing
I
I
was
going
for
is
it
gets
quite
productive,
so
adding
new
features
like
let's
say
the
timeout
features
for
when
clients
disconnect
or
implementing
ping.
If
you
have
the
page
open
right
now,.
A
You
can
see
here
on
the
side.
Let
me
zoom
in
we
have
a
ping
feature.
This
pink
feature
is
simply
another
actor
that
will
go
in
regular
intervals.
I
think
it's
every
five
or
two
or
five
seconds
and
ping.
The
client
there's
a
ping
protocol
implemented
with
the
browsers,
and
it
will
measure
this
delay.
So
I'm
pretty
good
with
eight
milliseconds.
A
A
A
Okay,
I
see
some
people
are
playing.
A
A
A
A
So
the
admin
interface
this
one
we
can
use
the
actix
features,
so
we
can
use
async
functions
and
this
is
great,
it's
so
fast
and
it
doesn't
require
you
to
have
this
huge
manually
constructed
async
stuff.
So
first
admin
requires
a
login.
Login
page
is
similar
to
this,
and
then
we
go
to
the
arena.
The
arena
is
a
normal
actor.
Everything
in
actics
is
mostly
a
normal
actor,
so
we
send
it
a
message.
A
Let's
say:
get
arena
config.
This
is
the
same
message:
the
websocket
actor
uses
when
you
connect.
So
when
you
connect
to
the
service-
and
it
goes
to
the
area
and
say-
hey
fill
me
in
how
is
the
arena
configured
size,
flower
and
then
it
when
it
receives
that
it
will
go
to
the
rear
and
say
hey?
Can
you
assign
me
a
snake
please,
and
it
will
do
that.
A
A
Context
is
this
terra
context:
they
create
a
default
terror
context
which
is
basically
a
hashmap.
If
this
feels
a
lot
like
javascript
to
you?
Yes
very
much,
but
it
works
great.
It's
super
fast
couldn't
ask
for
more
template.
Context
is
loaded
at
start
of
the
server.
So
all
the
templates
are
in
memory
super
fast,
no
disk
access.
A
We
say
which
one
we
give
it
our
hashmap
context.
If
there
is
an
error
for
some
reason,
we
can
output
this
to
the
user,
which
is
great
for
debugging,
and
then
you
have
to
look
at
standard
out
but
yeah
for
developing
things
like
that.
This
is
just
great
and
then
we
already
have
a
string-
and
we
just
say:
okay
response
text
html
with
this
body
ship
it.
So
this
is
all
in
memory,
there's
a
little
bit
of
communication
to
an
actor
super
fast.
A
If
we
look
at
the
stats
0.2
now,
I
don't
know
how
many
people
are
running
yeah,
I'm
really
happy
with
that.
So
now
it
is
time
for
you
to
ask
questions,
and
I
will
just
put
this
into
the
side
and
yeah.
If
you
want
to
play
with
more
snakes,
we
can
absolutely
do
that.
We
can
also
increase
the
size
of
the
arena.
A
Oh,
I
forgot
to
mention
you
can
control
the
snakes
with
the
arrow
keys,
whds
and
ijkl.
A
So
treemock,
I
hope
I
pronounced
that
correct
asks
what
convinced
me
to
use
actics
over
another
ecs,
another
entity
component
system.
A
Well,
the
main
reason
for
me
was
that
I
had
one
actor
system
for
everything,
so
I
don't
have
the
actors
running
on
one
side
of
of
the
application
and
then
have
to
bridge
into
that
with
the
web
application,
and
I
just
have
messaging
that
are
from
the
same
kind,
and
I
don't
have
to
worry
about
reaching
anything
in
inside
that.
A
A
This
is
much
more
lightweight
than
what
actrix
address
is,
which
is
an
atomic
counter,
an
atomic
channel
and
a
third
thing,
which
is
basically
some
flags
telling
the
senders
of
of
these
other
things.
Hey.
This
actor
has
stopped,
meaning
you
cannot
send
new
messages
or
this
actor
has
died
even
plus.
There
is
some
reference
counting
involved
with
that
to
make
that
work
properly
so
yeah.
For
me,
that
was
the
main
reason
having
one
system
for
the
game
and
the
web
server
instead
of
two
systems.
A
I
hope
that
answers
your
question.
I
guess
if
there
are
no
further
questions,
we
can
just
continue
playing
the
game.
Also,
if
you
have
suggestions
about
the
rules
like
how
many
players
should
be
connected
to
how
many
snakes
and
all
of
that
or
how
big
the
field
should
be,
then.
B
A
So,
oh
well,
thank
you
very
much.
Thank
you,
everybody
for
attending
and
yeah.
If
you
have
any
other
questions,
you
can
message
me
on
twitter,
which
I
just
realized
didn't
include
in
the
slides.
I
will
also
publish
the
slides
soon
after
and
I
hope
to
see
you
at
rustfest.