Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

lcomstive

Network Lobby Script

Recommended Posts

I haven't contributed much to this community so I think I'll start with a script I made for my current game, it's a multiplayer lobby using only Unity's Default Networking. You choose a username then choose either to start or connect to a server, the screenshots show inside the lobby using a custom GUISkin (WIP)

 

The script is C# but I can convert to JS if anyone needs it.

 

Please login or register to see this spoiler.

 

any problems just reply to this or pm me

 

NOTE!!! I have not tested it online, it works localhost but should work over the net if you have the right network configuration (static IP + ports forwarded)

 

Link to webplayer version: Please login or register to see this link.

Edited by lcomstive
  • Like 1

Share this post


Link to post
Share on other sites

Thanks for sharing but is there any need for another script or you can use it standalone.I won't really use it but I could help some other guys making MP game :)

Edited by Eskovas Le Pro

Share this post


Link to post
Share on other sites

Attach the script to an empty GameObject and it should work, example can be found at  Please login or register to see this link.  (if link doesn't work tell me and I'll update it

Share this post


Link to post
Share on other sites
Please login or register to see this quote.

Whats the error? Can't help if you don't tell us what's wrong :P

Share this post


Link to post
Share on other sites
Please login or register to see this quote.

 

This script already has a name defined "ConnectServer" rename your C# to that and you will be fine . By seeing you getting this error i presume you are a newbie to Unity3d and i recommend you to start small

Share this post


Link to post
Share on other sites

Hi  look i wanna know when i start a server and i name it and everything when i start the game how i go to the scene i made and it is still online in the scene ?

Share this post


Link to post
Share on other sites
Please login or register to see this quote.

There are a few ways you can achieve this and there are some great tutorials on it

 

Unity's documentation - Please login or register to see this link.

Page explaining some Networking functions - Please login or register to see this link.

Topic about syncing objects when someone joins - Please login or register to see this link.

 

 

A basic way of loading a level is adding a function like:

Please login or register to see this code.

^^^ Not tested so might not work

 

Hope this helps both of you :)

Edited by lcomstive

Share this post


Link to post
Share on other sites
Please login or register to see this quote.

if you cant translate that into javascript you really should not be trying to make a multiplayer fps, theres 3 maybe 4 minor differences in that code that even the biggest noobs can spot :l

Share this post


Link to post
Share on other sites

Very simple system, can definetly be better optimized. Though it will certainly be useful to newbies.

Share this post


Link to post
Share on other sites
Please login or register to see this quote.

 

Well based on the current map selection just load the Scene you want.

Please login or register to see this code.

Share this post


Link to post
Share on other sites

Normally I would create the server scripting in a separate class because it makes it more manage my to change. This isn't only a lobby script but a lobby script with server integrated. Nice work.

Share this post


Link to post
Share on other sites
Please login or register to see this quote. Thanks MyIsaak :) everyone has their different ways, mine might seem odd to others but they work :d

Share this post


Link to post
Share on other sites
Please login or register to see this quote.

Go ahead :) if you want I might remake it and post a (hopefully) better version

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...