Well, that makes a lot more sense than "a repository of definitions for a class’s data and function members that allows the engine to link, save/restore and otherwise understand the intention of those members"! Thanks.
Funny what happened to the text: those links were all inline when I sent it, but now they've been converted to a wiki-formatted references list. It can't be the list server doing that. Tom Leighton wrote:
AFAIK DATADESC is for saving games. The game can go through all the entities and see if they have a DATADESC, and as such save the values into the save file. When the game is loaded up again, it can repopulate that class with its correct values. (Hence why HL2MP_Player doesnt have one -- or does, but nothing in it) BEGIN_DATADESC( CHL2MP_Player ) END_DATADESC() Tom Edwards wrote: [ Converted text/html to text/plain ]I'm in the process of writing some programming documentation for VDC (it's a fantastic way to learn). Before I make any changes, I'd like to hear some feedback. :-) Some concerns of mine: I don't explicitly mention that you can call the functions from anywhere within a class, not just a think function. How obvious is it that you can do that? I don't mention DATADESC. I don't understand it, can't make it work, and all of my experiments worked fine without it anyway. Is it important? I don't mention AI thinking. Should I? Is it actually any good? Here's the copy. I hope you can view HTML e-mails: ------------------------------------------------------------------------------ Thinking An entity's Think() function is the "root" gateway used to run all internal logic. It is called once on spawn, with any subsequent calls decided by the programmer – happening either on a regular basis, or in response to external events. Use ClientThink()[1] to have an entity think every frame. SetNextThink() Defines when the entity next thinks. Accepts a floating point[2] value. If more than one call is made in a single execution, the new value overrides the old. void CMyEntity::Think() { Msg( "I think, therefore I am.\n" ); SetNextThink( gpGlobals->curtime + 1.0f ); // Think again in 1.0 seconds } This code causes the entity to print a message to the console once per second. Note the use of gpGlobals->curtime, which returns the time at execution, and f, which tells the C++ compiler that we are submitting a floating-point value and not an integer[3]. SetThink() Changes the active think function Accepts a function pointer[4]: add ‘&’ before the name and omit its closing parentheses. If more than one call is made in a single execution, the new value overrides the old. void CMyEntity::Think() { Msg( "I think, therefore I am.\n" ); SetThink( &CMyEntity::Think2 ); // Think with this procedure next SetNextThink( gpGlobals->curtime + 1.0f ); } void CMyEntity::Think2() { Msg( "Variety is the spice of life.\n" ); SetThink( &CMyEntity::Think ); // Think with this procedure next SetNextThink( gpGlobals->curtime + 1.0f ); } This code switches thinking between two functions. A real-world application is to change an entity between various life stages: consider a buildable gun turret[5]. One think function would run while it waits to be unpackaged, another while it is being built, another while it is active, and a fourth when it dies. Creating think functions for each discrete stage increases code stability and aids debugging. ClientThink() Thinking can also occur on the client, but its effects are limited. Additionally, only one think function is supported for each entity. void C_MyEntity::ClientThink() { DevMsg( "Don't put anything expensive in this function!\n" ); SetNextClientThink( CLIENT_THINK_ALWAYS ); // Think every frame } Some examples of client-side thinking are: Visual effects / particles VGUI screen interaction Modifying player speed (calculated on the client as well as server to avoid lag) Striders’ legs snapping ropes (disabled by default) SetNextClientThink() Used to re-fire ClientThink(). In addition to normal float values, it accepts: CLIENT_THINK_ALWAYS Think on the client once every frame. Use with caution! Replaces Simulate(). CLIENT_THINK_NEVER Stop all client-side thinking without killing the entity. ===References:=== 1. http://developer.valvesoftware.com/w/index.php?title=Generalities_On_Entities&action=submit#ClientThink.28.29 2. http://en.wikipedia.org/wiki/Floating_point 3. http://en.wikipedia.org/wiki/Integer_%28computer_science%29 4. http://en.wikipedia.org/wiki/Pointer_%28computing%29 5. http://forums.gamedesign.net/viewtopic.php?t=3702 _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

