How to efficiently keep frontend and backend data in sync for a browser-based MMORPG?

Hey everyone, I’m working on a browser-based MMORPG and I’m stuck on how to keep the frontend and backend data in sync efficiently. Right now, we’re using JavaScript to store user data like cash and level on the client side. The tricky part is that this data can change not just from the user’s actions, but also from other players’ actions (like during a fight).

We’ve tried two approaches so far:

  1. Making an AJAX call every time the user does anything (like clicking a tab or buying something).
  2. Using a proxy to check if the data has changed before making the AJAX call.

The problem is, both ways result in a ton of unnecessary AJAX calls. With the first method, about 70% of the calls are useless. The second method cuts down on database queries, but we still have way too many AJAX calls.

Does anyone have ideas on how we could improve this? I’m looking for a way to keep the data synced without hammering our server with requests. Any suggestions would be super helpful!

For a browser-based MMORPG, efficient data synchronization is crucial. Have you explored implementing a delta-based approach? This method involves sending only the changes (deltas) between the client and server states, significantly reducing data transfer. Combining this with websockets for real-time communication could greatly improve efficiency. Additionally, consider implementing a local cache on the client-side to store frequently accessed data, reducing the need for constant server queries. Periodic full state synchronization can help ensure long-term consistency. What’s your current server infrastructure like? Understanding your backend setup could help in tailoring a more specific solution to your synchronization challenges.

yo, websockets r def the way to go here. they’ll cut down on those pesky ajax calls big time. u could also try implementing a delta system, only sendin changes instead of full data. maybe look into optimistic UI updates too? keeps things snappy for users. what kinda server setup u runnin?

have u considered websockets? they could b a game-changer for real-time sync. less overhead than ajax and allows server to push updates. what about caching strategies or batching updates? curious how often ur data actually changes. maybe a hybrid approach cud work? what’s ur current server architecture like?