Results 1 to 10 of 10
  1. #1
    Skaarj
    Join Date
    Jul 2010
    Location
    Chocolate Factory
    Posts
    21

    Unhappy How do i call a tpclink script in game?

    Like the title says i wanna make the tcplink client example to get executed in game for me to see if it works. But i dont really know how to implement it, im a total noob with uscript. I would really apreciate if someone could give me some guidanse on implementing a tcplink script step by step without assuming any knowldege in this matter. Thanks in advance.

  2. #2
    MSgt. Shooter Person
    Join Date
    Feb 2010
    Posts
    40

    Default

    Have you followed this tutorial?
    http://www.theballthegame.com/tutorialudk.htm

    Then you add these tcplink scripts in your project.

    In my project I've another c++ program that can send messages to udk via tcp/ip.

    Here's the code that send message to udk via tcp/ip.

    Code:
    #include <winsock2.h>
    #include <ws2tcpip.h>
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <assert.h>
    #include <math.h>
    #include <float.h>
    #include <limits.h>
    #include <time.h>
    #include <ctype.h>
     
    #ifdef _EiC
    #define WIN32
    #endif
    
    
    //using namespace std;
    #define HISTORY_LENGTH 5
    
    #define DEFAULT_BUFLEN 512
    #define DEFAULT_PORT "3742"
    #define DEFAULT_SERVER_IP "127.0.0.1"
    
    WSADATA wsaData;
    
    SOCKET ConnectSocket = INVALID_SOCKET;
    
    int SocketInit();
    
    int main(int argc, char** argv )
    {
    	SocketInit();
    	
    	int iResult = 0;
    
    	char sendbuf[512] = "CuteValue;1.0";
    	iResult = send(ConnectSocket, sendbuf, (int) strlen(sendbuf), 0);
    	if (iResult == SOCKET_ERROR) {
    		printf("send failed: %d\n", WSAGetLastError());
    		closesocket(ConnectSocket);
    		WSACleanup();
    	}
       return 0;
    }
    
    int SocketInit()
    {
    	int iResult;
    
    	// Initialize Winsock
    	iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
    	if (iResult != 0) {
    		printf("WSAStartup failed: %d\n", iResult);
    		return 0;
    	}
    	else		
    	{
    		printf("WSAStartup succeeded: %d\n", iResult);
    	}
    
    	struct addrinfo *result = NULL,
                    *ptr = NULL,
                    hints;
    
    	ZeroMemory( &hints, sizeof(hints) );
    	hints.ai_family = AF_UNSPEC;
    	hints.ai_socktype = SOCK_STREAM;
    	hints.ai_protocol = IPPROTO_TCP;
    
    	// Resolve the server address and port
    	iResult = getaddrinfo(DEFAULT_SERVER_IP, DEFAULT_PORT, &hints, &result);
    	if (iResult != 0) {
    		printf("getaddrinfo failed: %d\n", iResult);
    		WSACleanup();
    		return 0;
    	}
    	else
    		printf("getaddrinfo succeeded: %d\n", iResult);
    
    	// Attempt to connect to the first address returned by
    	// the call to getaddrinfo
    	ptr=result;
    
    	// Create a SOCKET for connecting to server
    	ConnectSocket = socket(ptr->ai_family, ptr->ai_socktype, 
    		ptr->ai_protocol);
    
    	if (ConnectSocket == INVALID_SOCKET) {
    		printf("Error at socket(): %ld\n", WSAGetLastError());
    		freeaddrinfo(result);
    		WSACleanup();
    		return 1;
    	}
    
    	// Connect to server.
    	iResult = connect( ConnectSocket, ptr->ai_addr, (int)ptr->ai_addrlen);
    	if (iResult == SOCKET_ERROR) {
    		closesocket(ConnectSocket);
    		ConnectSocket = INVALID_SOCKET;
    	}
    
    	// Should really try the next address returned by getaddrinfo
    	// if the connect call failed
    	// But for this simple example we just free the resources
    	// returned by getaddrinfo and print an error message
    
    	freeaddrinfo(result);
    
    	if (ConnectSocket == INVALID_SOCKET) {
    		printf("Unable to connect to server!\n");
    		WSACleanup();
    		getchar();
    		return 1;
    	}
    
    	//int recvbuflen = DEFAULT_BUFLEN;	
    
    	return 1;
    }
    change default port to the one specified in tcpserver script under default properties section and server ip to the ip of the pc running udk server.
    u will also need to put WS2_32.lib odbc32.lib odbccp32.lib those static libs to linker input section.

    and somewhere in your udk playercontroller script or some initialization script, spawn that tcp server class to start listening incoming message.

    Code:
    //declare TcpLinkServer
    var TcpLinkServer tcpLinkServer;
    
    
    simulated function PostBeginPlay()
    {
    	//spawn and init the class
    	tcpLinkServer = spawn(class'TcpLinkServer');
    	tcpLinkServer.TcpLinkInit();
    }
    Last edited by astk; 08-05-2010 at 02:45 AM.

  3. #3
    Skaarj
    Join Date
    Jul 2010
    Location
    Chocolate Factory
    Posts
    21

    Default

    Ok, i'll try that way, thanks you so much for the explanation. I'll post here if something comes up. Thnx again.

  4. #4
    MSgt. Shooter Person
    Join Date
    Sep 2011
    Posts
    116

    Default k24101990

    is this online server?
    can u explain step and detail one by one
    can i take my game to public server without steam , Hamachi ,gamespy
    i want to create online game for 10-15 people

  5. #5
    Iron Guard
    Join Date
    Jan 2011
    Location
    Netherlands
    Posts
    738
    Gamer IDs

    Gamertag: ColdGuy

    Default

    Quote Originally Posted by k24101990 View Post
    is this online server?
    can u explain step and detail one by one
    can i take my game to public server without steam , Hamachi ,gamespy
    i want to create online game for 10-15 people
    I really want to do this for my game. For my game we want a 3 max co-op per game. we're only at the concept fase now and i have no idea how to set up multiplayer stuff...

    could anyone give me some tips?

  6. #6
    MSgt. Shooter Person
    Join Date
    Sep 2011
    Posts
    116

    Default

    i belived it has many people want to do this
    i research about this
    found something but i don't understand
    DLLBind ---->what is this it connect with game online server isn't it?
    Server Bowser --->what is these
    MasterServer ---->whoeooo
    TCPLink ----> oh my god

    i don't know which on these use to create server public online without programs(steam)
    i confuse and try it's very hard to do something like these

  7. #7
    Prisoner 849
    Join Date
    Nov 2007
    Location
    0,0,0
    Posts
    913
    Gamer IDs

    Gamertag: BobGneu

    Default

    Quote Originally Posted by k24101990 View Post
    i belived it has many people want to do this
    i research about this
    found something but i don't understand
    DLLBind ---->what is this it connect with game online server isn't it?
    Server Bowser --->what is these
    MasterServer ---->whoeooo
    TCPLink ----> oh my god

    i don't know which on these use to create server public online without programs(steam)
    i confuse and try it's very hard to do something like these
    DLLBind is used to allow you to write C++ code that your UnrealScript code can execute.
    TCPLink is not that bad, its actually pretty straight forward. It just wraps up the sending of text over the TCP protocol.

    http://bettertech.gneu.org/blog/2011...ystem-for-udk/ << tutorial of TCPLink connecting to a web server.

    The Server browser and master server id need to understand context to respond to. Typically server browsers allow you to browse servers. Master Server is a label applied to the server that oversees all others, you would likely find these in online games that store high scores and the like.
    About Me | My Blog | Solarity

    TechnicalHome | ScaleformTechnicalGuide | UnrealScriptReference | ReplicationHome | MasteringUnrealScriptBaptismByFire

    Kismet makes sense to me when i 'read' it seeming mostly logic based

  8. #8
    MSgt. Shooter Person
    Join Date
    Sep 2011
    Posts
    116

    Default Step

    thank you bob it's clear in my mind

    i want to create Server pubplic what have i do with mygameinfo.uc
    mycontroller.uc mypawn.uc ..... ...... ....

    i'm a newbie about coder PHP C+ ASP
    it's hard for me to talk my game UDK on pubplic Server

    i want to make client to connect easy way without steam hamachi .....

    please give me step one by one please ...

  9. #9
    Prisoner 849
    Join Date
    Nov 2007
    Location
    0,0,0
    Posts
    913
    Gamer IDs

    Gamertag: BobGneu

    Default

    I don't think you are on the same page. It sounds like you want to network the game with TCPLink, and that is not going to happen. I think the only way i can help you is if you actually explain what you want to do better.

    I am also fairly sure that you wont be getting a "step one by one" walk through of it, because with my tutorial and the other ones out there you already have as much detail as will be provided.
    About Me | My Blog | Solarity

    TechnicalHome | ScaleformTechnicalGuide | UnrealScriptReference | ReplicationHome | MasteringUnrealScriptBaptismByFire

    Kismet makes sense to me when i 'read' it seeming mostly logic based

  10. #10
    MSgt. Shooter Person
    Join Date
    Sep 2011
    Posts
    116

    Default

    actually i want to take my game to pubplic (online) without steam hamachi
    how can i do that ?is it possible?
    i don't know where i begin these?

    one more what is Replication?
    is it about online server?
    Last edited by k24101990; 09-08-2011 at 02:44 AM.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.