Problem with a big amount CreatePlayerObject
#1

Dear Kalcor, long time there is a problem with lags due to the big amount PlayerObjects.
Test for example, data from my server (with sleep 1):
Maximum ServerTickRate with 0 PlayerObject: 892
Maximal ServerTickRate with 999 PlayerObject: 870

When large online this very lowers productivity

Due to update SA-MP, we can used more objects, this problem becomes even more significant.

Sorry for my bad english.
Reply
#2

Are you sure it's not caused by the streamer plugin?
Reply
#3

Quote:
Originally Posted by Kalcor
View Post
Are you sure it's not caused by the streamer plugin?
No. I created its objects in GameMode (CreatePlayerObject)
Reply
#4

I tested creating 2000 player objects and it didn't change the server's tickrate
Reply
#5

I checked again on blank game mode on win and linux server. This problem only in linux (tested on three different dedicated server)
I can provide a Linux server if needed
Reply
#6

Quote:
Originally Posted by Kalcor
View Post
I tested creating 2000 player objects and it didn't change the server's tickrate
Testing this way: NPC like players. Its the same result:

Option 1 30% CPU:
Code:
#include <a_samp>

main(){}

public OnGameModeInit()
{
	for(new i;i<100;i++)
	{
		SetTimerEx("CNPC",10*i,0,"i",i);
	}
	return 1;
}
forward CNPC(i);
public CNPC(i)
{
    new string[MAX_PLAYER_NAME];
    format(string,sizeof(string),"Nick%d",i);
	ConnectNPC(string,"none");
	return 1;
}

public OnPlayerConnect(playerid)
{
	for(new i;i<1000;i++) CreatePlayerObject(playerid,1234,0.0,0.0,0.0,0.0,0.0,0.0);//KO more CPU
	return 1;
}
Screen:
http://www.img.tpx.cz/uploads/test_C...ayerObject.png

Option 2 15% CPU
Code:
#include <a_samp>

main(){}

public OnGameModeInit()
{
    for(new i;i<1000;i++) CreateObject(1234,0.0,0.0,0.0,0.0,0.0,0.0);//OK lower CPU

	for(new i;i<100;i++)
	{
		SetTimerEx("CNPC",10*i,0,"i",i);
	}
	return 1;
}
forward CNPC(i);
public CNPC(i)
{
    new string[MAX_PLAYER_NAME];
    format(string,sizeof(string),"Nick%d",i);
	ConnectNPC(string,"none");
	return 1;
}
Screen:
http://www.img.tpx.cz/uploads/test_CreateObject.png


The CPU and memory usage is measured for 3 minutes after the last NPC is connected


This is none.pwn (npcmodes)
Code:
#include <a_npc>

public OnRecordingPlaybackEnd()
{
    StartRecordingPlayback(PLAYER_RECORDING_TYPE_ONFOOT,"none");
}

public OnNPCSpawn()
{
    StartRecordingPlayback(PLAYER_RECORDING_TYPE_ONFOOT,"none");
}
and here is "none.rec":
http://151.80.108.166/none.rec
Reply
#7

The player object code in the server is pretty old (SA-MP 0.2). I have some code ready to replace it but it hasn't been enabled yet. It should improve the CPU usage.
Reply
#8

Many thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)