Inspiration

Real-time PvP games often suffer from lag while waiting for responses from the server.We realized that in multiplayer games involving strategy, movement can be predicted with an LSTM neural network.

What it does

A neural network predicts the position of objects to counter lag. We demonstrated this concept by creating a web game that communicated with the server every 0.75 seconds. At the click of a button, the 0.75-second interval is filled with the predicted movement, and the lag vanishes.

How we built it

The game itself is a simple html5 canvas game powered by vanilla javascript and vue.js. The multiplayer functionality was implemented using node.js and various libraries. We deployed the game locally using ngrok and logged player coordinates at set intervals while playing the game in order to create a sufficient amount of data. We then used neataptic to create an LSTM network and trained it with our playing data. Finally, we implemented the neural network to the client side and got rid of the lag.

Challenges we ran into

  • Sending the neural network to clients.
  • Communication between different parts of the application while lag existed.
  • Making the page responsive in a satisfactory manner (bootstrap's dynamic sizing was not to our satisfaction)
  • We were planning to use Keras.js to train the network in python and send the trained model to the browsers, but we ran into trouble and had to switch libraries.

Accomplishments that we're proud of

  • Finishing the Keras model
  • The socket programming for real-time multiplayer interaction
  • User interface design

What we learned

  • More about machine learning
  • Manual implementation of sockets

What's next for Lagacetamol

Attempt to apply a similar LSTM architecture to different, more complex real-time multiplayer games.

Built With

Share this project:
×

Updates