Closed RobinPetit closed 8 years ago
Comment by RobinPetit Monday Feb 22, 2016 at 15:24 GMT
All right, I keep it up with the network interactions.
About the timer, there is nothing standard (I think). So I don't know if Theo know something like this with boost? Otherwise, we'll have to code it by ourselves
Comment by StanIsAdmin Monday Feb 22, 2016 at 15:42 GMT
I'm sure @TheoVerhelst has something to suggest.
Comment by RobinPetit Monday Feb 22, 2016 at 15:56 GMT
If nothing like this exists, I can make something with file descriptors and POSIX library. But I let anyone propose something else first.
Comment by TheoVerhelst Monday Feb 22, 2016 at 17:29 GMT
At the start of each turn we can run a thread that will send a end of turn signal to the client after n
seconds, something like:
void sendEndOfTurn()
{
std::this_thread::sleep_for(std::chrono::seconds(n));
client->endOfTurn();
}
So the sendEndOfTurn
thread is run at the beginning of the turn in server side. Let me know if there is some limitations that does not allow us to use that (the thread design here seems a bit dirty).
Comment by RobinPetit Monday Feb 22, 2016 at 17:33 GMT
Well we must also think of a non blocking I/O system because the turn must end even though the user who's turn is running is still typing something on the keyboard.
Comment by RobinPetit Tuesday Feb 23, 2016 at 21:16 GMT
Does anyone (especially @TheoVerhelst ) have something to propose for the non blocking IO?
We can read all over the net that <iostream>
does not know the notion of non blocking IO so we have to use something else. I don't know if boost has something like this (last time I checked, I didn't find). The solution I have in mind is C code and POSIX: http://linux.die.net/man/2/select.
Any suggestion is welcome.
EDIT: POSIX has also a particular header <aio.h>
: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/aio.h.html
Comment by TheoVerhelst Tuesday Feb 23, 2016 at 22:40 GMT
An alternative behavior would be to wait that the user type something in the usual blocking way, and having a listener thread that waits for server messages and that modifies some member flags if the server sends an end-of-turn message. As soon as the user types something, before the client process it and sends the input to the server, it checks the end-of-turn flag. The action is sent to the server only if the flag is not set. And the thread that listens for message can print to std::cout
something like
"Your time is elapsed, press enter to continue", so that the thread that waits for input can continue (if the user is nice and press enter).
This is not the absolute best behavior, but I think this is quite simpler than using an external lib, and it will be easier (faster) to implement. The server will himself skip turns of non-cooperative players that do not want to press enter.
Comment by RobinPetit Tuesday Feb 23, 2016 at 23:07 GMT
Well I tried it using POSIX select function and it works. I still need to rearrange my structure to have the state communicating by the special socket but non blocking input seems to work for now.
Comment by TheoVerhelst Tuesday Feb 23, 2016 at 23:21 GMT
If this works and has no counterparts, then let's use this.
Comment by StanIsAdmin Thursday Feb 25, 2016 at 13:10 GMT
Updated description, hope we can make it by tomorrow
Comment by RobinPetit Friday Feb 26, 2016 at 12:26 GMT
I crossed 2 of the elements: merging database (and GameMechanics) to master && the client side matchmaking.
Comment by RobinPetit Monday Mar 14, 2016 at 23:20 GMT
I crossed "The gameplay must still be implemented for the client side" because gameplay is coded, it is there. We are debugging and improving but the gameplay itself is coded.
@areynoua: can you tell us where you are with the last not-crossed point (begin "Interactions with the Data Base (cards, deck...)") For what I saw, I think this is good, I'd like you to confirm.
Hopefully, we will soon close this issue which is the last one for the first deadline... Yeah, the one passed 2 and a half weeks ago...
Comment by areynoua Tuesday Mar 15, 2016 at 18:57 GMT
I have to revise implementations of cards and cardData. Once done, it should be easy.
Comment by RobinPetit Sunday Mar 20, 2016 at 19:50 GMT
All right, Alexis crossed the last checkbox so I close here (it is time: it should have been done 1 month ago but we've gotten a bit late :/)!
Issue by Amuranov Monday Feb 22, 2016 at 14:16 GMT Originally opened as https://github.com/ulb-infof209/Group5/issues/54
Here is the summary from our meeting. I was told to open an issue. EDITED to reflect things left to do
It will be better for us to merge everything on Thursday so we will still have some time to test it and do some changes. ( Except Unit Test )
I suggest that everybody chooses his part and write it down here :)
For the moment, I have this :