client_id stays negative

Posted By: Superku

client_id stays negative - 02/25/15 11:02

I have a problem with my current multiplayer code which I cannot seem to figure out. I have a grenade launcher and I create grenades on the server globally (clients request the creation). The start of the entity function is as follows:

Code:
void shoot_grenade()
{
	set(my,TRANSLUCENT | PASSABLE);
	while(my.client_id < 0)
	{
		draw_num3d(my.client_id,my.x,0,COLOR_WHITE);
		wait(1);
	}
	reset(my,TRANSLUCENT | PASSABLE);
	...
}


Most of the time it works nicely but sometimes (every 1-30th grenade) the entity creation does not seem to get confirmed and client_id stays negative (some value, the same on both client and server). Have you any idea what could cause such behavior?
Why does it get negative on the server anyway, shouldn't that only be happening on a client's computer?

The setup is Server+client (connection == 3), a client, current A8 pro version with session_open/ connect and
Code:
dplay_localfunction = 2;
dplay_entrate = 100; // does not make a difference if 1 or 100 for that problem
dplay_smooth = 0;
dplay_maxclients = 16;
dplay_diag = 1;


Btw. I can send in the project if necessary, it's not that huge and only mildly confusing.
Posted By: jcl

Re: client_id stays negative - 02/25/15 12:37

Does this only happen with grenades created by the server-client, or also with grenades created by a client?
Posted By: Superku

Re: client_id stays negative - 02/25/15 16:22

I had to change the code slightly to test that but the entity/ grenade creation seems to work flawlessly when ent_create is triggered on the client's computer/ application. This can be used as a workaround but for multiple reasons I would prefer to keep the grenade creation server-side.

(EDIT: In the old/ regular version ent_create only gets called on the server(-client), and all player and bot entities request the creation by some skill manipulation.)
Posted By: jcl

Re: client_id stays negative - 02/26/15 15:25

Ok, can you send us the project? Preferably in a state where the problem can be seen without much preparations?
Posted By: Superku

Re: client_id stays negative - 02/26/15 20:08

An e-mail has been sent, thanks in advance.
Posted By: jcl

Re: client_id stays negative - 02/27/15 10:47

Thanks, we'll look into it and forward it to the developer when the problem can be confirmed.
© 2024 lite-C Forums