Ent_create with no_send=on problem?

Posted By: nkl

Ent_create with no_send=on problem? - 01/23/07 06:33

Ent_create with no_send=on doesn’t creates an a global entity on all connected clients.
Hello.
I am registered A6 pro user.
I use A6 Pro Edition V6.50.6.
I want to reduce the network bandwidth and lag.
I use Ent_create with no_send=on that beats bandwidth.
I write my own movement script for the clients that beats lag.
I have 4 computers.
In computer 1, I start the program in –sv mode.
And then on other 3 computer I start the program in -cl mode.
I find it doesn’t create a global entity on all 3 connected clients.
I want to figure out what cause the problem.
I delete my own movement script.
And test again.
The problem is still happen.
When I delete the no_send=on statement, and test again.
This time I find it can create a global entity on all 3 connected clients.
How do I use Ent_create with no_send=on to creates a global entity on all 3 connected clients.

Thanks for any advice on this problem.
Thanks already.

Following is whole script.
Code:
  
path ".\\Models";
path ".\\Entities";
path ".\\Bitmaps";
//
var video_mode = 6;
var video_screen = 2;
string world_str = <multiplayer.wmb>;
string str_warlock = <blue_warlock.mdl>;
string str_cbabe = <cbabe.mdl>; // CBabe Model
string str_guard = <red_guard.mdl>; // Red Guard Model
function ghost_player()
{
my.nosend=on;
while(1)
{
wait(1);
}
}
//
function move_player()
{
//---
ent_sendnow(my); // force model and position to be sent in the next cycle
wait(1); // make sure it's sent now
my.nosend = on; // don't send anything further
my.nosend_sound=on;
my.nosend_origin=on;
my.nosend_angles=on;
my.nosend_scale=on;
my.nosend_frame=on;
my.nosend_skin=on;
my.nosend_flags=on;
my.nosend_ambient=on;
my.nosend_light=on;
my.nosend_color=on;
my.nosend_uv=on;
//----
wait(1);
proc_local(my,ghost_player);
//
while (1)
{
wait (1);
}
//
}

function main()
{

dplay_smooth = 0;
randomize(); // set random seed

level_load(world_str); // load level
wait(1); // make sure level is loaded
var temp_loc[3];
temp_loc.x =-400 + random(800);
temp_loc.y =-400 + random(800);
temp_loc.z = 0;
ifdef SERVER;
if (connection != 1) // only create a guard on the client/server
{
player = ent_create(str_guard,temp_loc,move_player);
}
ifelse;
player = ent_create(str_cbabe,temp_loc,move_player);
endif;

wait(-0.5);
while (!player)
{wait(1);} // sleep until the player is initialized

wait(1); // give everything a chance to get started before we allow the player to move

move_camera (); // attach a camera to the player
//
}

function move_camera()
{
while (player == NULL)
{
wait (1);
}


while (player != NULL) // player exist?
{
player.x += key_force.y*5; // get force x
player.y += -key_force.x*5; // get force y
player.z = 0; // force z always 0 for now
player.pan+=mouse_force.x*10;
camera.x = player.x - cos (player.pan) * 200;
camera.y = player.y - sin (player.pan) * 200;
camera.z = player.z + 75;
camera.pan = player.pan;
wait (1);
}

}









Posted By: jcl

Re: Ent_create with no_send=on problem? - 01/23/07 10:46

From the manual:

"When setting this flag immediately after entity creation, the entity can remain invisible on the client because it's file name and position is not sent. For preventing this, set a nosend flag only after the time between two entity updates, given by dplay_entrate, is passed."
Posted By: nkl

Re: Ent_create with no_send=on problem? - 01/23/07 19:32

Quote:

From the manual:

"set a nosend flag only after the time between two entity updates, given by dplay_entrate, is passed."




Hello.
Thanks for your advice on this problem.
I try change the wait statement before nosend=on from wait(1) to wait(-1).
But the problem is still happen.
I try a number of methods to set a nosend flag only after the time between two entity updates, but all my methods have failed.
Accounting to above code do you have any ideas on how to do it?

Thanks already.

Posted By: nkl

Re: Ent_create with no_send=on problem? - 01/25/07 04:24

can anyone help with this?
Posted By: jcl

Re: Ent_create with no_send=on problem? - 01/26/07 05:33

I am not sure what you want to achieve. Do you use an external DLL for sending entity data, or do you just want to limit the bandwidth? The NOSEND flag that stops all entity communication is for the former case, the individual NOSEND_.. flags for the latter case.
Posted By: nkl

Re: Ent_create with no_send=on problem? - 01/26/07 14:58

hello!
It is because I use an external DLL for sending and receiving entity (position and angle) update data. So I use NOSEND flag that stops all entity communication.
But when I use Ent_create with NOSEND flag, it creates an entity on the server but doesn’t create this entity on all connected clients.
If I run above post script on 4 computers as follow
On computer1, I run the above script in –sv mode.
On computer2, I run the above script in –cl mode. It can display this client entity.
On computer3, I run the above script in –cl mode. This time you can see that it doesn’t create computer2 entity on computer3.
On computer4, I run the above script in –cl mode. This time you can see that it doesn’t create both of the computer2 entity and the computer3 entity on computer4.

how do I use Ent_create with NOSEND flag can creates an entity on the server and on all connected clients?

Thanks for any advice on this problem.
Thanks already.
Posted By: jcl

Re: Ent_create with no_send=on problem? - 01/26/07 16:19

The NOSEND flag just interrupts the communication after it's set. The engine has no precognition function yet.

So you only need to make sure that NOSEND is set _after_ the server has sent the entity position and model file name to the clients, so they appear there. The safest way to do that is using a local function that sends an entity skill back from the clients to the server, and only set NOSEND after that skill is received.
© 2024 lite-C Forums