Extension Execution order problem

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
ekrem5353
Posts: 118
Joined: 10 Dec 2015, 15:50

Extension Execution order problem

Postby ekrem5353 » 31 May 2016, 12:24

Hi

I have a problem with ClientRequestHandler 's execution order. I have card game, player shoul make a move1 and move2 but move2 depends on move one. move1 should be executed first. When two moves too close to each other client sends first request then second request but at server side. second move executes first. Now we make client wait a while then send second move like UserPlayedCardRequest Handler. Actually we need to make sure first move executes first at server side.

Second. Client Request
| 22:47:17,449 | INFO | SFSWorker:Ext:8 | Extensions | | {CanakOkey101Extension}: OpenStonesHandler--> OYZ2 Additional pair PerType :0 BLUE 6BLUE 7BLUE 11BLUE 9 Additional pair PerType :0 YELLOW 7BLUE 7RED 7 Additional pair PerType :0 BLACK 10YELLOW 10BLUE 10 Additional pair PerType :0 BLUE 13RED 13YELLOW 13

First. client request
22:47:17,449 | INFO | SFSWorker:Ext:4 | Extensions | | {CanakOkey101Extension}: OpenStonesHandler--> OYZ2 Open Stone Attempt :Per : RED 4 RED 4

it happens rarely but still ..it happens usually when server is too busy. at client side there are couple of seconds between first client request and second.

Long story short I have to make first request execute first.
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Extension Execution order problem

Postby Lapo » 31 May 2016, 14:02

Hi,
can't you send the two moves together as a single request to the Extension? Or is the 2nd move optional?
Can you explain a little bit better how this works? For example, how many moves can the client send during his turn?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
ekrem5353
Posts: 118
Joined: 10 Dec 2015, 15:50

Re: Extension Execution order problem

Postby ekrem5353 » 31 May 2016, 14:52

Hi ,

It is like card game. its played with four people. Player has cards he makes them pairs like yellow 5 , yellow 6 , yellow 7 or yellow 7 , blu7, red 7, if these add up to 101 he opens them on the table then he can throw one card that he doesnt need. or he can insert one to other players pairs if there is already red 4, red 5, red 6 and he has a red 7 he can put it there. there might be joker card if he inserts in joker place like red 4 , red 5 and joker he puts red 6 over joker I send him joker. then trows one card to side it becomes next players turn. Player might pick card from side(where other player throw) or from the deck if card count isnt over 101 I make him put that card back he should pick from new deck.

If there is no other solution, It might be redesigned so Client might send me all of them when player throws to side but it will be so complicated.

I explained it horribly if you like you can play it
http://www.oyunzade.com/games/canakokey101

Thanks.
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Extension Execution order problem

Postby Lapo » 31 May 2016, 15:39

It shouldn't be very complicated.
You can make a separate SFSObject for each move and put them into an SFSArray, then send it to the server. This way only one thread will work on it and there won't be ordering issues.

Your server code can simply loop through the SFSArray, and process each move in sequence.

Makes sense?
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 66 guests