Stripped down version of Bolt Client / Server

Options
My use-case for my game is that:

- I have a smartfox server always running, managing my MMO
- Players can enter into races, they are matched against players with similar experience.
- In the race room, the player with the best ping to the server is assigned a "isHost" flag

Here is what I would like to happen

- When the race countdown is ready to start, the player with the "isHost" flag, starts a server and then uses smartfox to tell all the other players in the room "Hey connect to me here on this IP address"
- All clients then attempt a connection to the new server. If this is all done before the race countdown ends, we'll bypass the smartfox server for updates about the race and do a direct connection.

No need to worry about if the host drops out / gets interrupted or anything, it will end up failing over to the otherwise redundant Smartfox existing solution for races.

Can anybody point me in the right direction for starting with this.

- It won't be able to make me incur any extra cost (I can install more software on my linux dedicated server if I have to though if it's *really* necessary for any nat stuff that I don't particularly understand).
- The client has easy access to their WAN IP address: SmartFox.CurrentIp
- I'm not sure how to start the Bolt Server listening in on anything other than a LAN IP address at the moment is the first hurdle I need to jump.

Thanks in advance for any help.

Comments

  • It looks like you just need to call BoltNetwork.StartClient for your clients then BoltNetwork.Connect to the ip given by smartfox for the host.
  • Thank you, am having some fun getting moving now:

    Firstly: "Cannot open socket on ip {%WAN IP ADDRESS%} and port {7777}; check please your network, most probably port has been already occupied "

    fair enough, shall just try: BoltLauncher.StartServer(UdpKit.UdpEndPoint.Parse("0.0.0.0:18095")); instead, server gets as far as doing "BoltStartDone" whic contains:

    public override void BoltStartDone() { if (BoltNetwork.isServer) { BoltNetwork.EnableUPnP (); BoltNetwork.OpenPortUPnP (18095); } }

    And leads to the error:

    "Could not locate UPnP library, is it installed?"

    A quick google search leads me back to this forum where the user is asked whether they have installed Bolt (I have), but is there anything other than this I can check for?
  • Make sure UPnP is enabled in Bolt Settings, disable and enable it in the menu.
  • Thanks so much for your help so far, it feels like I'm getting there slowly. Here's the class as it stands so far:

    http://pastebin.com/H49Ue6kx (PasteBin as I couldn't figure how to paste here).

    My next hurdle is just finding something like: BoltNetwork.Send() which will let me send a string (or better yet, a byte array) to a BoltConnection (or all BoltConnections available if it's the server), preferably without having to create BoltEntity or too much extra.
  • var evnt = myEvent.Create(connection);
    myEvent.BinaryData = myByteArray;
    myEvent.Send();

    You'll have to make "myEvent" in the Bolt assets editor.
  • Once again, thank you so much for your help and patience with me. I'll give this a shot :)