In my free time I'm trying to learn programming and I decided trying to make game should be good experience, therefore I picked MMOG (please no trolling). I've tried to find some networking library however I failed, so I decided to try and make my own one, or at least something that simplifies networking. I decided to go with semi-RPC way: non-blocking RPCs where return value is another RPC. However I ran into little design issue.
Lets say main loop on client looks like this:
void MainLoop() {
HandleInput();
UpdateFrame();
RenderFrame();
}
/* somewhere inside one of functions player sends data to server */
/* for example chat message, login request, etc */
// currently I planned it'd look like this:
string username = ...; // get input from GUI
string password = ...;
client->Call("Login", username, password);
/* Call() serializes parameters and sends them over network to server using sendto() function */
/* on server side function will be called */
void Login(string username, string password) {
if(database.FindAccount(username, password))
server->Call("LoginReply", "success"); /* where to send data? */
}
Therefore right now I cannot seem create proper design that'd allow me to send reply back easily.
I was hoping someone could help me out with this issue. Maybe even whole idea is wrong and there are better solutions?
Thank you in advance.






