Little more smoothness for Multiplayer: Before dropping Powerups in random segment, make sure it's accessible by the player who drops it; Got rid of goto in InitPlayerPositions() and made code more D2-ish; Allow host to send 50 object/extra packets per second which does not overload network stack, yet but speeds up joining

This commit is contained in:
zicodxx 2011-02-02 23:51:29 +01:00
parent 17d0482938
commit 728442ff96
5 changed files with 20 additions and 20 deletions

View file

@ -4,6 +4,7 @@ D1X-Rebirth Changelog
--------
arch/include/event.h, arch/include/joy.h, arch/include/key.h, arch/include/mouse.h, arch/sdl/event.c, arch/sdl/joy.c, arch/sdl/key.c, arch/sdl/mouse.c, main/automap.c, main/endlevel.c, main/game.c, main/gamecntl.c, main/inferno.c, main/kconfig.c, main/kconfig.h, main/multi.c, main/newmenu.c, main/slew.c: Added event types for all input actions; Rewrote kconfig code to work with events; static defined inputs will not trigger kconfig-mapped inputs anymore; Simplified keyboard, mouse and joystick code a lot due to event-based handling; Added function to toggle SDL key repeats on and off; Put timer_update() to event_process; Removed return when event_poll() is idle to get cursor hiding to work again; Added a small delay between cursoe hiding and re-enabling to cursor will not accidentially enable by SDL event centering cursor while hiding
arch/ogl/ogl.c: After rendering Reboot reticle, reset glLineWidth to default value again
main/fireball.c, main/gameseq.c, main/net_ipx.c, main/net_udp.c: Little more smoothness for Multiplayer: Before dropping Powerups in random segment, make sure it's accessible by the player who drops it; Got rid of goto in InitPlayerPositions() and made code more D2-ish; Allow host to send 50 object/extra packets per second which does not overload network stack, yet but speeds up joining
20110126
--------

View file

@ -393,9 +393,8 @@ int pick_connected_segment(object *objp, int max_depth)
return -1;
}
#define BASE_NET_DROP_DEPTH 10
#define BASE_NET_DROP_DEPTH 10
#ifdef NETWORK
// ------------------------------------------------------------------------------------------------------
// Choose segment to drop a powerup in.
// For all active net players, try to create a N segment path from the player. If possible, return that
@ -430,7 +429,9 @@ int choose_drop_segment(void)
}
if (segnum == -1) {
return (d_rand() * Highest_segment_index) >> 15;
while (cur_drop_depth > 0 && segnum == -1) // before dropping in random segment, try to find ANY segment which is connected to the player responsible for the drop so object will not spawn in inaccessible areas
segnum = pick_connected_segment(&Objects[Players[Player_num].objnum], --cur_drop_depth);
return ((segnum == -1)?((d_rand() * Highest_segment_index) >> 15):segnum); // basically it should be impossible segnum == -1 now... but oh well...
} else
return segnum;
@ -483,7 +484,6 @@ void maybe_drop_net_powerup(int powerup_type)
object_create_explosion(segnum, &new_pos, i2f(5), VCLIP_POWERUP_DISAPPEARANCE );
}
}
#endif
// ------------------------------------------------------------------------------------------------------
// Return true if current segment contains some object.

View file

@ -1331,15 +1331,14 @@ void InitPlayerPosition(int random)
if (! ((Game_mode & GM_MULTI) && !(Game_mode&GM_MULTI_COOP)) ) // If not deathmatch
NewPlayer = Player_num;
#ifdef NETWORK
else if (random == 1)
{
int i, closest = -1, trys=0;
fix closest_dist = 0x7ffffff, dist;
timer_update();
d_srand((fix)timer_query());
do {
timer_update();
d_srand((fix)timer_query());
trys++;
NewPlayer = d_rand() % NumNetPlayerPositions;
@ -1348,28 +1347,28 @@ void InitPlayerPosition(int random)
for (i=0; i<N_players; i++ ) {
if ( (i!=Player_num) && (Objects[Players[i].objnum].type == OBJ_PLAYER) ) {
dist = find_connected_distance(&Objects[Players[i].objnum].pos, Objects[Players[i].objnum].segnum, &Player_init[NewPlayer].pos, Player_init[NewPlayer].segnum, 10, WID_FLY_FLAG );
dist = find_connected_distance(&Objects[Players[i].objnum].pos, Objects[Players[i].objnum].segnum, &Player_init[NewPlayer].pos, Player_init[NewPlayer].segnum, 15, WID_FLY_FLAG ); // Used to be 5, search up to 15 segments
if ( (dist < closest_dist) && (dist >= 0) ) {
closest_dist = dist;
closest = i;
}
}
}
} while ( (closest_dist<i2f(10*20)) && (trys<MAX_NUM_NET_PLAYERS*2) );
} while ( (closest_dist<i2f(15*20)) && (trys<MAX_NUM_NET_PLAYERS*2) );
}
#endif
else {
goto done; // If deathmatch and not random, positions were already determined by sync packet
else
{
// If deathmatch and not random, positions were already determined by sync packet
reset_player_object();
reset_cruise();
return;
}
Assert(NewPlayer >= 0);
Assert(NewPlayer < NumNetPlayerPositions);
ConsoleObject->pos = Player_init[NewPlayer].pos;
ConsoleObject->orient = Player_init[NewPlayer].orient;
obj_relink(ConsoleObject-Objects,Player_init[NewPlayer].segnum);
done:
obj_relink(ConsoleObject-Objects,Player_init[NewPlayer].segnum);
reset_player_object();
reset_cruise();
}

View file

@ -1310,7 +1310,7 @@ void net_ipx_send_objects(void)
int player_num = IPX_sync_player.player.connected;
static fix64 last_send_time = 0;
if (last_send_time + (F1_0/10) > timer_query())
if (last_send_time + (F1_0/50) > timer_query())
return;
last_send_time = timer_query();

View file

@ -1354,7 +1354,7 @@ void net_udp_send_objects(void)
int loc = 0, i = 0, remote_objnum = 0, obj_count_frame = 0;
static fix64 last_send_time = 0;
if (last_send_time + (F1_0/10) > timer_query())
if (last_send_time + (F1_0/50) > timer_query())
return;
last_send_time = timer_query();
@ -4567,7 +4567,7 @@ void net_udp_send_extras ()
{
static fix64 last_send_time = 0;
if (last_send_time + (F1_0/10) > timer_query())
if (last_send_time + (F1_0/50) > timer_query())
return;
last_send_time = timer_query();