Online From The Start?

S

Supa

Guest
If I wanted both local multiplayer, and online multiplayer, would you recommend I implement local first then go to online or make both simultaneously? Will they clash with one another if I do one first? I am familiar with making local multiplayer but not online yet. That is my next learning binge.
 
Do you mean local multi-player as in two players but both on the same computer / device(no networking involved)? Or local as in multiple computers on the same LAN?

I think you'll find if you want to make an online game, you must plan this right from the start. It is difficult to retro-fit a non-networked game with networking.
 
S

Supa

Guest
Do you mean local multi-player as in two players but both on the same computer / device(no networking involved)? Or local as in multiple computers on the same LAN?

I think you'll find if you want to make an online game, you must plan this right from the start. It is difficult to retro-fit a non-networked game with networking.
1-4 player split screen puzzle game, same device and also online vs.
Think Tricky Towers/Puyo Puyo Tetris
 

Yal

🐧 *penguin noises*
GMC Elder
I'd say it's easier to retrofit local multiplayer onto a framework for online multiplayer... if you have a master/slave setup, one player will get inputs from all the others and their game decides what happens, then tell the other players what to do. For local multiplayer, you'd just have the other-player inputs be from local players instead of over some internet protocol, and just not send state-change messages to any remote computers.
 
M

Monsi

Guest
one player will get inputs from all the others and their game decides what happens, then tell the other players what to do.
That would require all inputs to arrive in order, which would require TCP, which is slow and laggy?
 

The-any-Key

Member
It depends on the game. Is it fast passed or relatively slow. If it's fast you need to comply a simple "online" rule: Actions take time.
Ex:
When a new action happens: Make sure some type of delay is happening before and after the action.
(Ex if you want a player to move. Make sure the player start sow and acc up and when stop slow down gradually for about 150 milliseconds. This makes the other clients keep up better in online)
Keep this in mind when making the base game.

Always go UDP when online. You can get all the messages in order and prevent packet loss with a simple id system. The GMnet engine is built that way.
 
M

Monsi

Guest
you need to comply a simple "online" rule: Actions take time.
Ex
When a new action happens: Make sure some type of delay is happening before and after the action.
(Ex if you want a player to move. Make sure the player start sow and acc up and when stop slow down gradually for about 150 milliseconds.
I'd disagree with this, you want the fastest response between input and character. Can you imagine if CSGO was like moving in honey to hide latency? A small reason why everyone loves mario 64 so much is because of how responsive the controls are.
 

The-any-Key

Member
loves mario 64
True. But think on Mariocart for wii that you can play online. They got good controls but still comply with the rule.
  • When you pickup you click the button as fast you can to just get an item to fire on your opponent. You click it for crazy for about 3 seconds before you get any item. This is by design a delay to get the online feature work better.
  • When you turn your cart the controls are slow and you often slide into a wall in high speeds. You can't do a 180 just like that right :) This is by design too.
  • When you go from speed 0 it takes about 3 seconds before you get any speed. By design :)
This is the standard rule all online games comply. If you don't comply you will get in trouble when the game lags. When I play mario cart online on my WiiU. I get about 1.5-2 seconds lag from the other players.
Think what would happen if you can do a 360 in a millisecond. Or pickup stuff without delay. Or go from zero to 100 in no time. It would be chaos :)

CS also comply with the rule.
Why do you see an animation and need to wait for a reload :)
Why does it take time to load the ammo I just picked up :)
Why do they make the game so you want to walk slow :)
Why do you need to wait when you switch weapon :)

But note that SC:GO do ignore the rule in some cases and this can be used to "cheat" (Ex peeker's advantage).
If they simply add a 50 milliseconds delay (you move instantly but it takes about 50 to get full walk speed) when you start move this cheat could be reduced some more.
 
M

Monsi

Guest
Lots of passive aggressive smilies lol

CS also comply with the rule.
Why do you see an animation and need to wait for a reload :)
Why does it take time to load the ammo I just picked up :)
Why do you need to wait when you switch weapon :)
I don't think these have anything to do with latency. It's not important for other players to see you reload your gun the second you press the button, so there's no reason why they'd add a delay to "sync" it. I think these are tactical reasons. If you could reload instantly, there wouldn't be any point in it. It's there to make you think about where you spend your ammo.

Why do they make the game so you want to walk slow :)
I have not noticed this at all?

I've never played mariocart wii so I cannot comment on that.
 

The-any-Key

Member
Lots of passive aggressive smilies lol
Sorry. It was not meant to be perceived as mean.

I have not noticed this at all?
You sound when you walk but if you sneak (walk-slow) you don't make a sound and can surprise the enemy. This gives you an advantage.

It's not important for other players to see you reload your gun the second you press the button, so there's no reason why they'd add a delay to "sync" it
No. You misunderstood. They don't sync reload animations. The animation is for show. But this little delay gives the server time to sync the current action before you can trigger a new action.

You can read all about this in VALVEs developer community.
 

Yal

🐧 *penguin noises*
GMC Elder
You can read all about this in VALVEs developer community.
Links to where pls :p

One thing, though... when you fire a gun in CS (I've only played the original version, btw) the attack hits instantly, or at least appears to. Doesn't that kinda violate the latency principle? I guess that since it's just a one-off maths collision check rather than spawning yet another persistent object to synchronize across all players it could be more efficient, though.
 

The-any-Key

Member
synchronize across all players
Well you see when other people fire their weapon. So you sync the fire animation but not the bullet itself. You don't even sync or create a bullet. You sync the point you aim on.

when you fire a gun in CS (I've only played the original version, btw) the attack hits instantly, or at least appears to
It hits instantly... in a way. Multiplayer is all about give your player a good show. Ex if you fire something should happen instantly. Else people would go "It LAGS, I don't want to play this game anymore.. *went out and cycled*". So to avoid that you give the player a show with a fire-flash, fire-sound, fire animation with a dummy bullet and the person that get hit make a "ooo-I-am-hit-"-animation. But this is just for show.

If you sit side by side you can try this. Use clumsy (a program that manipulates network traffic) and delay your incoming network to the server by 3 seconds. Face each other and let the client fire. The client will see a good show. But the server player don't see anything... yet. He has now 3 seconds to step aside. But that don't matter. Valve got a time-stamp based step engine so the server calc if you stood there when the client fire and hit you anyway. But I don't know if Valve use this in CS.

rather than spawning yet another persistent object to synchronize across all players it could be more efficient
Each client could just send a message to the person that got hit that I hit them and they should reduce their HP. But that makes the game very open for hacks. You could just record the network message, decrypt it, check what makes it tick and send your own message to anyone online until they run out of HP. But many online games are server based and not peer-to-peer. So the server will get all the messages after all. But you don't actually create a bullet object. You just send the start point and aim point and calc if anything was in between.
 
M

Monsi

Guest
A really efficient method to handle this would be on an "innocent until guilty" approach to hacking. Allow players to send p2p packets of the players they shot, but also send them to the server. The server will be able to verify if that shot was legitimate while the player has already died, but if it finds that it wasn't legitimate then that player is marked as a hacker and banned. If nothing is found, it doesn't matter because it already happened and nobody was held up with all the checks.
 
Top