Skip to content
clonejo edited this page Mar 13, 2012 · 5 revisions

This is not a final state, but a merely a proposal.

aimed structure

processes

  • one process listening for new connections
  • per client:
    • one process for receiving packets, notifies chunk and entity manager of position updates
  • one process for managing chunks
    • knows which chunks each client has loaded
    • sends chunks to client / unloads chunks from client according to position updates
  • one process for managing entities
    • knows which entities each client has loaded
    • informs clients about entities near, unloads entities from clients if necessary, according to position updates

public/protected tables

  • ets table for storing a list of clients (player name, receiving process id, socket for sending packets)

widely accessed data

  • chunks
  • socket ids to send packets to a client from any process
  • player list

processes

  • one process enough for several points?

per client:

  • receive packets
  • send packets (needed? is gen_tcp:send/2 an atomic operation?)

per map area:

  • entity simulation -> players, animals, mobs, pickups
    • split up because of different sight ranges?
  • send chunks to clients when necessary

Clone this wiki locally