Hey,

I'm an Akka newbie and stuck on a multiplayer game server that I want to 
use actors for concurrency. The server hosts multiple rooms which are 
enterable by players (connected over TCP).

Unfortunately, I fail at coming up with a suitable actor architecture. The 
client requires me to send player walking updates every 0.5 seconds (if 
there are any) and the Pathfinder needs to know about the current positions 
of all players in order to avoid collisions.

Pseudo-code (typical game loop attempt):

// Pseudo code
while(true) {
  for (player in room.players) {
     // Set position to tile B
     if (player.setPosition) {
       player.setPosition = false
       player.position = player.newPosition
       
       if (player.goalReached) {
         player.wantsToMove = false
       }
     }
     
     // Walk from tile A to tile B (set position on next cycle)
     if (player.wantsToMove) {
       var nextStep = Pathfinder.getNextStep(player.position, 
player.goalPosition)
       
       player.walkAnimation(player.currentPosition, nextStep)
       
       player.newPosition = nextStep
       player.setPosition = true
     }
  }
  
  Thread.sleep(500)
}

(https://gist.github.com/SteveWinfield/ce061f9c75bd502a01dacc995de19eb2)

I want everything to be synchronized (The Pathfinder needs to know about 
non-walkable positions) and I'd like to use actors. Maybe you got a 
solution to my issue. I wasn't able to find any resources explaining this 
(probably I'm just too dumb), so I would really appreciate if you help me.

Cheers,
Steve Winfield

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to