- Home /
Online Fighting Game Architecture
Hello!
I am creating a simple stickman fighting game for practice
Now, I am not sure about the smartest way to set this up If I try to make the server be incharge if everything, It may cause movement delay and by that will make it impossible to do combos
If I give the client to be incharge of the movemant, then that my cause Inaccurate sync, which isnt that big deal, but then - where do I check fir hit direction? Server or client? And if client, which one? Attacker or defender? Since I want the player to be able to block
I know its probebly can be a "perfect solution" but what do you think will be best for this type of game? Maybe you have better idea I havnt thoght of...
Thanks for taking the time to help!
Answer by Kiloblargh · Feb 10, 2014 at 07:03 AM
You have to actually make the game and test it on two computers on the same local network side by side. That's really the only way you will figure out how to work it. Trial and error.
I am in that stage of a 2 player game at the moment. It is a long stage...
If this game is a 2-player only game, I don't think you must have an authoritative server; there is nothing wrong with making client and server identical peers and using RPCs exclusively (with RPCMode.Others
to send to the other player.) Doing it like that is going to be your fastest option. And it is surprisingly fast, like a tenth of a second. And then you can do client-side prediction, and make it seem even faster than it really is.
If I were you I would make blocking local, and make combos attacks possible based on the last echoed position of the remote player. That is, if you see them in position for a Raging Demon or whatever, you start doing it, but if they were blocking, they will cancel your attack in (2/Network.sendRate) seconds and you'll see the first two frames but that's it.
Thanks you! Where would you recommand to do the hit detection? On the side that recuves the hit? Or the striking player?
I would do it on both sides but only make the RPC'd version actually do damage; the round-trip delay to update the other player's health bar is going to be less noticeable than the lagged hit sound/ particle fx would be. An online fighting game is just never going to be as smooth as a console version; you will get occasional random 1-second lags; and you have to look at the consequences of that happening from both players pov and deter$$anonymous$$e which solution is going to make them less likely to throw the controller across the room and ragequit. And again, trial and error.
For me, "WTF! I WAS BLOC$$anonymous$$ING THAT!" case would generate more rage than the "Huh? I didn't see him block..." case.