They use now the Google Protobuf from here
https://code.google.com/p/protobuf/
There is also the google::protobuf::Message class
And Here they use it in Dota2:
https://developer.valvesoftware.com/..._2_Demo_Format
Here is the API of the Message Class
https://developers.google.com/protoc...otobuf.message
This seems interesting, too:
PHP Code:
//====== Copyright (c) 2012, Valve Corporation, All rights reserved. ========//
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
//===========================================================================//
//
// Purpose: The file defines our Google Protocol Buffers which are used in over
// the wire messages for the Source engine.
//
//=============================================================================
// We care more about speed than code size
option optimize_for = SPEED;
// We don't use the service generation functionality
option cc_generic_services = false;
//
// STYLE NOTES:
//
// Use CamelCase CMsgMyMessageName style names for messages.
//
// Use lowercase _ delimited names like my_steam_id for field names, this is non-standard for Steam,
// but plays nice with the Google formatted code generation.
//
// Try not to use required fields ever. Only do so if you are really really sure you'll never want them removed.
// Optional should be preffered as it will make versioning easier and cleaner in the future if someone refactors
// your message and wants to remove or rename fields.
//
// Use fixed64 for JobId_t, GID_t, or SteamID. This is appropriate for any field that is normally
// going to be larger than 2^56. Otherwise use int64 for 64 bit values that are frequently smaller
// than 2^56 as it will safe space on the wire in those cases.
//
// Similar to fixed64, use fixed32 for RTime32 or other 32 bit values that are frequently larger than
// 2^28. It will safe space in those cases, otherwise use int32 which will safe space for smaller values.
// An exception to this rule for RTime32 is if the value will frequently be zero rather than set to an actual
// time.
//
import "google/protobuf/descriptor.proto";
// for CMsgVector, etc.
import "netmessages.proto";
//=============================================================================
// Base User Messages
//=============================================================================
enum EBaseUserMessages
{
UM_AchievementEvent = 1;
UM_CloseCaption = 2;
UM_CloseCaptionDirect = 3; // Shares message def CUserMsg_CloseCaption
UM_CurrentTimescale = 4;
UM_DesiredTimescale = 5;
UM_Fade = 6;
UM_GameTitle = 7;
UM_Geiger = 8;
UM_HintText = 9;
UM_HudMsg = 10;
UM_HudText = 11;
UM_KeyHintText = 12;
UM_MessageText = 13;
UM_RequestState = 14;
UM_ResetHUD = 15;
UM_Rumble = 16;
UM_SayText = 17;
UM_SayText2 = 18;
UM_SayTextChannel = 19;
UM_Shake = 20;
UM_ShakeDir = 21;
UM_StatsCrawlMsg = 22;
UM_StatsSkipState = 23;
UM_TextMsg = 24;
UM_Tilt = 25;
UM_Train = 26;
UM_VGUIMenu = 27;
UM_VoiceMask = 28;
UM_VoiceSubtitle = 29;
UM_SendAudio = 30;
// Game specific user messages should start after this
UM_MAX_BASE = 63;
}
//=============================================================================
message CUserMsg_AchievementEvent
{
optional uint32 achievement = 1;
}
message CUserMsg_CloseCaption
{
optional fixed32 hash = 1;
optional float duration = 2;
optional bool from_player = 3;
}
message CUserMsg_CurrentTimescale
{
optional float current = 1;
}
message CUserMsg_DesiredTimescale
{
optional float desired = 1;
optional float duration = 2;
optional uint32 interpolator = 3;
optional float start_blend_time = 4;
}
message CUserMsg_Fade
{
optional uint32 duration = 1;
optional uint32 hold_time = 2;
optional uint32 flags = 3;
optional fixed32 color = 4;
}
message CUserMsg_Shake
{
optional uint32 command = 1;
optional float amplitude = 2;
optional float frequency = 3;
optional float duration = 4;
}
message CUserMsg_ShakeDir
{
optional CUserMsg_Shake shake = 1;
optional CMsgVector direction = 2;
}
message CUserMsg_Tilt
{
optional uint32 command = 1;
optional bool ease_in_out = 2;
optional CMsgVector angle = 3;
optional float duration = 4;
optional float time = 5;
}
message CUserMsg_SayText
{
optional uint32 client = 1;
optional string text = 2;
optional bool chat = 3;
}
message CUserMsg_SayText2
{
optional uint32 client = 1;
optional bool chat = 2;
optional string format = 3;
optional string prefix = 4;
optional string text = 5;
optional string location = 6;
}
message CUserMsg_HudMsg
{
optional uint32 channel = 1;
optional float x = 2;
optional float y = 3;
optional uint32 color1 = 4;
optional uint32 color2 = 5;
optional uint32 effect = 6;
optional float fade_in_time = 7;
optional float fade_out_time = 8;
optional float hold_time = 9;
optional float fx_time = 10;
optional string message = 11;
}
message CUserMsg_HudText
{
optional string message = 1;
}
message CUserMsg_TextMsg
{
optional uint32 dest = 1;
repeated string param = 2;
}
message CUserMsg_GameTitle
{
}
message CUserMsg_ResetHUD
{
}
message CUserMsg_SendAudio
{
///optional fixed32 hash = 1; // sound hash
optional bool stop = 2;
optional string name = 3; // sound name
}
message CUserMsg_VoiceMask
{
repeated int32 audible_players_mask = 1;
optional bool player_mod_enabled = 2;
}
message CUserMsg_RequestState
{
}
message CUserMsg_HintText
{
optional string message = 1;
}
message CUserMsg_KeyHintText
{
repeated string messages = 1;
}
message CUserMsg_StatsCrawlMsg
{
}
message CUserMsg_StatsSkipState
{
optional int32 num_skips = 1;
optional int32 num_players = 2;
}
message CUserMsg_VoiceSubtitle
{
optional int32 ent_index = 1;
optional int32 menu = 2;
optional int32 item = 3;
}
message CUserMsg_VGUIMenu
{
optional string name = 1;
optional bool show = 2;
message Keys
{
optional string name = 1;
optional string value = 2;
}
repeated Keys keys = 3;
}
message CUserMsg_Geiger
{
optional int32 range = 1;
}
message CUserMsg_Rumble
{
optional int32 index = 1;
optional int32 data = 2;
optional int32 flags = 3;
}
message CUserMsg_Train
{
optional int32 train = 1;
}
message CUserMsg_SayTextChannel
{
optional int32 player = 1;
optional int32 channel = 2;
optional string text = 3;
}
message CUserMsg_MessageText
{
optional uint32 color = 1;
optional string text = 2;
}
__________________