Package: pioneers-server-console Version: 0.10.2-2 Severity: wishlist
I have previously played multiplayer online games that had support for map voting, and had thoughts about what would be minimally required to implement this in the pioneers-server-console. Here's my thinking of what would be required:
* Server broadcast messages -- to allow a supporting script to notify game players of map voting actions. * Server-side logging -- logging of chat events and player join/exit events, allowing a supporting script to be aware that a player has voted for a map (and recording of how many human players there are)
This would have benefit to players, particularly for those people who do not have the ability to create their own server. In particular, it would make the the 'Lobby' level more meaningful, allowing people to vote for maps, rather than having to arrange with another user to set up their own server.
The following is a sample of what might be expected for chat within a game: Notice: This server supports voting ('map <name>') player0: map smalleurope Notice: 1 vote(s) for map 'smalleurope' player1: map conquest Notice: 1 vote(s) for map 'conquest' player2: map small europe Notice: 2 vote(s) for map 'smalleurope' player3: map small europe Notice: 3 vote(s) for map 'smalleurope' Notice: 3 (of 4) votes for map 'smalleurope' Notice: map 'SmallEurope' will be the next map to be playedI have attached a diff file for the server source files from the Debian source version 0.10.2-2, as well as an example script file that is able to support this modified server (assuming a looping server loading script that understands the idea of a next map).
diff -wu pioneers-0.10.2/server/admin.c pioneers-0.10.2.new/server/admin.c --- pioneers-0.10.2/server/admin.c 2006-09-17 07:27:32.000000000 +1200 +++ pioneers-0.10.2.new/server/admin.c 2006-11-19 14:29:09.000000000 +1300 @@ -51,6 +51,7 @@ gchar command[100]; gchar value_str[100]; gint value_int; + gchar remainder[100]; static gchar *server_port = NULL; static gboolean register_server = TRUE; static GameParams *params = NULL; @@ -59,6 +60,9 @@ sscanf(line, "admin %99s %99s", command, value_str); value_int = atoi(value_str); + /* parse the remainder string */ + sscanf(line, "admin %*s %99[ -~]", remainder); + /* set the GAME port */ if (!strcmp(command, "set-port")) { if (value_int) { @@ -133,6 +137,13 @@ params = cfg_set_game(value_str); } + } else if (!strcmp(command, "send-message")) { + if (value_str) { + if (server_is_running()) { + send_admin_message(remainder); + } + } + /* request to close the connection */ } else if (!strcmp(command, "quit")) { net_close(admin_session); Only in pioneers-0.10.2.new/server: .deps Only in pioneers-0.10.2.new/server: .dirstamp Common subdirectories: pioneers-0.10.2/server/gtk and pioneers-0.10.2.new/server/gtk diff -wu pioneers-0.10.2/server/player.c pioneers-0.10.2.new/server/player.c --- pioneers-0.10.2/server/player.c 2006-09-17 07:27:32.000000000 +1200 +++ pioneers-0.10.2.new/server/player.c 2006-11-19 14:40:00.000000000 +1300 @@ -109,11 +109,17 @@ } g_list_free(player->build_list); g_list_free(player->special_points); + log_message(MSG_INFO, _("player %d freed, %d player slot(s) active\n"), + player->num, game->num_players); g_free(player); return TRUE; case SM_NET_CLOSE: player_remove(player); if (player->num >= 0) { + log_message(MSG_INFO, _("Player %d(%s) has quit\n"), + player->num, player->name); + log_message(MSG_INFO, _("%d player slot(s) active\n"), + game->num_players); player_broadcast(player, PB_OTHERS, "has quit\n"); player_archive(player); } else { @@ -126,9 +132,12 @@ if (strlen(text) > MAX_CHAT) sm_send(sm, "ERR %s\n", _("chat too long")); - else + else{ player_broadcast(player, PB_ALL, "chat %s\n", text); + log_message(MSG_INFO, _("chat (%d): %s\n"), + player->num, text); + } g_free(text); return TRUE; } @@ -344,6 +353,10 @@ if (public) player_broadcast(player, PB_ALL, "is %s\n", player->name); + log_message(MSG_INFO, _("Player %d is now %s\n"), + player->num, player->name); + log_message(MSG_INFO, _("%d player slot(s) active\n"), + game->num_players); driver->player_renamed(player); driver->player_change(game); diff -wu pioneers-0.10.2/server/server.c pioneers-0.10.2.new/server/server.c --- pioneers-0.10.2/server/server.c 2006-09-17 07:27:32.000000000 +1200 +++ pioneers-0.10.2.new/server/server.c 2006-11-19 14:29:09.000000000 +1300 @@ -380,6 +380,15 @@ params->victory_points = MAX(3, victory_points); } +void send_admin_message(const gchar * message_string) +{ +#ifdef PRINT_INFO + g_print("cfg_send_message: %s\n", message_string); +#endif + player_broadcast(player_none(curr_game), PB_SILENT, + "NOTE %s\n", message_string); +} + GameParams *cfg_set_game(const gchar * game) { #ifdef PRINT_INFO diff -wu pioneers-0.10.2/server/server.h pioneers-0.10.2.new/server/server.h --- pioneers-0.10.2/server/server.h 2006-09-17 07:27:32.000000000 +1200 +++ pioneers-0.10.2.new/server/server.h 2006-11-19 14:29:09.000000000 +1300 @@ -216,6 +216,7 @@ void cfg_set_num_players(GameParams * params, gint num_players); void cfg_set_sevens_rule(GameParams * params, gint sevens_rule); void cfg_set_victory_points(GameParams * params, gint victory_points); +void send_admin_message(const gchar * message_string); void cfg_set_terrain_type(GameParams * params, gint terrain_type); void cfg_set_tournament_time(GameParams * params, gint tournament_time); void cfg_set_quit(GameParams * params, gboolean quitdone);
message_check.sh
Description: Bourne shell script