• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code Mutator constantly freeze with TCP client

Schneider95

Grizzled Veteran
Jan 7, 2012
303
1
Paris
Hello everybody.

I have started to look how we can program Mutator for Killing Floor.
I have red several tutorial like those on this thread, and some page on wiki.beyondunreal.com.

To help me to understand how all this code work, i got an idea : in my MyMutator::postBeginPlay method, i initiate a TCP client, with the method explicated in this tutorial http://wiki.beyondunreal.com/Legacy:Creating_A_TCP_Client, and i do a myTcp.SendText to see which value are used in which method.

But there is the problem : the game freeze, soon or later. The game window is still here, but nothing move.

In the Timer function of MyMutator class, i do this :

Code:
MyTcp.SendText("myMessage");

And most of the time, it works fine during all game. If i launched a game with this mutator enabled, and if i create a TCP server with another program listening to the correct IP:port , i received "myMessage", every seconds.

But if i do the same thing in other class like MyPlayerController, MyHumanPawn, or MyGameRules, the game freeze during the second wave.

In MyGameRules class, i wrote this, and the game freeze quickly :
Code:
var myMutator MutatorRef;
...
...
function ScoreKill(Controller Killer, Controller Killed)
{
	Super.ScoreKill(Killer, Killed);	
	MutatorRef.MyTcp.SendText(Killed.PlayerReplicationInfo.PlayerName$" killed by a "$Killer.Pawn.MenuName);
...
...

Is it a normal use to send TCP packet in mutator code ? With so many freeze, i start to think it's not a recommended think to do.

Thanks by advance.
 
Last edited:
Try to make something like request to tcplink.

Code:
MyMut.TcpLink.Request(MyInfo);

...

class SomeTcpLink extends TcpLink;

var array<string> PendingRequests;

...

function Request(string s)
{
	PendingRequests[PendingRequests.Length] = s;
	SetTimer(0.05,false);
}

...

function Timer()
{
	local int i;
	
	i = PendingRequests.Length;
	while(i > 0)
	{
		SendText(PendingRequests[0]);
		PendingRequests.Remove(0,1);
		--i;
	}
}
 
Upvote 0