Search code examples
network-programmingunreal-development-kitunrealscript

Connect to a server in UnrealScript


I've created a custom matchmaking server for my UDK game in Lisp, with an UnrealScript front end that uses TcpLink. The process is very simple, with just a name and some params being sent to the Lisp server, and a port number sent back. My question is: how can I connect to a UDK server at runtime given said port number? I have the address, all I need is to connect to a running instance of UDK.exe at runtime and have the server take over the execution of the client. If any of this is unclear, please say so, and I'll rephrase myself.


Solution

  • If you're just talking about just connecting a UDK client to a UDK server, an easy way to do it is to simulate a console command using PlayerController.ConsoleCommand("open <ip>:<port>"). I think the official way to do it is to use PlayerController.ClientTravel("<ip>:<port>", TRAVEL_Absolute) (there's a little documentation on Beyond Unreal)

    Note that after the IP and Port, you might end up wanting or needing to append things like the player's desired name or team (e.g. "<ip>:<port>?name=<username>?team=<team#>").