Up to Main Index                          Up to Journal for December, 2012

                     JOURNAL FOR FRIDAY 14TH DECEMBER, 2012
______________________________________________________________________________

SUBJECT: Feeling lonely in a crowd
   DATE: Fri Dec 14 22:53:40 GMT 2012

So I've been thinking about the performance issues associated with a large
number of players. I have a possible solution - explained in a minute - that
seems to work. On my dev box - Core i7 860 - I've managed to push things to
20,254 simulated players at once and everything is very playable. A couple of
lines from the server log:


  A[  35Mb  -434kb] HO[    536853   -14909] GO[ 20260   +0] PL 20254/20254
  A[  36Mb   +76kb] HO[    537154     +301] GO[ 20260   +0] PL 20254/20254
  A[  36Mb   +41kb] HO[    536882     -272] GO[ 20260   +0] PL 20254/20254


Not bad eh? 20,000+ players in only 35-36Mb? Well that's not quite the whole
picture. I was running the server and robots on the same box. So thats 20,000+
sockets. Each end of the socket has a read and write buffer. There are two
ends to each socket - server and client.

The network buffers to run this test used about 643Mb, half that being for the
server - ouch. As the client and server are on the same machine I think there
is some optimisation going on here and maybe some buffers are being shared.
These figures are slightly skewed due to using shared libraries - libc and
libpthread - even though Go programs are statically compiled.

Enough pontificating! What did I do to achieve this? I implemented crowds.

My thinking is that with a lot of people in a room we have a crowd. If there
is a crowd you are not likely to see someone enter or leave due to everyone
milling around.

So if we are in a crowded location and leave we don't send 'You see %s go %s.'
messages. If we enter a crowded location we don't send 'You see %s enter.'
messages. We also drop 'There is a puff of smoke and %s appears spluttering
and coughing' in a crowded starting location. Also when describing a crowded
location instead of listing everyone present with a 'You can see
%s here.' line each we just say "You can see a crowd here."

I still need to clean up these changes as they are hacks at the moment but
as soon as I do I'll push them out for people to play with.

Crowds also raise a lot of issues. For example how to handle other actions
that occur in a crowd. Do you still things being picked up or dropped? Mybe
you just see 'someone' get or drop something and are not sure who? Maybe it
depends on how 'big' the event is. You might not notice someone enter or leave
but you would notice a big explosion in the middle of a crowd. You would also
notice a giant ogre not matter how big the crowd was - unless it was a crowd
of ogres. So many more questions and opportunities *sigh*

--
Diddymus


  Up to Main Index                          Up to Journal for December, 2012