Chapter XIV

Managing the Amount of Data Sent

 

  We have actually been managing the amount of data sent through out the program, but now we will add some final touches. What we want to do for each entity that is created is to decide what nosend flags to activate. How we decide this depends on how that entity is handled during game play. For instance, if we are allowing our players to be scaled, let's say, they grow bigger the more health they have by using my.scale_x, my.scale_y, and my.scale_z, the we would want to make sure that we don't turn on the nosend_scale flag.

  So let's add the no_send flags to each of our entities now. We will start with the player entities in function move_player.

 

my.ENABLE_DISCONNECT = ON; // player can disconnect from session

my.EVENT = player_events; // player events function

 

my.nosend_scale = ON;

my.nosend_skin = ON;

my.nosend_ambient = ON;

my.nosend_alpha = ON;

my.nosend_light = ON;

my.nosend_color = ON;

my.nosend_frame = ON; // don't send animation

 

  Now let's consider the weapons. Well, actually all the weapons are created locally so they are not sending anything anyway so we don't have to worry about them. All we have to worry about is entities created with ent_create().

  So let's move on to the projectiles next. Let's add these no_sends in the projectile_function.

 

my.enable_entity = ON;

my.enable_block = ON;

my.event = projectile_event;

 

my.nosend_scale = ON;

my.nosend_frame = ON;

my.nosend_skin = ON;

my.nosend_flags = ON;

my.nosend_ambient = ON;

my.nosend_alpha = ON;

my.nosend_light = ON;

my.nosend_color = ON;

 

  Next, let's do the ammunition power-ups's in the ammo_function.

 

my.ENABLE_IMPACT = ON; // event for hit by another moving entity

my.EVENT = ammo_event; // event function

 

// Nosends - don't send what we don't need to

my.nosend_scale = ON;

  my.nosend_frame = ON;

my.nosend_skin = ON;

my.nosend_flags = ON;

my.nosend_ambient = ON;

my.nosend_alpha = ON;

my.nosend_light = ON;

my.nosend_color = ON;

 

 I think that should do it. You can study what each no_send flag does in the manual or Appendix I.

 Shall we move on and finish this tutorial?

 

Previous Page Contents Next Page