.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   United Bot (http://forums.bots-united.com/forumdisplay.php?f=46)
-   -   a 'server' class? (http://forums.bots-united.com/showthread.php?t=3257)

stefanhendriks 22-12-2004 19:54

a 'server' class?
 
i found in the RACC code, some things about a server.

But, i am thinking of NOT including that in my source. I mean, the server side things are mostly interface depended, so that would either mean i end up with lots of functions , but those are empty, or just double-working , because i do:

IF_ServerXXX
runs -> Actual function

which i find pointless

the only thing i can think of is like a round detection. What is handy? I'd like some sort of discussion. How to keep most code 'engine independent', but a tthe same time functional? ???:(

sfx1999 23-12-2004 01:43

Re: a 'server' class?
 
Do you really need a class for the server? Couldn't it just be a namespace?

Pierre-Marie Baty 23-12-2004 03:18

Re: a 'server' class?
 
What ? In my code anything that is in the server_t structure is completely engine and game independent. This structure deals about the most generic parameters that can be. Here's it's current state:
Code:

// server structure definition
typedef struct server_s
{
  bool is_dedicated; // set to TRUE if the server is a dedicated (standalone) server
  char map_name[32]; // name of the map currently playing on the server
  int max_players; // maximum number of connected client players this server allows at a time
  int max_entities; // maximum number of entities this server supports at a time
  bool is_multiplayer; // set to TRUE if the game going on is multiplayer (generally yes, duh)
  bool is_teamplay; // set to TRUE if the game going on is a team play game
  bool does_footsteps; // set to TRUE if the game rules allow footstep sounds
  char developer_level; // the current internal debug level this server is running on
  bool just_booted; // set to TRUE if this server has just booted on a particular map
  float start_time; // time at which the server started
  float time; // pointer to current time on server
  float previous_time; // past time on server, after the last frame has been rendered
  float frame_time; // last frame time, computed using time and previous_time
  float bot_check_time; // date at which the server will check the bot population
  int bot_count; // number of bots currently present on the server
  bool bot_requested; // set to TRUE if we are requested to slap a bot in
  char server_command[256]; // server command to be issued this frame
  char hud_printbuffer[16384]; // data to be printed to the listen server client's HUD this frame
  char console_printbuffer[16384]; // data to be printed to the server console this frame
  char aiconsole_printbuffer_left[512]; // data to be printed on the left AI console channel
  char aiconsole_printbuffer_center[512]; // data to be printed on the center AI console channel
  char aiconsole_printbuffer_right[512]; // data to be printed on the right AI console channel
  draw_line_t drawlines[256]; // array of beams the server must draw this frame
  int drawline_count; // the number of beams to draw this frame
} server_t;

I really see nothing engine or game specific in it ??

stefanhendriks 23-12-2004 09:53

Re: a 'server' class?
 
i probably misread it then, i was referring to Server() functions..

@$3.1415rin 23-12-2004 12:17

Re: a 'server' class?
 
maybe you could explain your 'pointless' quote a bit, dunno what you meant with that

Quote:

IF_ServerXXX
runs -> Actual function
this IF doesnt hve anything to do with "if", right ? it's "independant F...".

why not wrap all the functions ? most of them are similar in different engines, like entities. and when you have an additional wrapper class which handles handling your entities it won't be too difficult to write a SearchEntityInSphere function. and using a base class with empty virtual functions, you don't have trouble to call nonimplemented functions, since they simply do nothing and youi don't have to care about NULL function pointers ...

Pierre-Marie Baty 23-12-2004 14:59

Re: a 'server' class?
 
exactly my point Aspirin. In my code I use my own FindEntityInSphere, FindEntityByClassname, IsNull (FNullEnt equivalent), IndexOfEntity and the likes, etc, etc.

@Stefan: if you're talking about these functions:
Code:

player_t *HLEngine_CreateFakeClient (profile_t *pProfile);
void HLEngine_MoveFakeClient (player_t *pPlayer);
void HLEngine_FakeClientCommand (player_t *pPlayer);
void HLEngine_SendWelcomeMessage (player_t *pPlayer);
unsigned long HLEngine_InputButtonsOf (edict_t *pEntity);
void HLEngine_PrintHUD (void);
void HLEngine_PrintConsole (void);
void HLEngine_PrintGlow (char channel);
void HLEngine_DrawLines (void);
void HLEngine_ExtractFile (char *input_file, char *output_file);
void HLEngine_RACCServerCommandCallback (void);

they're not exported. They're used in the engine interface ONLY. The functions that are exported to the rest of the bot code are these ones:
Code:

// interface.cpp functions prototypes (these functions are exported)
test_result_t PlayerTestLine (player_t *pPlayer, vec v_start, vec v_end);
test_result_t PlayerTestHull (player_t *pPlayer, vec v_start, vec v_end, bool crouching_player);
test_result_t TestVisibility (vec v_start, vec v_end, entity_t *pIgnoredEntity);
vec GetBonePosition (entity_t *pEntity, int bone_number);
char FindMaterialType (entity_t *pEntityTextureIsOn, vec v_start, vec v_end);
bool PointBelongsToWorld (vec v_location);
bool IsLiquid (vec v_location);
bool IsThinAir (vec v_location);
float IlluminationOf (entity_t *pEntity);
void PlayerStartTalking (player_t *pPlayer);
void PlayerStopTalking (player_t *pPlayer);

I bet you understand things better now ;)


All times are GMT +2. The time now is 14:44.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.