Basic question about the networking example

hi
In order to get a better understanding of the different networking possibilities I thought, I’ll run the examples for the ressources page http://unity3d.com/support/resources/example-projects/networking-example.

I thought it would make sense to start with a non autorative example, because it would be a bit easier to start with.

Now I have a really basic question to the statement:

“All logic is done on the client and they basically tell the server what has happened”

No matter what amount of logic this server contains, I think it’s save to assume that it resides on a remote system. So there should be something like “server-side” code that has to be installed on localhost or a distant machine.

The problem is I can’t find any of this “server-side” code. I see no code or instructions how the server for this example has to installed.

It seems like a miss an important point here…

thanks in advance
ben

I have to agree. Me and my team are working on a GTA4 level of environment interaction MMORPG, set in the future, and I want everything calculated server side, so anyone can play the game, even on a G4 Mac, or a Toshiba Tecra. I have found nothing relating to server side calculation, and would also really appreciate it if someone would come out and give us some help. I realize that doing what I propose will take up a LOT of processing power by the server, but I hope this method will become popular. The server is whatever computer a person decides to “Start a Server” on. The GUI element for the Start a server button could be removed, making it so only people with a functioning copy could start a server (meaning you. I would also dedicate a computer to running the game, or a couple copies of the game, so that only you can run servers. The server script is embedded in the game.).
Your question has helped me, as well as (I hope) my answer has helped you.

Let me try to sum this up a little to help:

What that entire statement is referring to is peer to peer networking on a hub and spoke system.

All clients calculate there turns, moves, actions and reactions on there own machine. The server stores nothing, it just acts as a catalist to hold the clients together.

Instead of 1 client being the server and then having a list of clients to react and drop to in the event of a lost client / server scenario, the server itself is the glue that holds the set together.

It has no business / game logic, it doesn’t need it. All it needs is a way to know who has connected to it, as long as player count > 1 then game is still active. All players get the other data from the other players bridged through the server.

Let me analogize this.

Peer - Peer / pure: hot potatoe
Peer - Peer / hybrid: (3rd person): duck duck goose

Hot Potatoe:
Entire thing has one potatoe, it gets tossed around, one master controls the tossing of the potatoe, that master goes away, the potatoe hits the floor.

Duck Duck Goose
The controler is a 3rd party, the child walking around the circle per say. If a player drops out, the 3rd party is still there and skips that empty slot and duck duck on.

You start the 3rd party mode server, connect the clients, and still are working in a peer to peer situation. As long as someone is connected, the data about the entire game exists somewhere. You want to stop the game in the event player count <2. This mode is best suited for games like Red Alert, Grand Theft Auto, well, anything under 32 players. Thats probably pushing the barrel.

Lets look at Red Alert as a 3rd party mode server, you start the server, you connect 4 players to it, the server is a broadcast, thats all. Player 1 does his work on his pc, and all logic about his work stays on his pc, he broadcasts to the server what he alone has done, the server broadcasts to the other 3 players what he has done, there machines adjust his work accordingly.

The server has no care nor any logic if the work the players are doing is good or bad, it doesn’t even care if they cheat. Its just an anouncer, thats it.

Hope this helps.

Thanks a lot for your explanations. I do have some questions though:

Maybe the question is almost too but simple what is this server made of? Is it just Unity running on a dedicated machine? Is it the MasterServer? http://unity3d.com/support/documentation/Components/net-MasterServer.html

But isn’t that a problem because every player also sends data the entire game has to adapt to the slowest element (client) in chain (p2p network)?

My question here is - again - asked with practicability in mind: Does that mean you have to run Unity on a server?

The master server is used only to get a list of available servers. The server could be unity running on a dedicated machine. But i think in the examples the server is the first player. The one that clicks “Start Server” or w/e.

But isn’t that a problem because every player also sends data the entire game has to adapt to the slowest element (client) in chain (p2p network)?[/quote]

If there’s one slow player only that players actions will show lag. The other players actions will happen as fast as there connection allows. And I’m pretty sure this isn’t p2p networking. It’s all centralized. Any one player doesn’t have the ability to connect directly to another player. They must go through the server.

No, you could use whatever you want as the server. You could use Unity, or write it in C++, or whatever else you like.

To Dakta: If you wanted all the game logic to be done on the server you could send a rpc on key down that sets a bool to true. Then on the server if bool = true move player forward. Another rpc could be sent on key up that sets bool to false. All the physics are done on the server and it just sends back the positions etc. I personally wouldn’t do it like this since it would mean a delay between pressing a button and the action happening. You’d at least want some prediction on the client side. Feel free to post another topic on this issue if you need further help.

In a network environment like we are talking about, you are correct, the game runs at the speed of the slowest machine, there is no logic on the server to compensate for this. Your game code has to compensate for it at the client side. Its like a bloated turn based game that seems real.

4 machines, of the 4, one of them is you, so all you care about from the server is the other 3 machines, likewise for them, they only care about receiving data from everyone but them self. Headless server is best for this. The master server would work, all you need is a lobby and the game sync code.

You will run into the problem you mentioned if you have some uber machine against some crappy machines, but there are programming ways around this. You have to understand how to program AI prediction. Understand that all pieces on all boards have to have some prediction logic built into them to compensate. This prediction has to be limited or it will play the game for you.