SFS mmo -- SetUserPosition() only checked on client?

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

Moderators: Lapo, Bax

User avatar
Zenith
Posts: 55
Joined: 09 Oct 2017, 09:57

SFS mmo -- SetUserPosition() only checked on client?

Postby Zenith » 19 Jan 2018, 08:36

Hi,
I was going through Demo SFS MMO 1 and 2 for HTML5 with smartfox server.

I noticed that for movement client is regularly sending updates to server regarding position.

"As this is a simple example, made for educational purposes, our avatars move in a straight line, without anything acting as an obstacle on their path, except non-walkable areas defined by an image representing the hit-area. When the map is clicked and during the whole movement of the avatar, the target coordinates are checked against the hit-area and, if needed, the movement is stopped.
"

The check of non walkable area is only being done on client. Would this not make possible for players to stand on water in case they modify the request.

Secondly,
Also on clicking on a mmo-item we are retrieving the id and sending the id of mmoitem to server. Is this also not prone to cheating where client will send various ids and server would think client clicked on them?

It seems I need to somehow override these functions on server and check for non walkable area on server and check if client is near to mmoitem.
Is that possible? Or have i understood it whole wrongly?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS mmo -- SetUserPosition() only checked on client?

Postby Lapo » 19 Jan 2018, 09:36

Zenith wrote:
The check of non walkable area is only being done on client. Would this not make possible for players to stand on water in case they modify the request.

Yes this is correct, the check is client side only.
In order to check walkability on the server side you would need additional knowledge of the game map in your server Extension. It is a more complex approach that requires both client and server to "know" the map and each move would require prior validation by the server.

Secondly,
Also on clicking on a mmo-item we are retrieving the id and sending the id of mmoitem to server. Is this also not prone to cheating where client will send various ids and server would think client clicked on them?

It depends. If the server knows the position of the player (and it does) you can validate the request. In other words a player has activated an interactive door (for example) must be in range of that door. Otherwise you could reject the request.

It seems I need to somehow override these functions on server and check for non walkable area on server and check if client is near to mmoitem.
Is that possible? Or have i understood it whole wrongly?

Actually there isn't anything to override. Rather you need to add your custom logic to check for boundaries, obstacles or interactions with objects.

The MMO Room is completely "implementation neutral" in the sense that it simply provide the underlying mechanism to broadcast events that interest Users in a certain area (the AoI), It has no notion of "maps" or "walkable areas" because these are abstract concepts that will vary greatly among all sorts of games.

Via Extension code you can implement your own specific logic to handle those aspects.
Does this help?
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Zenith
Posts: 55
Joined: 09 Oct 2017, 09:57

Re: SFS mmo -- SetUserPosition() only checked on client?

Postby Zenith » 19 Jan 2018, 17:07

Lapo wrote:Actually there isn't anything to override. Rather you need to add your custom logic to check for boundaries, obstacles or interactions with objects.

The MMO Room is completely "implementation neutral" in the sense that it simply provide the underlying mechanism to broadcast events that interest Users in a certain area (the AoI), It has no notion of "maps" or "walkable areas" because these are abstract concepts that will vary greatly among all sorts of games.

Via Extension code you can implement your own specific logic to handle those aspects.
Does this help?


I thought of implementing it by making extension Move Handler.
Where user can send his move position and there in the extension I can check and set user position. Instead of setting user position from client directly.
Would that be the correct way to do it?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS mmo -- SetUserPosition() only checked on client?

Postby Lapo » 20 Jan 2018, 10:40

Yes, that would work.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 44 guests