HL SDK 2.3
Game and client DLL networking hooks.
In this SDK release, additional networking functionality has been exposed to the MOD author for customization. In particular, it is now possible for a game server to customize the entities sent to a particular player. In addition, the game .dll is given the opportunity to add or remove any game entity to any client's update, rather than being strictly PVS-bound in that functionality.
From the game .dll side, most of the relevant code can be found in the file client.cpp.
The following functions have been added :
A client can have a separate "view entity" indicating that his/her view should depend on the origin of that view entity. If that's the case, then pViewEntity will be non-NULL and will be used. Otherwise, the current entity's origin is used. Either is offset by the view_ofs vector to get the eye position. From the eye position, the MOD author then can set up the PAS ( potentially audible set ) and PVS ( potentially visible set ) used for filtering network messages to the client. At this point, the MOD author could override the actual PAS or PVS values, or, more importantly, specify a different origin for determining the PVS or PAS. NOTE: MOD authors should not cache the returned values of the PAS and PVS indefinitely because they depend on re-usable memory in the engine. In other words, they are only good for one frame.
When the server is preparing to send a player an update packet containing the most recent state information for all server controlled entities, the server loops through all of the game entities and calls into the game .dll with the AddToFullPack function. Here, a MOD can choose which entities to actually send. If the game .dll returns 1, this signals that the entity should be sent to the client and that the relevant fields of the state structure have been filled in ( note that a MOD author could altar particularly fields to create client-specific effects, if desired ). If the game .dll returns 0, then the entity will not be sent to the client. The state pointer is the server maintained copy of the state info that is transmitted to the client. As noted above, a MOD could alter values copied into state to send the "host" ( i.e., the player for whom we are creating this update ) a different look, etc. for a particular entity. The variables e and ent are the index and pointer to the entity that is being added to the update. The variable host is the player edict of the player whom we are sending the update to. The variable player is set to 1 if the ent/e is itself a player and 0 otherwise. In addition, pSet is either the PAS or PVS that we previously specified in the call to SetupVisibility(). We can, if we want to, use it to ask the engine to filter the entity against the PAS or PVS. A MOD could, for a particular player, ignore the PVS and PAS and use some other scheme to determine which entities should be sent to the host player. This affords total control to the mod author to filter and modify the list of entities sent to each client.
For more efficient networking, the server creates a "baseline" state for each entity in the world and transmits this to the client during signon. Then, when sending updates to the entity, the server can simply encode the differences from the baseline, rather than a NULL or "empty" state. This leads to far less bandwidth usage for such entities.
Entity_Encode() and Player_Encode()
These functions are special "callback" functions registered in RegisterEncoders. They are specified in delta.lst, as will be explained below. For the type of data structure being encoded, if an encoder is specified, the encoder is invoked and can set/unset certain fields from being sent over the network link.
This function fills in the data this is sent from the server only to the "host" or local player. The data structure is defined in entity_state.h
CmdStart() and CmdEnd()
Each time a movement command for a player is executed by the server, these functions are called so that the game server can enable any required command logic.
This callback is invoked whenever a "query" type packet is received by the engine and that packet has not been properly parsed by the engine. The game .dll can, using this function, develop and respond to custom query protocols.
The new SDK and engine support changing the sizes of the collision hulls ( this requires that the tools [ qcsg.exe ] also specify matching collision hulls. The source to qcsg in the SDK has been updated with this new functionality. ). The new collision hulls should be filled-in in this function ( and in the corresponding function HUD_GetHullBounds() in the client .dll ) so that player physics and ray tracing will work correctly against the new collision hull sizes.
The engine now allows creation of baselines for objects that are instanced on the fly ( e.g., projectiles, ammo packs ). Having a reasonable baseline for such classes allows for further bandwidth reduction when such entities are transmitted over to the client. If no instanced baseline exists, the the entity is compressed against a NULL or "empty" baseline.
Similar to the entity filtering code of the game .dll, the client .dll has been given an assortment of hooks into the entity system. For instance, each entity that is going to be added to the rendering queue for output to the screen is first passed into the HUD_AddEntity function in the cl_dll/entity.cpp file. If this function returns 0, then the entity will not be drawn.
In addition, as network data is read, the client .dll is given the chance to fill in the received data into the appropriate slots. This functionality can be seen in the HUD_TxferLocalOverrides, HUD_ProcessPlayerState, and HUD_TxferPredictionData functions.
Also, the client .dll is given the chance to create totally new entities each frame. By creating entities in HUD_CreateEntities() ( in entity.cpp ), the client .dll can simulate and draw arbitrary entities by itself ( including particle and temporary entities ). Some sample code demonstrating this has been left in entity.cpp, but is commented out.
Studio models which have animation events embedded in their animations now call through to the HUD_StudioEvent() function in entity.cpp to play back those events. Thus, models with new types of animation events can now be supported under the SDK.
Finally, the client .dll also can parse connectionless packets via HUD_ConnectionlessPacket() in the cdll_int.cpp file.
In addition, similar to GetHullBounds() in the game .dll, the client .dll can agree to a set of modified collision hulls by modifying the hulls returned in HUD_GetHullBounds in cdll_int.cpp.
MODs now have access to much of the encoding data used to encode Half-Life entities over the network. Upon startup the game engine loads the definitions for the chosen game directory from the file delta.lst. The definitions are used to send various data structures over the client / server link. The contents of delta.lst are encapsulated and sent to the client so that both the server and client are in agreement as to how to interpret networking data. Thus, the network protocols can be tweaked fairly extensively on the server side without requiring a revision to the engine itself.
The format for delta.lst is straightforward. The only lines that require additional explanation are the actual definitions, which take the form:
DEFINE_DELTA( origin, DT_SIGNED | DT_FLOAT, 21, 128.0 ),
This definition specifies that the x – array index  -- coordinate of the field named origin ( a three component vector field in this data structure ) represents a signed floating point value. When sending this value over the network, the value should be multiplied by 128.0, converted to an integer, and sent in 21 bits ( 20 for the value, 1 for the sign bit ). The receiving side will know to cast it to a floating point value and divide by 128.0 to obtain the final value on the remote side.
Care should be exercised in choosing the data type ( it must match that of the underlying data structure, other than the sign bit ). Also, values that fall outside of the specified bit range are clamped to the closest appropriate value.
There is a second kind of supported definition, DEFINE_DELTA_POST, which allows data munging after decoding on the client. The format is the same as above, except an additional floating point "post-multiply" factor is added to the end. After the value is received over the network, this factor is multiplied in to determine the final value received.
The valid data types that you can specify in delta.lst are:
DT_BYTE (1<<0) // A byte
DT_SHORT (1<<1) // 2 byte field
DT_FLOAT (1<<2) // A floating point field
DT_INTEGER (1<<3) // 4 byte integer
DT_ANGLE (1<<4) // A floating point angle ( will get masked correctly )
// A floating point timestamp, relative to sv.time and re-encoded on the client relative to the client's clock
DT_STRING (1<<6) // A null terminated string, sent as 8 byte chars
Finally, next to each data structure definition, is a parameter which specifies whether there is a special encoding function callback that should be called after the data fields have been set up for sending, but before actually sending the data fields. For instance,
entity_state_t gamedll Entity_Encode
signifies that we are going to define the encoding for the "entity_state_t" data structure ( see entity_state.h in the common directory ). For this structure, we ask that the engine call into the game .dll and invoke the callback function "Entity_Encode" after filling in data fields for this structure ( see client.cpp in the game .dll for the implementation of Entity_Encode ). If no special encoder is required, the definition would be written as:
Likewise, if the encoder is in the client.dll, then clientdll should be specified and the encoder callback as well. For now, the clientdll encoder parameter is ignored, though it may become available in a future release.
|Внеклассное мероприятие по английскому языку и литературе Леденева Татьяна Григорьевна|
«My Native Town». The game is devoted to our town Graivoron and Graivoron district. Three teams take part in the game, each of them...
|Play, acting, game or performance|
|Game Maker 1 Name : Nicolas Isakov||Magic of 10 (a Talk Show and a Game)|
|Exercise 1 game Ann arm care||Внеклассное мероприятие Intellectual Game "Jeopardy"|
|А я буду говорить о первоначальных навыках игростроения. Начнём с того, что каждая игра состоит из переменных. Например, кол-во жизней в игре это тоже переменная. Во втором урок|
Например, кол-во жизней в игре это тоже переменная. Во втором уроке мы будем знакомится и создовать игру на game maker. Так что примеры...
1. /Neil Strauss -The Game.pdf
|Указатель на буфер приёма LenBuffer (4 байта) Размер в байтах, буфера приёма|
Динамическая библиотека подпрограмм hid lib pb dll, была разработана в среде PureBasic 41 на основе исходного кода библиотеки пользовательских...
|Р п. Пинеровка Английский язык. Квн «Путешествие в страну знаний». 5 класс. Учитель Л. А. Ломакина. Разминка. The 1st game «Phonetics» Прочитай слова по транскрипции. Конкурс|