Press "Enter" to skip to content

Understanding evolution with neural networks using Pixling


good Monday morning we have something as
unusual as a real-life person in flesh
and in the studio today
this is my friend nor we have been
friends for a long time we worked at
Spotify during the same period so we’re
like same Spotify generation we started
at sort at the same time and we quit it
sort of at the same time and yeah you’re
here to show me it show us a project
called pick sling that’s correct
whoa check it out my hair is different
and call it like it’s mpj from the
future I have come traveling from the
land of post-production to inform you
that today’s video is sponsored by
Coursera Thank You Coursera Coursera
partners with top universities and
industry leaders such as Japan Imperial
College London Google and IBM to provide
the world’s best online education
experience they have over 3,000 courses
in subjects such as data science
business blockchain you name it either
go for a single course or an entire
master’s degree its 100% aligned and
very affordable go check him out at
coursera.org after the show that link is
also in the episode description that’s
our sponsor Coursera thank you now let’s
get on with the show so for the past few
months I’ve been working on a new
product of mine and it’s all about
evolution and artificial life and it’s
called
fixing world yeah so what is it what is
fix lingual okay so briefly we clean
world is what I call an evolution
simulator so I got interested into
evolution and then as I was reading
about evolution I also got curious is it
possible to actually simulate evolution
in a computer as well so in pixon world
what you do is that you create worlds
alright show an example of a world sure
so we have something here yeah and this
is actually completely blank right now
but what we can do is that we can create
one little big thing in this world all
right
and here we go is all right so all right
so it can move around and stuff so it’s
this like what is in machine learning
and AI is this like your name for an
agent yeah so this guy is what we in
machine learning we call this an agent
and it’s one you think of it as an
animal or something with a little brain
and the way this works is that this is a
world that I already created before but
now Ria’s can demonstrate that to have
something to play around with yeah well
one by the way this is web-based right
so we are gonna like the URLs here and
to these specific words we’re gonna link
them in the episode description so that
you can click on them and play around
with them as we go along yeah
so this guy is called the pick sling he
has got a little brain which is a neural
network and what he can do is that he
can actually away so every new every
picks link contains a neural network
that’s great we can create another fix
thing here and this guy has got also a
neural network for brain but his neural
network is different from the first guy
that we created oh so they like have a
little random seed that it makes oh
that’s amazing and their behavior is
completely controlled by this neural
network and the way it works is that
they take inputs from the surrounding
it’s kind of like they have eyes and
they see everything around them and then
they use that process it through the
neural network and outcomes their
decisions so they might decide to move
they might decide to do something fight
something yeah take a directions
yeah so there’s no code determining like
which direction these big things are
moving that’s yes the exact neural
network exciting things but the cool
thing here is that okay so we have these
neural networks that completely when you
start out they’re completely random yeah
which means that picks links behaviors
are completely random yeah but what
happens is that they can also reproduce
and when they do the neural network
changes ever so slightly which means
that the little baby picks Ling child
his behaviors ever so slightly different
and if that behavior is good or
beneficial in the urban environment he
might have more children in his turn and
he’s going to
and spread and spread okay so are we
gonna try that now or do you enjoy sure
yeah let’s do it all right how do I do
this
yeah go ahead and you can use little
spawn button up there oh this one oh
okay so can I click more go for it oh so
it’s like it is like kind of like a pig
painting tool exactly so you can so you
can paint as many as you like
all right now they are just moving
around yeah and actually what you can do
is that you can increase the speed a
little bit you can take it all the way
off to hyper and you can paint a lot
more of them just go for it just go
crazy actually what you can do is that
you can change the you see the radius
down here yeah
changed it to maybe 100 all right oh I
think it’s not selected Oh 100 perfect
and now I mean like people zoom out a
bit zoom out a bit and then we’re gonna
paint it like oh my god
Jesus Christ if you click the selection
down here they get rid of the selections
all right so this is this is what
happened with God create like yes Oh God
there was not supposed to be this big
and I never managed it so now we have a
lot of pics links and a lot of them are
going to do like their babies are gonna
be completely uninteresting but we’re
gonna see here that some of them are
actually fighting each other and they’re
gonna take over more and more this is
like I hate to do a Segway
but like this is so fast yeah and it’s
web-based how did you do this like these
are how many pics links you can hit this
little graph up here the graph yeah so
these are 11,000 yeah and I think if we
would go crazy in this world who would
get something like if you do like this
yeah go for it just to fill the screen
it’s something like a 300,000 pics
things in this way oh wow doc this is
kind of possibly a bit of JavaScript
yeah so the way it works is that it
actually runs on the GPU through WebGL
yeah tensorflow does that as well
exactly yeah and the reason you want to
do it like the reason it can be so fast
is because the GPU is built really for
parallel processing all right so every
single pixel or every single cell in
this world yeah it’s being computed
independently so all of them being run
at the same time and that means that you
can have these massive massive
simulations and now we can actually see
some of these pics things starting to
have some behaviors yeah that are
different and oh yeah so now we see like
there are different colors I’m not sure
if you’re gonna zoom in a little yeah
and some of them are starting to spread
here and it’s because those guys like
their ancestor he was a little bit
better at fighting and taking route the
pixels and then he spreads more and more
and then now he’s starting to take over
the world
all right oh this is so cool yeah so we
can see the colors here that this is
like a one breed of pick sling exactly
the different colors signify their
species yeah there’s a very big stable
one here a green one yeah I’m not sure
what they are really up to you can
actually increase the speed even to
extreme up there all right what oh I
think okay okay I’m the worst like I’m
the worst at typing and I’m also the
worst at zooming okay here we go
I think the green one is still like
seems to be more effective anyway like
they seem John yeah and the cool thing
here is that you never know exactly what
to expect in synthesis this is actually
real Darwinian evolution there are no
rules there’s no goal for them really to
accomplish so you can actually restart
the simulation and get a completely
different outcome
that is so cool and we can actually do
that if you hit the reset button up here
yeah and then you can use the spawn tool
and then you can just click a few times
bit here and there yeah if you see that
this is this is going to turn out
slightly different there’s like it’s
different species doing something
different here yeah and this is not due
to me painting and placing them
differently even though that is
like effects it but if I if I read you
correctly like even if I painted it
exactly the same yeah it would still be
completely different because the random
seeds for each big sling the exactly and
we should probably not go into all of
case there in all this but do you you
probably heard about the butterfly
effect and these things where you can
have small variations in the beginning
can have huge effects on their end
result yeah so you never really really
know what to expect when you run even
the exact same zoom simulation many
times can we like so we’re gonna go into
like creating one of these from scratch
right the other bit but before we do
like can you talk a little bit what why
did you make this like I mean I mean
it’s cool but but why though yeah I I
get that question a lot
Sharon what are you doing for the yeah
no I think the honest answer is that I
was just fascinated like I just started
out thinking like oh I wonder how this
would work yeah started building in one
end and then it just fascinated me so
much that I kept building and in
beginning I was actually not even
running this on the GP was I was running
it in JavaScript and then one day I had
the idea of like oh maybe what if I run
this on a GPU maybe it would be a lot
faster yeah I had to try it and then I
was blown away by how how fast the
simulation could be and how how
interesting their cells could be so I
used to had to keep building and
building on it just there’s no I don’t
have like a grand plan for this or
anything I’m used very fascinated by
these picks things and what they can do
with themselves I think it’s also
important to like stress here like your
background
I mean you are definitely a very good
programmer but you’re not like some kind
of AI genius like you’re you do not have
like a formal education in AI or
something like that you are game
development I game development as part
of my background and some we worked on
front-end development together so yeah I
mean what I know about AI is mostly a
self-taught
yeah and it’s in just pretty recent
years right sure yeah Julianna Roo
what’s his name and yeah its courses and
yeah yeah sure just I mean there’s so
much good material online as well to
learn so much about a fast idea is a
great resource to learn about AI as a
programmer but yeah maybe we should jump
into actually seeing how this can be
built because yeah what do you do as a
player is that you define these worlds
right so maybe we can show how to
actually yeah actually because this to
me seems a little bit unapproachable I
mean I don’t know how any of this works
I get like the general idea but like how
is it built I can create my own pickling
world yeah that’s like the basics let’s
get into it is actually super simple so
let’s let’s actually jump back to the
main screen here you can click the home
button right yeah leave it and we can go
and here we go so the way it works would
be some words that you always start with
a completely blank slate it’s like it’s
like you know God at the first day of
creation there’s nothing there’s just
yeah you know like that time you were
going yeah no no you can be for a few
minutes here so there’s nothing decided
for your up front the first thing you
can do is that you can create an actual
picks thing all right so that’s up over
here on the right yeah you can give him
a name kids yeah oh I gave in a hat okay
okay you have a very limited set of hat
options yeah but yeah I guess this hat
what speed is that movement speed
exactly so they can have a different
movement speed or even knows no movement
speed at all if you want difference is a
plant or something right so and it has
abilities and some properties right so
what are abilities so right now we
haven’t built an abilities but abilities
are kind of like if you imagine a game
like Diablo or Starcraft oh okay yeah so
your units in these games they will have
different abilities they might have an
ability
to heal other units maybe they have
never built it to put a trap on the
ground or always ik ones like attack
attack you know these things and in
picks in world you define all these
abilities yourself the picks things they
decide when to use them they are like
the players in your game but now I’m the
game for them yeah okay so so right now
we don’t actually have any abilities for
them but you can even even with this you
can go ahead and hit update all right
they can I’ve had it down here and then
create the picks thing and you’re gonna
see that even if we even got a paint a
few plugins perfect so even these guys
they don’t have anything they can do so
they’re super boring thing yeah they
just move around and kind of do nothing
yeah so they have each have like the Hat
I chose but they have different colors
indicating like this is generated from
their bridges so that I can or exactly
you can keep track of them and if one of
them good we’re gonna add an ability for
them to reproduce let’s read the correct
word is a generator what it’s called
yeah sorry
continue if you know comments yeah I
think maybe we need a new terminology
for virtual life and yeah we might have
to invent something but we can go ahead
and actually creates some villages for
them so we can see yeah because they’re
so boring if they don’t have anything
they can do it they can only move around
right now yes true so let’s jump into
the edit mode again abilities I saw that
over here yeah let’s jump into it and
then you can create a new one okay come
here
and let’s make an ability for them to
kill each other because we feel like
being mean today I don’t kill things so
of course like death is death is part of
life all right so I don’t like guess I
pick something like okay I pick up an
axe perfect ax murdering pig sings let’s
do it
color screw that and then I suppose I
click here and create an action yes what
happens okay actions reproduce we don’t
want that so I figure I kill kill kill
focus you bought it focus pics link yep
what does what does focus mean is that
is
that they just sort of like how they
randomly walk around I guess sometime I
said they randomly walk around like
focusing yes that’s that’s kind of right
so you know how we might only be able to
like focus on very few things like we
can’t focus on everything at the same
time
the Picts thing is kind of the same that
they have to choose one thing in the
world to focus on and then they can
interact with that thing through our
abilities and in this case they choose
to focus on if they choose to focus on
one guy and then use disability that
you’re building then that’s gonna kill
that big thing that they’re focusing on
okay and you can even also give the
ability a name if you like oh kill them
all
perfect Oh excellently under the mother
one here can I move on you can right
click on the little box there and delete
all right perfect
so let’s try this one out but before we
do actually let’s create one more
ability so that they have a choice no
choice right all right I come back to
choice later let’s create the ability
face isn’t it fascinating with choice
for a virtual yes they’re gonna have to
like it’s very like this is the very
like what is very different from machine
learning programming and AI it’s like
well if my code has a choice what I mean
what do you mean okay
we are yeah we’re getting deep into
philosophy very quickly so I think for
this one we’re actually not gonna give
him any actions at all this is gonna be
his sleep action and he’s just gonna
yeah like you actually don’t even need
anything here oh yeah Gwen oh yeah
please you can give him an image mm okay
sleeping or to go like sleep perfect
okay and now let’s hit update
I see if we can actually use this so
these guys won’t have these abilities as
you already created them but if you put
a bunch of new ones then they are Wanaka
it’s pretty cool that you can change the
world while it’s
while it’s running yeah thanks that it’s
a nice picture so we can see now that
some of these guys look a bit different
yeah over here
maybe swimming on these guys you can see
that some of them are actually sleeping
yeah some of them are out X murdering
other pics things and that’s because of
their choices it’s just this bizarre
thing that you can zoom in and out to
this insane okay yes the GPU
acceleration is so cool yeah it’s pretty
amazing and actually so one tiny detail
two people are interested in this stuff
each of them are rendered with like one
court should have two triangles night
and since you can run up to like you
know a million of them you’re painting a
million well two million triangles on
your screen and the GPU is not even it
doesn’t even care I mean of course if
you’re into games you know that like
modern games to have trillions or not
trillions but millions of triangles on
the screen at the same time so it’s it
always blows me away the power of deep
use it’s yeah it’s so cool but it’s so
it’s when like but the thing that it’s
controlling the WebGL is still like
JavaScript exactly that’s all actually
it’s it’s typescript compiled to
JavaScript so nice but yeah like they’re
still not that interesting I’d say like
they can kill each other now actually if
you spawn a few more we might be able to
see one of them kill another one it
might be yeah I think we’ve already seen
that yeah when you see if you want with
the few ones with the crossed out eyes
and it’s kind of when they get here are
there some there’s all that yeah but we
can go ahead and make this a bit more
interesting because now they cannot
reproduce there’s no way from two to
spread and light it’s no bigger they
would just rather be walk around
anything yeah so let’s add that as well
let’s open up the ability editor again
oh that was wrong no erect oh and that’s
going to the kill they’re all killed oh
oh yeah so we’re gonna change this a
little bit now cool so we’re gonna
change this kill focus pixel into an if
statement oh there’s all right we got
and then we’re gonna add a condition
which is the first row where yeah and
we’re gonna make that into focus picks
thing is alive and I’m going to add
another condition yeah go ahead and that
and that’s gonna be can reproduce
alright and then we’re gonna add two
actions to this oh that’s not 100 do it
this well then I could then run Oh Dan
run alright there we go so we want to
keep this one you want to keep reproduce
that’s it
and then one more and this one is gonna
be the kill focused pickling alright so
basically poops out a new pickling and
then kills one that’s great
so essentially like animals do in nature
this is so up animals is
essentially if they have if they have
the ability to kill someone if they have
if they’re in position to kill somewhere
and if they can reproduce they will kill
that guy and then reproduce not reading
a new copy of themselves all right so
I’ll update and let’s see this and uh
you would so you might have to spawn
like a bunch of them maybe alright I’ll
increase the radius a little bit paint a
little bit whoa and then we increase the
it seems like I see more green happening
here I’m gonna zoom in a little bit
I think there’s a couple of yellow ones
there it’s a little bit slow you can
actually spawn a bunch more and then we
can see if something happens so since
its evolution you never know exactly
what to expect
yeah I guess that is like from sometimes
you just need to like do a lot it’s it’s
kind of like I guess that how is out the
universe works like life is requires
like really dumb luck to be able to
arise and that means that you have to
like the universe has to be very very
large in order for there to be life yeah
exactly I mean this was probably our
life started and long time to earth that
a bunch of random stuff happened and
some of it was like oh here’s something
that works yeah
and now we can actually see that at the
edges here there are pixels that are
starting to eat their way in to this so
they are actually they have some kind of
behavior that is beneficial to them and
enables them to spread but yeah it’s
gonna talk a little bit while we like
let me go back here and like because the
abilities are celibate okay this is
picturing sooo like right yeah so to me
this is really really little bit weird
so there’s actions and it has if all the
following conditions are true focus
pickling is active can reproduce and
then it does the things so it seems to
me you like there’s an it should be
doing this all the time but it doesn’t
right because there’s kind of like an
extra if statement outside of it which
run the pics link decides itself right
right so so it it it has chosen between
kill killed it all and I’m sleep right
alright so that’s this this is where the
choice part comes in so they don’t they
don’t have a choice of what happens when
they use an ability now but they do have
a choice of when to use it so it’s kind
of like if you are playing Diablo yeah
you can choose between casting the heal
you can choose between using the attack
you can’t choose what happens when you
use the ability yeah but you can choose
when to use it
and that’s the same thing with them that
they can choose yeah it’s like humans
are like we have we can use our
different like body extremities to do
things but we can magically make them do
yeah that we can fly we can’t yeah we
can’t bend our arms in any way another
way to think of this is there are
sometimes described it as is an inverse
game where you kind of you build a game
for these creatures and then they play
your game so it’s like you could
actually build something like you know
doctor or something in this and then
they would play each other in the game
but yeah so yeah I think it’s like an
inverse thing right awesome yeah I love
it alright so yeah and we can make mist
yeah go crazy so we’ll just see here
that okay the pink ones are like really
amazing at this
they seem to be the dominant species
here yeah so the way like this is an
interesting thing because without
guessing how this would play out and I
if I guessed how this would play out I
would probably not guess that one
species would be completely dominant it
sounds like maybe it should be like sort
of I know the way nature works seems to
be like there’s not one species that
tend to dominate everything it seems to
be like they’re just like oh there’s
Amazon and Google and Facebook and they
just like like kind of seem to stabilize
in some battle with each other but here
like one just eats everything
I’d say that in this particular
simulation that happens but I’ve also
seen other simulations where there are
actually stable you know species that
compete against each other and even in
this one like it seems like in this one
they’re actually all gonna kill each
other in them because I’m becoming fewer
and fewer but if we have a more stable
simulation where they the numbers kept
the same then you might see these pink
ones split into two different subspecies
yeah that maybe specialize in different
ways and or maybe collaborate in
different ways you one friend had a
species that was feeding and other
species and keeping them alive and then
having this symbiotic relationship so
you can you can have a lot of crazy
crazy stuff with this awesome yes it’s
so cool we’re gonna so this is a simple
example we’re gonna do more common gonna
do one more episode after this one
that’s gonna be released a week after
this where we do some more more advanced
stuff but this one and the world that we
looked at before will be linked in the
episode description so that you can you
can check them out in the meantime and
if you do anything like this these posts
post them in the comments and tell us a
little bit about them because we would
really like to know what you what you do
with it
boom mpj here from the future reminding
you to check out
Coursera at coursera.org our fine
sponsor of this show thank you Coursera
this has been an episode of fun fun
function in case you’re new I
this every Monday morning Oh 800 GMT you
will forget that no so you can subscribe
by clicking here or check out another
episode right now by clicking here
I am mpj Frederic Nora and until next
Monday morning stay curious cool
Please follow and like us: