Server Authoritative Real Time Fights like COClans with Smartfoxserver?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Zenith
Posts: 13
Joined: 09 Oct 2017, 09:57

Server Authoritative Real Time Fights like COClans with Smartfoxserver?

Postby Zenith » 10 Oct 2017, 21:12

Hey ,
I am very sorry if this is unrelated and does not concern SFS anyway, but I had a thought since you people are more into authoritative server side so better to ask!

So as we know in clash of clans the battles in on cities are single player (Only attacker can attack and defender just has his buildings/towers firing).
I wished to know how can that thing be made cheat proof?

Do we need a headless server running on our end and just send the commands to the player attacking ?
Or if we get the player to send us updates like every 100ms and check those against some rules this can be done?

or it can be done both ways ? Assume there are 100 players in my game and 95 are trying to cheat so I need it to be cheat proof!
User avatar
Lapo
Site Admin
Posts: 19676
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Server Authoritative Real Time Fights like COClans with Smartfoxserver?

Postby Lapo » 11 Oct 2017, 07:31

Hi,
sorry I am not very familiar with Clash of Clans. I know what it is but never played it :D
I am not sure I fully understand the use case. If the battles are single player I'd expect there would be little to no interaction with the server side... but maybe I am misunderstand.

Can you clarify how these battles work?

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Zenith
Posts: 13
Joined: 09 Oct 2017, 09:57

Re: Server Authoritative Real Time Fights like COClans with Smartfoxserver?

Postby Zenith » 11 Oct 2017, 08:53

Lapo wrote:Hi,
sorry I am not very familiar with Clash of Clans. I know what it is but never played it :D
I am not sure I fully understand the use case. If the battles are single player I'd expect there would be little to no interaction with the server side... but maybe I am misunderstand.

Can you clarify how these battles work?

Cheers


Yea I will explain.

Imagine fight between two players "John" and "Ryan".
John has since 1 month built his base with towers etc protecting it from all sides. Think of it like a tower defense game , with towers that can be placed anywhere on map protecting the center most part of map.

Now when Ryan wants to attack John , then John's map is loaded on his screen and he can click to instantiate his armies (soldiers, cavalry) which will enter from corners of map. The towers will attack these units and units will move to attack towers or attack on the center buildings depending on their AI . To note John can do nothing in this whole attack time apart from seeing his town being destroyed in a replay or live.

So at time of attack its only Ryan and the loaded map of John's city.
Just 30 seconds of this video at time 1:45 will give you complete view of how this works.
https://www.youtube.com/watch?v=96jOUA9jtHE

I want to know how can we make this server authoritative?
User avatar
Lapo
Site Admin
Posts: 19676
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Server Authoritative Real Time Fights like COClans with Smartfoxserver?

Postby Lapo » 11 Oct 2017, 15:38

Ok, thanks. Very clear now :)
Indeed this is a bit of different kind of multiplayer. Still turn based, some called it "deferred turn based" .

I think it's a good example of server authoritative, in the sense that the attacker the "battle simulation" should run on the server side so that no one can cheat.
How to do it, it depends on several factors but here's a general idea: the game map should be stored on the server side in some format so that the server can then validate the client requests.

For instance Ryan sends soldiers to attack the north tower. The client will send a command that contains something like this:
itemID = a value describing which army item is attacking (e.g. foot soldier)
action ID = a value specifying the type of action (e.g. attack, move, retreat)
targetID = a value specifying which item in the map is being attacked
etc...

Of course these parameters could be many more, depending on how complex the game is but you get the idea. The server validates them, makes sure that each attack is legitimate, targets are valid etc... executes the attack and returns a response so that the client can update the stats on screen (health bar, etc...) and play animations of tower crumbling and so on...

Makes sense?
Finally at the end of the attack the server will wrap up the game and update everyone's score, xp level, loot gained (if any) and whatnot.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
Zenith
Posts: 13
Joined: 09 Oct 2017, 09:57

Re: Server Authoritative Real Time Fights like COClans with Smartfoxserver?

Postby Zenith » 12 Oct 2017, 17:40

Lapo wrote:Of course these parameters could be many more, depending on how complex the game is but you get the idea. The server validates them, makes sure that each attack is legitimate, targets are valid etc... executes the attack and returns a response so that the client can update the stats on screen (health bar, etc...) and play animations of tower crumbling and so on...

Makes sense?
Finally at the end of the attack the server will wrap up the game and update everyone's score, xp level, loot gained (if any) and whatnot.
Hope it helps


I understand.
But I wonder how would this all get managed with like imagine 10 towers and 40 units attacking. A lot of combinations are possible about which tower is attacking which unit and which unit is attacking which tower. Would we be able to manage all these calculations of server?

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Bing [Bot] and 39 guests