Node backend for android app

In games like Clash of Clans, there is countdown for updates but they are scheduled and verified on the server

I want to use node as a back-end for game how can i implement something like that?

What do you.mean by updates? As in game updates, or do mean the base/unit upgrades?

base/unit updates
like when you upgraded some building it says it will be completed in 2 minutes but its validated on server how can implement something like that

CoC has an advantage in that the game isn’t really real-time, which makes this whole thing easier: basically the time is client-side. I think CoC uses a persistent websocket connection, so as long as you’re connected any possible clock drift can be adjusted. But the client-side can rely on the system clock adjusting to remain very accurate.

Definitely read this:

Because CoC isn’t really real-time (apart from the chat, which is basically completely seperate), and (again, afaik) relies on a persistent connection being open, keeping the definitive copy of the game state on the server and then syncing it with the client is going to be relatively simple compared to needing physics synced or whatever – it can basically be one player at a time, and slight lags aren’t really going to be noticeable. The articles linked above do have a focus on realtime physics, so some of the situations are a bit more complex

Note I’m saying simple, but that’s relative, it’s likely to be complicated, just that if you.wamt something to work the same way you can probably take a lot of shortcuts and players won’t notice.

1 Like

If you trust the client to keep any state, they can always forge it. It’s just a matter of how much of a bother to do so, but you can’t make it impossible.

For instance, Diablo 1 kept state on the clients, and when it went online on, cheating was rampant. Blizzard learned their lesson, and Diablo 2 put damn near everything on the server for multiplayer; the client always synced to the server state. Stuff like item duping was still possible by way of exploiting server bugs, but most other cheats disappeared.

Never trust the client with anything actually important.


Yeah, I should’ve emphasised that. It’s critical that in CoC players can’t cheat; it needs to work a specific way to generate [lots and lots and lots of] cash, it’s very stringent. There aren’t, as far as I know, any exploits possible, and they’ve done that afaics by making the sync mechanisms pretty simple (which is helpful to know if building a game like CoC – players will happily put up with it if it ensures no cheating)

1 Like

My guess is CoC does nothing but record what you tapped on at what time, and does everything on the server from there. Reconstructed from those tap events via event sourcing if they’re smart. The client is just showing what the server tells it to.

1 Like

Thank you for the resource

I think you’re right i will try to do like that