FindRoomRequest has proplem with MatchExpression
Moderators: Lapo, Bax, MBagnati
-
- Posts: 4
- Joined: 24 Jul 2014, 03:52
FindRoomRequest has proplem with MatchExpression
Hi Bax, Lapo and MBagnati.
I use FindRoomRequest to filter room but it's not work.
My situation:
I have 4 rooms. One has max user = 2, and three have max user = 4
I want to filter all rooms have RoomProperties.MAX_USERS = 4, so I try use MatchExpression
void MyServer::filterRoom()
{
boost::shared_ptr<int> matchValue(new int(4));
boost::shared_ptr<MatchExpression> expr(new MatchExpression(RoomProperties::MAX_USERS, NumberMatch::EQUALS, matchValue, MatchExpression::MatchExpressionValueType::MatchExpression_ValueOther));
// Send request
boost::shared_ptr<IRequest> request(new FindRoomsRequest(expr));
mSmartFox->Send(request);
}
And there is no room in FindRoomResponse. But when I change NumberMatch::EQUALS to NumberMatch::GREATER_OR_EQUAL_THAN, I have 4 rooms in my response.
So I try to use NumberMatch::LESS_OR_EQUAL_THAN, the response has the same response as NumberMatch::EQUALS. I think it's not work when use NumberMatch::LESS_OR_EQUAL_THAN and NumberMatch::EQUALS
My API version is 1.1.4 and Smartfox Server 2.8.4
Thanks
I use FindRoomRequest to filter room but it's not work.
My situation:
I have 4 rooms. One has max user = 2, and three have max user = 4
I want to filter all rooms have RoomProperties.MAX_USERS = 4, so I try use MatchExpression
void MyServer::filterRoom()
{
boost::shared_ptr<int> matchValue(new int(4));
boost::shared_ptr<MatchExpression> expr(new MatchExpression(RoomProperties::MAX_USERS, NumberMatch::EQUALS, matchValue, MatchExpression::MatchExpressionValueType::MatchExpression_ValueOther));
// Send request
boost::shared_ptr<IRequest> request(new FindRoomsRequest(expr));
mSmartFox->Send(request);
}
And there is no room in FindRoomResponse. But when I change NumberMatch::EQUALS to NumberMatch::GREATER_OR_EQUAL_THAN, I have 4 rooms in my response.
So I try to use NumberMatch::LESS_OR_EQUAL_THAN, the response has the same response as NumberMatch::EQUALS. I think it's not work when use NumberMatch::LESS_OR_EQUAL_THAN and NumberMatch::EQUALS
My API version is 1.1.4 and Smartfox Server 2.8.4
Thanks
Re: FindRoomRequest has proplem with MatchExpression
Sorry for the delay. We'll try to replicate the problem and report back.
Cheers
Cheers
Re: FindRoomRequest has proplem with MatchExpression
Hi,
I have investigated the issue and I have found an error in API library.
As temporary workaround please use a double datatype to declare the matchValue.
In your filterRoom function, please temporarly replace
with
Error will be fixed in next API version.
Let me know if this workaround returns expected results
Thanks
I have investigated the issue and I have found an error in API library.
As temporary workaround please use a double datatype to declare the matchValue.
In your filterRoom function, please temporarly replace
Code: Select all
boost::shared_ptr<int> matchValue(new int(4));
with
Code: Select all
boost::shared_ptr<double> matchValue(new double(4));
Error will be fixed in next API version.
Let me know if this workaround returns expected results
Thanks
Re: FindRoomRequest has proplem with MatchExpression
Hi,
On SFS2X 2.10.0 and latest Client 1.6.0 for unity3D.
MatchExpression returns all rooms if condition not fulfilled.
Expression :
String isTeam "Y"
Bool isGameStarted false
If the above conditions not satisfied, it should return zero room. But i get all rooms with isTeam "Y"&"N", isGameStarted true.
Able to replicate this scenarios many times.
Need help from SFS support to find a resolution. Thank you!
Br,
Matt
On SFS2X 2.10.0 and latest Client 1.6.0 for unity3D.
MatchExpression returns all rooms if condition not fulfilled.
Expression :
String isTeam "Y"
Bool isGameStarted false
If the above conditions not satisfied, it should return zero room. But i get all rooms with isTeam "Y"&"N", isGameStarted true.
Able to replicate this scenarios many times.
Need help from SFS support to find a resolution. Thank you!
Br,
Matt
Re: FindRoomRequest has proplem with MatchExpression
Can you show me the actual code of the request?
Thanks
Thanks
Re: FindRoomRequest has proplem with MatchExpression
Lapo wrote:Can you show me the actual code of the request?
Thanks
Hi Lapo,
Thanks for the help.
Below is the client codes :
Code: Select all
private void onRoomFindSingle ()
{
roomFindStarted = true;
registerSFSeventsFindRoomResult ();
// Start the main game
// Prepare match expression
MatchExpression exp = new MatchExpression (RoomProperties.IS_GAME, BoolMatch.EQUALS, true).And (RoomProperties.HAS_FREE_PLAYER_SLOTS, BoolMatch.EQUALS, true);
exp.And ("isTeam", StringMatch.EQUALS, "N");
exp.And ("isGameStarted", BoolMatch.EQUALS, true);
smartFox.Send (new Sfs2X.Requests.FindRoomsRequest (exp));
}
private void onRoomFindTeam ()
{
roomFindStarted = true;
registerSFSeventsFindRoomResult ();
// Start the main game
// Prepare match expression
MatchExpression exp = new MatchExpression (RoomProperties.IS_GAME, BoolMatch.EQUALS, true).And (RoomProperties.HAS_FREE_PLAYER_SLOTS, BoolMatch.EQUALS, true);
exp.And ("isTeam", StringMatch.EQUALS, "Y");
exp.And ("isGameStarted", BoolMatch.EQUALS, false);
smartFox.Send (new Sfs2X.Requests.FindRoomsRequest (exp));
}
Descriptions : two static room configuration. Single Room and Team Room with persistent room variables isTeam:string, isGameStarted:boolean.
Summary : Call onRoomFindSingle (), It should only return single room, but the result returns Single Room and Team Room (when team room has a game in progress. isGameStarted=true).
Re: FindRoomRequest has proplem with MatchExpression
Thanks.
Since I don't have your setup to test I would like you to ask you to try a couple of tests.
Take one of the two expressions and test with only the first element:
If this returns the expected result add the next condition, e.g.:
This way we can pin down which condition is not met, then we'll investigate the reason why it's not returning as expected.
thanks
Since I don't have your setup to test I would like you to ask you to try a couple of tests.
Take one of the two expressions and test with only the first element:
Code: Select all
MatchExpression exp = new MatchExpression (RoomProperties.IS_GAME, BoolMatch.EQUALS, true)
If this returns the expected result add the next condition, e.g.:
Code: Select all
exp.And (RoomProperties.HAS_FREE_PLAYER_SLOTS, BoolMatch.EQUALS, true)
This way we can pin down which condition is not met, then we'll investigate the reason why it's not returning as expected.
thanks
Re: FindRoomRequest has proplem with MatchExpression
Lapo wrote:Thanks.
Since I don't have your setup to test I would like you to ask you to try a couple of tests.
Take one of the two expressions and test with only the first element:Code: Select all
MatchExpression exp = new MatchExpression (RoomProperties.IS_GAME, BoolMatch.EQUALS, true)
If this returns the expected result add the next condition, e.g.:Code: Select all
exp.And (RoomProperties.HAS_FREE_PLAYER_SLOTS, BoolMatch.EQUALS, true)
This way we can pin down which condition is not met, then we'll investigate the reason why it's not returning as expected.
thanks
It helps to narrow the expressions :
Tests for 1-3 rules, Ok, works 10 out of 10.
MatchExpression exp = new MatchExpression (RoomProperties.IS_GAME, BoolMatch.EQUALS, true).And (RoomProperties.HAS_FREE_PLAYER_SLOTS, BoolMatch.EQUALS, true);
exp.And ("isTeam", StringMatch.EQUALS, "N");
Test fails with 4th rule, return room with isTeam=Y. isGameStarted=true
MatchExpression exp = new MatchExpression (RoomProperties.IS_GAME, BoolMatch.EQUALS, true).And (RoomProperties.HAS_FREE_PLAYER_SLOTS, BoolMatch.EQUALS, true);
exp.And ("isTeam", StringMatch.EQUALS, "N");
exp.And ("isGameStarted", BoolMatch.EQUALS, true);
Re: FindRoomRequest has proplem with MatchExpression
Can you make doubly sure (via the AdminTool > Zone Monitor) that the isGameStarted variable exists and is set as expected?
thanks
thanks
Re: FindRoomRequest has proplem with MatchExpression
Lapo wrote:Can you make doubly sure (via the AdminTool > Zone Monitor) that the isGameStarted variable exists and is set as expected?
thanks
Hi Lapo,
OK, checked zone monitor several times to ensure the variable exists for the rooms and has correct value to trigger the scenario.
Br,
MAtt
Re: FindRoomRequest has proplem with MatchExpression
Thanks.
One more thing: what happens if you simply use this, instead
I'd like to understand if the problem is with the specific variable or with the entire expression's chain.
One more thing: what happens if you simply use this, instead
Code: Select all
MatchExpression exp = new MatchExpression ("isGameStarted", BoolMatch.EQUALS, true);
I'd like to understand if the problem is with the specific variable or with the entire expression's chain.
Re: FindRoomRequest has proplem with MatchExpression
Lapo wrote:Thanks.
One more thing: what happens if you simply use this, insteadCode: Select all
MatchExpression exp = new MatchExpression ("isGameStarted", BoolMatch.EQUALS, true);
I'd like to understand if the problem is with the specific variable or with the entire expression's chain.
Did a quick test, 1 variable expression, works 10/10 for true&false scenario.
The problem pop-up for expressions chain, of a string and bool type. e.g, expression filter "Y"&true return rooms with"Y"&true, "N"&true
Re: FindRoomRequest has proplem with MatchExpression
I have tested your scenario and I was not able to reproduce any problem.
I've used a chain of two and a chain of four expressions such as this:
And always got back the right response.
I am testing on the latest 2.10 release, but I am not even aware of bugs in older versions.
The only thing that stands out is the very old version of your client side API (1.1.4?) Please go here:
http://www.smartfoxserver.com/download/sfs2x#p=client
And download version 1.5.7 (not 1.6.0, since you have an old server). Then try with the new API and let me know.
Thanks
I've used a chain of two and a chain of four expressions such as this:
Code: Select all
MatchExpression expr = new MatchExpression(RoomProperties.IS_GAME, BoolMatch.EQUALS, true).And (RoomProperties.HAS_FREE_PLAYER_SLOTS, BoolMatch.EQUALS, true).And("stringVar", StringMatch.EQUALS, "Y"). And("boolVar", BoolMatch.EQUALS, true);
sfs.Send( new FindRoomsRequest(expr));
And always got back the right response.
I am testing on the latest 2.10 release, but I am not even aware of bugs in older versions.
The only thing that stands out is the very old version of your client side API (1.1.4?) Please go here:
http://www.smartfoxserver.com/download/sfs2x#p=client
And download version 1.5.7 (not 1.6.0, since you have an old server). Then try with the new API and let me know.
Thanks
Re: FindRoomRequest has proplem with MatchExpression
Lapo wrote:I have tested your scenario and I was not able to reproduce any problem.
I've used a chain of two and a chain of four expressions such as this:Code: Select all
MatchExpression expr = new MatchExpression(RoomProperties.IS_GAME, BoolMatch.EQUALS, true).And (RoomProperties.HAS_FREE_PLAYER_SLOTS, BoolMatch.EQUALS, true).And("stringVar", StringMatch.EQUALS, "Y"). And("boolVar", BoolMatch.EQUALS, true);
sfs.Send( new FindRoomsRequest(expr));
And always got back the right response.
I am testing on the latest 2.10 release, but I am not even aware of bugs in older versions.
The only thing that stands out is the very old version of your client side API (1.1.4?) Please go here:
http://www.smartfoxserver.com/download/sfs2x#p=client
And download version 1.5.7 (not 1.6.0, since you have an old server). Then try with the new API and let me know.
Thanks
Sorry, piggyback to this old thread.
The fourth message of this thread, the problem is with this setup of mine : SFS2X 2.10.0 (OSX Yoesmite) and Client 1.6.0 for unity3D.
When i have more bandwidth, will do a fresh install and simple test client to replicate this error.
Re: FindRoomRequest has proplem with MatchExpression
Sorry, I misread the setup by scrolling the old posts back to the first one.
Ok. Thanks
When i have more bandwidth, will do a fresh install and simple test client to replicate this error.
Ok. Thanks
Who is online
Users browsing this forum: No registered users and 18 guests