WebSocket communication, the server controls your player

These days I’ve been setting up and adding new features to my prototypePacman game. I wanted to be able to connect the front-end side with a server in real time and a bidirectional way. Since the main purpose we’re seeking (Sai Hei and me) is to teach the player to play by itself and all the AI learning logic would happen in the server side, we’ve found by using WebSockets could make it real.


So I created a python WebSocket server:

  • It will establish a socket connection
  • It will send a random direction [‘up’, ‘down’, ‘left’, ‘right’] to the client every 500ms.

The game (front-end side):

  • It will try to engage in the socket connection
  • Process messages and move the player toward the direction received.
  • At the same time it will send the game state (board state, ghosts and player position), data that will be process for the AI purposes.

This is just the beginning, we just have the player controlled by the server in a dumb random behavior but we are all set to start teaching some new moves.

Changing the subject…Thursday presentations were really interesting: HTTP Mocking importance, Zero Knowledge Proof for sudoku, melody generator, inertial controlling in js, simple RxJS paint app, Spacemacs, RC Pseudonym finder, AVL trees, a hat and Arduino, RC CSS tags, neural network viz and a novel generated by a PNG image

Some useful links I’ve found today: