Handle network errors

Hello everyone,

I’m developping a multiplayer turn based game.

I have a general question : how do you handle the network errors that happen between a turn ?

For example, I have wifi/3G when I start one round, but I do not have anymore wifi/3G connection at the end of the round (when I send the data to my webserver).

My idea is to store into a table my request before calling the webserver.

If I get a network error, I will repeat the request 2 times with a delay of 2 seconds.

If it still fails, I will save into a file in the phone the request. When the player connects again, the last request stored in the file will be sent again.

Is it good / enough ? I don’t want to reinvent the wheel but I did not find any solution on internet …

Thanks for helping me !

This is going to be tough to answer because there are multiple ways to communicate with the server and network errors or network connectivity would impact them differently. 

What you’re suggesting is pretty plausible for a turn based game.  If you’re trying to do something more real time, you might want to simply show a “Cant connect to the server” message and not let them do anything.  A lot depends on the type of game you are building and how much of the game logic is in the server vs in the app.

Hello,

Thanks for your answer.

My game process looks like Draw, Panic farm etc. It is turn based / asynchronous.

I don’t think I will have enough users (at least at the begin) to make more real time for the match making. And I don’t want to force a player to play a full game party and penalise him if he disconnects / wants to have a break. 

Well, I will stick with my first idea and implement it.

This is going to be tough to answer because there are multiple ways to communicate with the server and network errors or network connectivity would impact them differently. 

What you’re suggesting is pretty plausible for a turn based game.  If you’re trying to do something more real time, you might want to simply show a “Cant connect to the server” message and not let them do anything.  A lot depends on the type of game you are building and how much of the game logic is in the server vs in the app.

Hello,

Thanks for your answer.

My game process looks like Draw, Panic farm etc. It is turn based / asynchronous.

I don’t think I will have enough users (at least at the begin) to make more real time for the match making. And I don’t want to force a player to play a full game party and penalise him if he disconnects / wants to have a break. 

Well, I will stick with my first idea and implement it.