[erlang-questions] Good architecture principals

Torben Hoffmann <>
Fri Apr 11 21:06:44 CEST 2008


Maybe one of these can give you some ideas:

   -
   http://osmirrors.cerias.purdue.edu/pub/FreeBSD/ports/local-distfiles/o1441144lgeni/master_thesis_patterns.pdf
   - http://www.diit.unict.it/users/csanto/exat/whats.html

Cheers,
Torben

2008/4/11 Colin Z <>:

> As an exercise, I'm working on putting together a simple physics and
> collision detection library for a video game and I'm looking for some advice
> on good Erlang architecture.
>
> Right now I have the concept of a cell which uses gen_event and acts as a
> sort of hub for physics processes to communicate.
>
>  A physics process is spawned with a cell PID to talk to and uses
> timer:send_interval to send itself update messages at a certain resolution
> (ie: every 33ms for a 30 frames per second simulation). When it gets an
> update message, it applies physics calculations to get its new position and
> then sends a {moved, self(), NewPosition} message to the cell which uses
> gen_event to notify all the other interested physics processes.
>
> When a physics process gets a "moved" message, it can compare the
> EntityPosition with its own position to see if a collision has occurred and
> act accordingly.
>
> How is something like this usually handled in Erlang?
>
> Given that a simulation might have thousands of physics processes, is it
> bad that I'm using a timer for each one? Would it be better to have a single
> process with a single timer and a list of physics records to partition and
> update?
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080411/ec373f05/attachment.html>


More information about the erlang-questions mailing list