Simple Multiplayer

Hey, I just wondered if there is any easy way to add a simple multiplayer to a game like minecraft - u just start the game - an enter an ip adress that u wanna join....

Don't know if it's possible on unity but if it it's please link a simple tutorial on it or something... ( FPS )

Yes and no. I did a very basic "minecrafty" game where users could connect, build and place blocks. All in all, it was about 175 lines of code, including GUI, networking and gameplay logic. Each command was sent via RPC calls. I later extended the code to allow chat.

Basically, you start a server with Network.InitializeServer. Clients connect to the server using Network.Connect. My player script was just a freelook camera with input controls, and had a NetworkView attached to it, so it could send RPC calls.

If you want to learn more about networking, see the manual which provides a good overview.

If you are interested in the source code, I can provide the ugly, unclean, smelly code here. You can try it out online yourself by having two browser windows open, and running the server in one and the client in the other (Press left control to start playing). I won't support it, and it's not fit to build games upon. However it does show some of the commands. I made use of a very naive CQRS (for personal learning reasons) that is not efficient at all. I won't answer any details of the code since it's just a hack to get basic multiplayer working with CQRS using RPC. Only the chat and build/erase commands are sent. There is no synchronization and it contain sync bugs.

No, you can't just "add" multiplayer to a Unity game with no work put forth in scripting, if that's what you mean.

Networking has to be something you carefully program into your game.

Still, it's not HARD, as long as you understand programming to some degree. But you'll want to follow beginner tutorials on networking to figure it all out at first.

Yeah I know that I had to program it into the game but what I ment was that to ''add'' it so easy as possible - like Minecraft ( no lobbies or things like that :)

Anyway - thanks for the post ''Statement''