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
0
Question by NewTechProgrammerRyan · Feb 09, 2012 at 04:36 PM · networkingmultiplayerbeginnersimple

Simple Easy Networking using Wireless Internet

I am a student at tech high school and for a project we are trying to build a networked game in unity. we started out trying to make an mmo but then decided we could settle for something a little less ambitious. Before you say i didn't look hard enough, i have been looking for 2 weeks and havent found anything simple that works and explains in detail what exactly i have to do. Basically i just need a clear way to network between 2 computers so that 1 is the server and the other is the client using the wireless internet. the more detailed the better since i am a beginner programmer.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by asafsitner · Feb 09, 2012 at 07:18 PM

As long as your machines are connected to the same network (including the internet), all you need to do to connect them together is the IP address and port of your server (NAT could pose a problem if your server machine is behind a router with no public IP address and proper DMZ setup while trying to access it via the internet, but it shouldn't matter for local network).

Calling `Network.InitializeServer` will make one machine the server, while calling `Network.Connect` on the other machines (providing the correct IP and port of course) will make them the clients and connect them to the server. It's as simple as that, wireless network or not.

To make sure you know which is which you can use a simple script with a GUI label set to display the `Network.PeerType`.

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 NewTechProgrammerRyan · Feb 10, 2012 at 03:01 PM 0
Share

var ServerIP:String = "127.0.0.1"; var ServerPort:String = "30000";

function OnGUI(){ if (Network.peerType == NetworkPeerType.Disconnected){ if(GUILayout.Button("Connect")) { Network.Connect(ServerIP,parseInt(ServerPort)); } if (GUILayout.Button("New Server")) { Network.InitializeServer(32,parseInt(ServerPort),false); } } else { if (GUILayout.Button("Disconnect")) { Network.Disconnect(); } } }

function Awake () { networkView.stateSynchronization = NetworkStateSynchronization.Unreliable; }

that is the code i have for networking, i made some little game and it would work on just my computer but when i tried to put the built game on a friends computer we couldn't see each other if it was running at the same time, and when i tried to put in my IP and port that didn't help at all, ins$$anonymous$$d it gave me a "failed to initialize network interface" error when i tried it on just my computer, then i put it on my friends and it didn't show me on his or him on $$anonymous$$e once again

avatar image CC Inc · Feb 11, 2012 at 01:59 AM 0
Share

Well, if you are on different networks, you will have to port forward on the server, see portforward.com

avatar image NewTechProgrammerRyan · Feb 13, 2012 at 04:19 PM 0
Share

do i have to pay for that? because i am a student as i mentioned before, so i cant pay for stuff. and i am not sure but i think we have the same network... again i am a beginner coder, a virgin networker

avatar image asafsitner · Feb 13, 2012 at 08:19 PM 0
Share

No, port forwarding is something you have to do with your router. Basically it 'forces open' whichever ports you want, allowing information flow in and out. You might also need to set D$$anonymous$$Z to your server's machine's ip.

Enter your router's configuration (look at the manual or the internet for your specific model's address, just type it in your browser) and look for an 'advanced' tab, probably.

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

6 People are following this question.

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

Related Questions

Unity networking tutorial? 6 Answers

Simulating a loss of internet connection 0 Answers

MP randomly generated levels, other player see's a different one than server host? 2 Answers

Streaming data through Unity - other than WWW? 1 Answer

Help with multiplayer connection 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