Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by finaldeath · Sep 11, 2012 at 10:40 AM · network

Network server client

Hello

I'm new to network programming(and mostly unity to, but done a lot of .net c# programming) and have done a small program that use, client server RPC programming. Now i need to know a little more about how to make a game where i don't use a dedicated server(meaning a player will host the game other players will then join him). My biggest problem atm is that, i cant rely on my users to have a router with Upnp + they dont know how to port forward either.

I've have been searching for hours and hours on Google but have yet to find a tutorial or something similar that will help me.

On my search i found a method called NAT traversal, and have been told it can help me sort my problems with port forward and so on. But i don't really know how to implement this method in my project.

If anyone out there can help me, to move forward with learning more about network programming, ill be more the happy to try it out.

Comment
Add comment · Show 7
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image PProductions · Sep 11, 2012 at 06:43 PM 0
Share

there is a parameter for useNAT in Network.InitialiseServer() but I have never managed to implement it successfully.

avatar image BlackHunter · Sep 11, 2012 at 06:51 PM 0
Share

and it http://unity3d.com/support/resources/example-projects/networking-example

avatar image PProductions · Sep 11, 2012 at 06:52 PM 0
Share

Do you know about NAT or are you posting links?

avatar image BlackHunter · Sep 11, 2012 at 06:54 PM 0
Share

Networking have into manual

avatar image BlackHunter · Sep 11, 2012 at 06:57 PM 0
Share

or try read C#

Show more comments

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Bunny83 · Sep 12, 2012 at 05:19 PM

Unity uses RakNet for networking. This network engine provides a Nat-punch-through technique which allows two or more clients to direct-connect to each other by using a master-server which acts as initial connector between clients. Officially it's called "UDP hole punching".

While it works with a lot of Nat-routers, it's not possible with all types. It's not a bug, it's more because there are many different NAT-routers out there and there's no reliable standard. Mainly because the NAPT-technique is already a "misuse" of the port number in the UDP / TCP protocol. Actually the routers that are capable of NAT punch through are "less safe" ;)

So there is no reliable way to get around the NAT problem, but the NAT punch through should work in most cases. If not there's not much you can do beside checking for Upnp and asking the user to manually forward. On the other hand all games have those problems. Most eleminate those problems by providing dedicated servers, but as small company that's not always an option.

Comment
Add comment · Show 8 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image finaldeath · Sep 12, 2012 at 07:02 PM 0
Share

Well that makes me sad, but i did know that i might not be possible to find a solution that would always work when i don't have a dedicated server. Thx for the answer, i need to decide now, if i should get a server or not. cause the idea of the game I'm making is that my clients need to be 100% able to play it on any computer they install it on.

avatar image PProductions · Sep 12, 2012 at 07:10 PM 0
Share

Out of curiosity - on the server you would you need to run a unity file to connect and manage clients?

avatar image finaldeath · Sep 12, 2012 at 07:12 PM 0
Share

I guess, but dunno^^.

avatar image Bunny83 · Sep 13, 2012 at 02:45 AM 0
Share

Well, yes. If you want to run a dedicated server, you have to run your game / application on the server as well. You can start Unity in batch-mode so the renderers are disabled. There's no graphical output on the server in that case.

When you just want to host a masterserver you just need to run the masterserver build which you can download for free.

It depends on the type of game and on what kind of networking you need. Raknet is ment for real-time networking. If time isn't that important you could use a normal webserver for communication. It's of course a bit slower, but you could use any free-hosted webserver as long as you stick to their terms of service. Some doesn't allow pure file hosting or chat-proxy usage, but i guess if you host a website as well it should be no problem ;)

avatar image finaldeath · Sep 13, 2012 at 07:18 AM 0
Share

It's a FPS game so real-time is important, i did stumble over Raknet on my Google searches. You say that its already build into unity?

Show more comments
avatar image
-2

Answer by Jesse L · Sep 30, 2012 at 03:23 AM

I can't find thread so posting random question. I am based out of Chicago and have finished prototype with contract programmers. Looking for Chicago based programmer for potential partnership.

Jesse jesseflangille@gmail.com

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bunny83 · Oct 02, 2012 at 09:33 PM 0
Share

Not an answer! This is a Q&A site about Unity. Questions should be about development questions about Unity that are of interest to at least one other Unity developer.

Read the FAQs

Such requests should be posted on the Unity Forums in the Collaboration section

avatar image
0

Answer by BlackHunter · Sep 11, 2012 at 07:12 PM

D:/Program%20Files/Unity/Editor/Data/Documentation/Documentation/Manual/index.html view it

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image PProductions · Sep 11, 2012 at 06:45 PM 0
Share

Did you mean: http://docs.unity3d.com/Documentation/$$anonymous$$anual/index.html ?

avatar image BlackHunter · Sep 11, 2012 at 06:50 PM 0
Share

yes. ))))

avatar image BlackHunter · Sep 11, 2012 at 07:12 PM 0
Share

http://unity3d.com/support/resources/example-projects/networking-example

avatar image finaldeath · Sep 12, 2012 at 09:17 AM 0
Share

Thx for the replies, i have been looking into http://unity3d.com/support/resources/example-projects/networking-example, before i posted here, and for someone new to unity i think it needs some documentation to go with it.

Another thing is that all the examples seems to have the port forward problem where the one starting the server needs to forward hes/her port for others to join over Internet(that's just from what I've seen, tell me if I'm wrong)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiplayer| Attaching camera to player (if i am the owner 1 Answer

Problem - player networking lags 2 Answers

Multiplayer. Destroying player object on Host/Server 2 Answers

client to client ping - NAT punchthrough 1 Answer

How to put Networkview.isMine in mouselook 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges