Search Unity

Free Console with networking example

Discussion in 'Works In Progress - Archive' started by JamesLeeNZ, May 3, 2013.

  1. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    I'm going through the process of understanding how multi-player works. I decided to create an empty project and make a basic console to use while developing it since the server will most likely be console controlled anyway. I'm going to be giving the code away as I go along, as well as instructions on how to use it if you are interested. At this stage, I intend to progress it to at least a level of having a couple of characters running around, probably shooting at each other.

    Release #1:

    Basic Console
    Basic server with RPC functions
    Basic client with RPC functions

    http://www.fingerbait.com/Assets/BasicConsole.unitypackage

    Quick Start:
    1. Create new project
    2. Import the above package
    3. Goto build settings, make sure to setup run in background to true (http://docs.unity3d.com/Documentation/Manual/class-PlayerSettings.html - search for run in background here if you are not sure)
    4. Build the project with only the Main scene - Note: this build will be your server
    5. Run the built exe. Allow the software to go through your firewall
    6. (In server). Hit ~ key (standard console)
    7. type 'create server'
    8. type 'start server'

    At this stage you should hopefully have a server that is up and running. Leave the server running and go back to your Unity instance and hit play. This will be your client.

    1. Bring up console
    2. type 'create client'
    3. type 'connect'

    The client should connect to the server.

    On you server application, go into the console and type 'load terrain0' or 'load terrain1'. The server should load the map, and the client should also.

    The other RPC function available to both the client and the server app is 'send [insert message]'

    This is definitely WIP code, and should be treated more as a guide rather than anything greater. There may be and probably is better ways of doing stuff.

    Just as i'm posting this I've realized the code isn't as commented as it could be. Might improve on that in later releases.

    JL
     
    Samuel411 likes this.
  2. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    reserved
     
  3. Brainswitch

    Brainswitch

    Joined:
    Apr 24, 2013
    Posts:
    270
    Haven't downloaded and tested your code, but just a tip: Use application.runInBackground to force the server (and client if you wish) to run while in the background.
     
  4. Ironmax

    Ironmax

    Joined:
    May 12, 2015
    Posts:
    890
    I just tested it, its just crap dont download. Better to use Photon or Unet.
     
  5. willemsenzo

    willemsenzo

    Joined:
    Nov 15, 2012
    Posts:
    585
    So what are the reasons why it's crap? If you really tested it share your findings with us. Saying it's just crap isn't a valid argument but you're only here to mess with people. I actually do have arguments for this want me to lay them out?
     
  6. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    This is quite old and should possibly only be used as a guideline. Considering both GUI and Networking have been re-worked in U5, this is a somewhat redundant script.
     
  7. Ironmax

    Ironmax

    Joined:
    May 12, 2015
    Posts:
    890
    Close thread close thread