ID:145330
 
Code:


Problem description:

My game allows up to 4 players to group and fight against monsters at the same time. I use turn based battles and if a player logs out it screws everything up. I'm just wondering if anyone has come up with a way of solving the problems caused by players doing this.
Just have the battle end?
Kill the player that has logged out and remove him from the party.

That's what I do on my games.

[edit] Also, this belongs in Design Philosophy I believe. =p
In response to Hell Ramen
I think it is a code problem because of the problem its causing, its not a single line of code or even function but multiple functions that are involved. My real problem with ending the battle is that it would make escaping from combat too easy. In addition to that if it happened in a battle with a boss, the other players in the party would be stuck. I'm just not really sure what to do with this problem, I'll keep working on it.
I'm writing an online, turn-based combat game using a generic swords and sorcery setting. It's focused on PvP, but still, what I do may help:

I generally set up the battle loops so that if one player logs out, the loops all fall through and give the win to the remaining player. It works fine with mine - I've tested it pretty extensively. That might not work with what you're doing, though.
In response to Jp
Why not just make a variable that prevents players from logging out in battle?

mob/var/in_battle = 0

mob/Logout()
if(src.in_battle == 1)
return ..()


I think that's right...
In response to Pyro_dragons
Because you CAN'T prevent people logging out. They can just close the Seeker, and there's nothing you can do to prevent that. Unless you want 'trap worlds' consisting only of the following:

mob/Logout() {return 0;}