[erlang-questions] game engines?

Lutz Behnke lutz.behnke@REDACTED
Mon Sep 19 20:49:37 CEST 2016


Am 19.09.2016 um 17:55 schrieb Miles Fidelman:
> Thanks to all for your responses.
>
> Re. a couple of points here, might I ask a few follow-up questions:

First of: I hold the points of the previous reply by Michael Truog to be 
valid and wish I had made them to start with.

I found that one process per client connection (PCs and NPCs alike) is 
insufficient to cleanly separate concerns. The improved version I am 
currently working on, has around 2-3 procs per connection. In addition, 
there is a large proc set that handles space partitions, regardless of 
the number of objects or entities that exist within these partitions.

>
>
> On 9/18/16 1:37 PM, Lutz Behnke wrote:
>
>> Hello,
>>
>> assigning each object in the game gets difficult for a number of
>> reasons, when trying to do this for an MMO, especially MMORPGs
>> (characterized by a very large number of objects, and active entities):
>>
>> You waste resources (CPU, RAM) when an object is currently not being
>> referenced by an active entity (e.g. a client connection, thus and
>> avatar or alternatively a Mob/NPC), since there is no other process
>> that will send any messages.
>
> Well yes, but is that not where Erlang shines - being able to maintain
> huge numbers of processes (or, in this case, little state machines)?

Yes, compared to the next point, this is a minor one, but each process 
will consume space. Especially if your objects have large amounts of 
state. It is not a limitation of Erlang. You are likely to run out of 
hardware memory before you run out of concurrent processes (you may have 
to twiddle with +P, though). Please see my assumption of "every object" 
below.
>
>>
>> More importantly, should you scale your engine to multiple hosts, you
>> either have to enforce a single process, requiring all updates and
>> query messages to be routed to this proc. Or you will have to build
>> some master/slave or peer to peer logic, which will ensure consistency
>> in the face of CAP.
>
> I'm actually thinking about military simulation - where the model is
> essentially:
>
> - every simulator (e.g., a flight sim, or a tank) is running on its own
> machine, complete with local world model and image generation (necessary
> to keep up with jitter-free image generation during high-g turns - you
> don't want pilots to puke all over the simulators)
>
> - there's a lot of dead reckoning going on locally - the only things
> that cross the network are deltas and events, generally sent by multicast
>
> - everything is synchronized by GPS time-stamp

For this specific model (a federation of simulators) your approach is 
definitely the one I would use. You can trust the local simulators to 
enforce rules/physics and only need a blackboard to exchange state 
values, maybe provide a visibility/ Area-of-Interest-Management (AoIM). 
The applicable standard, High Level Architecture (HLA), uses exactly 
this modell. But you will have to trust the clients. Traditionally you 
will not have more than a few thousand entities, all of them active by 
themselves (entities/active objects vs. plain objects like a rock or a 
bag of treasure). I would think it unlikely that you need to have more 
than one game server/blackboard though.

You will probably have to do some state merging logic to recover from 
lost updates, network partition, node fault or similar things.

Also, IP multicast basically doesn't work for private end customers, but 
is IIRC quite common in military simulations.

MMORPGs will usually have a much higher number of active objects (aka 
players), although they are traditionally split into shards and zones, 
so that only a small percentage can actually interact with each other. 
But the main difference is that avatars often are composite objects: The 
actual person plus all its equipment and things it caries around or even 
posses in a bank or such. And as each of these passive objects can have 
it own state, merging it all into the state of the avatar may be 
possible, but certainly very un-Erlangish (IMHO).

[..]
>
> Any chance of arranging a copy that's not behind a paywall?

Argll.. sorry: 
http://users.informatik.haw-hamburg.de/~ubicomp/arbeiten/papers/MMVE-14.pdf
(and please don't mind the worst-case absolute latencies. The point was 
to establish the better than O(n^2) complexity of a large server count, 
not an high performance implementation ;-) )

mfg lutz
>
>
> Thanks,
>
> Miles
>
>
>>
>> mfg lutz
>>
>> Am 18.09.2016 um 04:11 schrieb Miles Fidelman:
>>> Hi Folks,
>>>
>>> I'm curious, has anybody written an Erlang-based game engine that
>>> implements a process per game entity?
>>>
>>> I've been been finding various examples of Erlang being used to manage
>>> user sessions, and other aspects of MMORPGs - but nothing that simply
>>> does the obvious - treating each object, player, etc. as an Erlang
>>> process.
>>>
>>> Am I missing something?
>>>
>>> Thanks,
>>>
>>> Miles Fidelman
>>>
>>>
>>
>>
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>


-- 
Lutz Behnke
Hochschule für Angewandte Wissenschaften Hamburg,
Labor für Allgemeine Informatik,

phone: +49 40 42875-8156    mailto:lutz.behnke@REDACTED
fax  : +49 40 2803770       http://users.informatik.haw-hamburg.de/~sage
Berliner Tor 7, 20099 Hamburg, Germany

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5006 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160919/2c744085/attachment.bin>


More information about the erlang-questions mailing list