ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
Moving the bots (Sdk)
Moving the bots // SdkvelenoNov 21, 1998, 1:29am
I want to know how I can get the bot to respond to avatars within a
certain radius of himself, and follow them for a distance, then return to his original position... any takers? edward sumerfieldNov 21, 1998, 2:39am
--------------2177A608EA2C86C1B6B1E676
Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit You are asking for a couple of different concepts. 1. avatar distance from robot. I implemented this using Pythagarous in the code in the AWCPP - Avatar.C, distanceFrom() method. Here is an excerpt // Convert all positions to their absolute values. No negatives. if (delta_x < 0) delta_x = -delta_x; if (delta_y < 0) delta_y = -delta_y; if (delta_z < 0) delta_z = -delta_z; // Work out the horizontal hypotenuse using Pythagarous theorem. // // hypotenuse squared = opposite squared + adjacent squared; float hor_h = sqrt(((delta_x * delta_x) + (delta_z * delta_z))); // The vertical hypotenuse is the the actual distance between the // the avatars. float distance_from_avatar = sqrt(((hor_h * hor_h) + (delta_y * delta_y))); 2. x, z follow position. I implemented this using old fashioned trig (haven't worked out the matrix math yet) in AWCPP - Movement.C in the follow() method. Another excerpt // Set my yaw to the same direction that the avatar is facing. We must // do this now because we are going to turn the avatar yaw around for the // direction calculation. my_yaw = avatar_yaw; // Because we will be facing the avatar from behind we can set our // yaw to the same as the avatars. However, the new position is // calculated as some distance in the opposite direction from where // the avatar is facing so we must add 180 degrees for the trig // equation. avatar_yaw += (CIRCLE_AW / 2); // This is 3600/2 mod_float(&avatar_yaw, CIRCLE_AW); // Just a modulus function on a float type. // Convert the degrees to radians for use with the cos and // sin functions. This may not be necessary depending on your // development language. float yaw_radians = Convert::DegreesToRadians(avatar_yaw); // Calculate the delta changes in position for each of the // x, y and z axes. float delta_x_coord = distance * sin(yaw_radians); float delta_z_coord = distance * cos(yaw_radians); // Apply the delta changes to the existing position. Checking for the world boundaries. my_x_coord += delta_x_coord; if (my_x_coord > MAX_X_COORD) { my_x_coord = MAX_X_COORD; } else if (my_x_coord < MIN_X_COORD) { my_x_coord = MIN_X_COORD; } my_z_coord += delta_z_coord; if (my_z_coord > MAX_Z_COORD) { my_z_coord = MAX_Z_COORD; } else if (my_z_coord < MIN_Z_COORD) { my_z_coord = MIN_Z_COORD; } // Altitude stays the same. my_altitude = avatar_altitude; Program structure. aw_event_set(AW_AVATAR_CHANGE, avatar_change); timer = 0; avatar_session = -1; robot_state = WAITING; while (aw_wait(1000)) { if (robot_state == FOLLOWING) { get position of avatar with avatar_session move robot position using following function above. timer--; if (timer <= 0) { state = WAITING; avatar_session = -1; } } } void avatar_change() { // Called when avatar moves. calculate distance using distance calculation above. if (distance < SOME DISTANCE) { state = FOLLOWING; timer = 60; // Represents 60 loops around the 1 second loop. Follow or a minute avatar_session = aw_int(AW_AVATAR_SESSION); } } The only caveat I would add is that I have tested distanceFrom code but never tested the follow code. Let me know if it works. Hope this helps. Good luck. Edward Sumerfield. [View Quote] > I want to know how I can get the bot to respond to avatars within a > certain radius of himself, and follow them for a distance, then return > to his original position... any takers? --------------2177A608EA2C86C1B6B1E676 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> You are asking for a couple of different concepts. <p><b>1. avatar distance from robot.</b> <p>I implemented this using Pythagarous in the code in the AWCPP - Avatar.C, distanceFrom() method. Here is an excerpt <p> // Convert all positions to their absolute values. No negatives. <p> if (delta_x < 0) delta_x = -delta_x; <br> if (delta_y < 0) delta_y = -delta_y; <br> if (delta_z < 0) delta_z = -delta_z; <p> // Work out the horizontal hypotenuse using Pythagarous theorem. <br> // <br> // hypotenuse squared = opposite squared + adjacent squared; <p> float hor_h = sqrt(((delta_x * delta_x) + (delta_z * delta_z))); <p> // The vertical hypotenuse is the the actual distance between the <br> // the avatars. <p> float <b>distance_from_avatar</b> = sqrt(((hor_h * hor_h) + (delta_y * delta_y))); <p><b>2. x, z follow position.</b> <p>I implemented this using old fashioned trig (haven't worked out the matrix math yet) in AWCPP - Movement.C in the follow() method. Another excerpt <p> // Set my yaw to the same direction that the avatar is facing. We must <br> // do this now because we are going to turn the avatar yaw around for the <br> // direction calculation. <p> my_yaw = avatar_yaw; <p> // Because we will be facing the avatar from behind we can set our <br> // yaw to the same as the avatars. However, the new position is <br> // calculated as some distance in the opposite direction from where <br> // the avatar is facing so we must add 180 degrees for the trig <br> // equation. <p> avatar_yaw += (CIRCLE_AW / 2); // This is 3600/2 <br> mod_float(&avatar_yaw, CIRCLE_AW); // Just a modulus function on a float type. <p> // Convert the degrees to radians for use with the cos and <br> // sin functions. <b>This may not be necessary depending on your</b> <br><b> // development language.</b> <p> float yaw_radians = Convert::DegreesToRadians(avatar_yaw); <p> // Calculate the delta changes in position for each of the <br> // x, y and z axes. <p> float delta_x_coord = distance * sin(yaw_radians); <br> float delta_z_coord = distance * cos(yaw_radians); <p> // Apply the delta changes to the existing position. Checking for the world boundaries. <p> my_x_coord += delta_x_coord; <br> if (my_x_coord > MAX_X_COORD) { <p> my_x_coord = MAX_X_COORD; <br> } <br> else if (my_x_coord < MIN_X_COORD) { <p> my_x_coord = MIN_X_COORD; <br> } <p> my_z_coord += delta_z_coord; <br> if (my_z_coord > MAX_Z_COORD) { <p> my_z_coord = MAX_Z_COORD; <br> } <br> else if (my_z_coord < MIN_Z_COORD) { <p> my_z_coord = MIN_Z_COORD; <br> } <p> // Altitude stays the same. <p> my_altitude = avatar_altitude; <p>Program structure. <p> aw_event_set(AW_AVATAR_CHANGE, avatar_change); <p> timer = 0; <br> avatar_session = -1; <br> robot_state = WAITING; <br> while (aw_wait(1000)) { <br> if (robot_state == FOLLOWING) { <br> get position of avatar with avatar_session <br> move robot position using following function above. <br> timer--; <br> if (timer <= 0) { <br> state = WAITING; <br> avatar_session = -1; <br> } <br> } <br> } <br> void avatar_change() { // Called when avatar moves. <br> calculate distance using distance calculation above. <br> if (distance < SOME DISTANCE) { <br> state = FOLLOWING; <br> timer = 60; // Represents 60 loops around the 1 second loop. Follow or a minute <br> avatar_session = aw_int(AW_AVATAR_SESSION); <br> } <br> } <p>The only caveat I would add is that I have tested distanceFrom code but never tested the follow code. Let me know if it works. <p>Hope this helps. Good luck. <p>Edward Sumerfield. [View Quote] --------------2177A608EA2C86C1B6B1E676-- roland vilettNov 21, 1998, 3:33am
This is a multi-part message in MIME format.
------=_NextPart_000_004D_01BE14CD.5A1F3B40 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Just a little programmer nit-pick, but you can save yourself a little = trouble by dropping the absolute value conversions for the deltas since = you are about to square them, which will cancel out any negative values. = In other words, delta_x * delta_x has the same value regardless of whether delta_x is positive or = negative. -Roland [View Quote] I implemented this using Pythagarous in the code in the AWCPP - = Avatar.C, distanceFrom() method. Here is an excerpt=20 // Convert all positions to their absolute values. No negatives.=20 if (delta_x < 0) delta_x =3D -delta_x;=20 if (delta_y < 0) delta_y =3D -delta_y;=20 if (delta_z < 0) delta_z =3D -delta_z;=20 // Work out the horizontal hypotenuse using Pythagarous theorem.=20 //=20 // hypotenuse squared =3D opposite squared + adjacent squared;=20 float hor_h =3D sqrt(((delta_x * delta_x) + (delta_z * delta_z))); = // The vertical hypotenuse is the the actual distance between the=20 // the avatars.=20 float distance_from_avatar =3D sqrt(((hor_h * hor_h) + (delta_y * = delta_y)));=20 ------=_NextPart_000_004D_01BE14CD.5A1F3B40 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN"> <HTML> <HEAD> <META content=3Dtext/html;charset=3Diso-8859-1 = http-equiv=3DContent-Type><!doctype html public "-//w3c//dtd html 4.0 = transitional//en"> <META content=3D'"MSHTML 4.72.2106.6"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT color=3D#000000 size=3D2>Just a little programmer nit-pick, = but you can=20 save yourself a little trouble by dropping the absolute value = conversions for=20 the deltas since you are about to square them, which will cancel out any = negative values. In other words,</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT size=3D2>delta_x * delta_x</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>has the same value regardless of whether delta_x is = positive=20 or negative.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>-Roland</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: = 5px"> [View Quote] = href=3D"mailto:365643F7.6F11AF95 at poboxes.com">365643F7.6F11AF95 at poboxes.c= om</A>>...</DIV>You=20 are asking for a couple of different concepts.=20 <P><B>1. avatar distance from robot.</B>=20 <P>I implemented this using Pythagarous in the code in the AWCPP - = Avatar.C,=20 distanceFrom() method. Here is an excerpt=20 <P> // Convert all positions to their absolute values. No = negatives.=20 <P> if (delta_x < 0) delta_x =3D -delta_x; <BR> if = (delta_y=20 < 0) delta_y =3D -delta_y; <BR> if (delta_z < 0) delta_z = =3D=20 -delta_z;=20 <P> // Work out the horizontal hypotenuse using Pythagarous = theorem.=20 <BR> // <BR> // hypotenuse squared =3D opposite squared = + adjacent=20 squared;=20 <P> float hor_h =3D sqrt(((delta_x * delta_x) + (delta_z * = delta_z)));=20 <P> // The vertical hypotenuse is the the actual distance = between the=20 <BR> // the avatars.=20 <P> float <B>distance_from_avatar</B> =3D sqrt(((hor_h * = hor_h) +=20 (delta_y * delta_y)));=20 <P> </P></BLOCKQUOTE></BODY></HTML> ------=_NextPart_000_004D_01BE14CD.5A1F3B40-- velenoNov 21, 1998, 4:22am
--------------3EB159911E66580DAE68CD65
Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I am not sure I see what you are going for. I am using the GNU, which I think is of somwhat difference from the AWCPP. I don't know what the delta_x, z variables represent in the programming source. I also want to understand what each of the values represent (ie, what sets the react range, and the follow distance) so I can modify the code myself once I get successfull implementation. Also, where in the source of the bot would these lines take place? I am not sure if you would need to call another event header or what... [View Quote] > Just a little programmer nit-pick, but you can save yourself a little > trouble by dropping the absolute value conversions for the deltas > since you are about to square them, which will cancel out any negative > values. In other words, delta_x * delta_x has the same value > regardless of whether delta_x is positive or negative. -Roland > [View Quote] --------------3EB159911E66580DAE68CD65 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <body bgcolor="#FFFFFF"> I am not sure I see what you are going for. I am using the GNU, which I think is of somwhat difference from the AWCPP. I don't know what the delta_x, z variables represent in the programming source. <br>I also want to understand what each of the values represent (ie, what sets the react range, and the follow distance) so I can modify the code myself once I get successfull implementation. Also, where in the source of the bot would these lines take place? I am not sure if you would need to call another event header or what... [View Quote] </body> </html> --------------3EB159911E66580DAE68CD65-- x@x.com (xelag)Nov 21, 1998, 11:35am
The bot reacts to changes in avatar position, gesture and type. If an
avatar comes within range of the bot (or the bot comes within range of the avatar), the event handler for AW_EVENT_AVATAR_ADD is triggered, if any avatar within range changes position etc, the handler for AW_EVENT_AVATAR_CHANGE is triggered, on leaving the avatar triggers the handler AW_EVENT_AVATAR_DELETE. These handlers must be installed by you before creating the bot. When one of these handlers is triggered, you can get the session number of the avatar in AW_AVATAR_SESSION (call it avS), the position in AW_AVATAR_X, AW_AVATAR_Z, AW_AVATAR_Y. Say you call these avX, avZ. avY, your pposition (known to you, you positioned the bot) are myX, myZ, myY. Then, delta_x = avX - myX etc. and hor_h is the distance between your bot and the avatar whose event you trapped. If this hor_h is near enough for your purpose, register the position of your bot (so it can return there after the chase), the session number avS of the avatar you are chasing and start keeping track of any event that has the same avS, until the avatar gets out of range by leaving or when hor_h gets too large (hor_h is always positive), or you time out the case. Whenever an event has your victim's avS, adjust the position of your own bot to follow the avatar. If you only have one bot, you can adjust the position of your avatar when you trap the event that would justify the change. If you have more than one bot running its slightly more complicated: you'll have to register the proposed changes to your bot's position when the event occurs, but only call aw_instance_set (select the bot), aw_int_set (for the new position) and aw_state_change (to send the data to the world server) from a place where this will not interfere with ongoing action, for instance, from the aw_wait loop. XelaG [View Quote] >I am not sure I see what you are going for. I am using the GNU, which I >think is of somwhat difference from the AWCPP. I don't know what the >delta_x, z variables represent in the programming source. >I also want to understand what each of the values represent (ie, what >sets the react range, and the follow distance) so I can modify the code >myself once I get successfull implementation. Also, where in the source >of the bot would these lines take place? I am not sure if you would need >to call another event header or what... > [View Quote] x@x.com (xelag)Nov 21, 1998, 11:45am
Remember that the world server may reject your request to update the
position of the bot, if two requests reach the server within one second, so that you must keep track of that and re-send a request after a second. x@x.com (xelag)Nov 21, 1998, 12:06pm
1. BTW, I'm not sure if AW_AVATAR_SESSION refers to the bot or the
avatar, you also have AW_AVATAR_NAME, the login name of the avatar - my bot is deaf in visual basic. 2. Can anyone clarify this: how do I know for which bot an event is triggered? Supposing I have bots in different worlds, how do I know in which world the trapped avatar is? If one can't use threads, one should be able to identify a relation between event and bot, methinks. XelaG edward sumerfieldNov 21, 1998, 12:52pm
Robots don't have session number they have instance numbers.
Likewise other avatars wandering around only have session numbers. So for you two robot problem you would need an array on session numbers for each instance number. Edward Sumerfield. [View Quote] > 1. BTW, I'm not sure if AW_AVATAR_SESSION refers to the bot or the > avatar, you also have AW_AVATAR_NAME, the login name of the avatar - > my bot is deaf in visual basic. > > 2. Can anyone clarify this: how do I know for which bot an event is > triggered? Supposing I have bots in different worlds, how do I know in > which world the trapped avatar is? If one can't use threads, one > should be able to identify a relation between event and bot, methinks. > > XelaG edward sumerfieldNov 21, 1998, 1:04pm
--------------D9FAD9029313D38C91C2DB76
Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Xelag said it. AWCPP is implemented entirely in GNU G++. The version implemented by Cygnus at http://www.cygnus.com You can find the source I referenced at http://members.xoom.com/esumerfd/ActiveWorlds/AWCPP/ Infact, I just released version 0.3 that supports a complete Avatar tracking model. The one thing I might modify in Xelags write-up is the design approach and this depends entirely on where you are coming from as a developer. Xelag mentioned the idea of multiple robots and how to keep track of the appropriate positions. That is a C design problem. With the AWCPP design in C++ we already have all that encapsulation. This is an excellent example of why OO design is so powerful. So, if you are learning C I would recommend learning C++ straight away and forget C. If you are a C programmer I would recommend getting into C++ fast. It has taken me, a veteran C programmer, 5 years now to feel comfortable working with OO design concepts. It seems to be an industry problem for procedural programmers (C) to reenginner their thinking processes to become OO programmers (C++). Good luck. Roland, thanks for the tip. I didn't spot that one. Edward Sumerfield. [View Quote] > I am not sure I see what you are going for. I am using the GNU, which I > think is of somwhat difference from the AWCPP. I don't know what the > delta_x, z variables represent in the programming source. > I also want to understand what each of the values represent (ie, what sets > the react range, and the follow distance) so I can modify the code myself > once I get successfull implementation. Also, where in the source of the bot > would these lines take place? I am not sure if you would need to call > another event header or what... > [View Quote] --------------D9FAD9029313D38C91C2DB76 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <body bgcolor="#FFFFFF"> Xelag said it. <p>AWCPP is implemented entirely in GNU G++. The version implemented by Cygnus at <A HREF="http://www.cygnus.com">http://www.cygnus.com</A> <p>You can find the source I referenced at <p> <A HREF="http://members.xoom.com/esumerfd/ActiveWorlds/AWCPP/">http://members.xoom.com/esumerfd/ActiveWorlds/AWCPP/</A> <p>Infact, I just released version 0.3 that supports a complete Avatar tracking model. <p>The one thing I might modify in Xelags write-up is the design approach and this depends entirely on where you are coming from as a developer. Xelag mentioned the idea of multiple robots and how to keep track of the appropriate positions. That is a C design problem. With the AWCPP design in C++ we already have all that encapsulation. This is an excellent example of why OO design is so powerful. <p>So, if you are learning C I would recommend learning C++ straight away and forget C. If you are a C programmer I would recommend getting into C++ fast. It has taken me, a veteran C programmer, 5 years now to feel comfortable working with OO design concepts. <p>It seems to be an industry problem for procedural programmers (C) to reenginner their thinking processes to become OO programmers (C++). Good luck. <p>Roland, thanks for the tip. I didn't spot that one. <p>Edward Sumerfield. [View Quote] </body> </html> --------------D9FAD9029313D38C91C2DB76-- walter knupeNov 21, 1998, 2:50pm
Edward
Edward Sumerfield schrieb in Nachricht <3656D39C.9D01AB at poboxes.com>... >Robots don't have session number they have instance numbers. >Likewise other avatars wandering around only have session numbers. > >So for you two robot problem you would need an array on session numbers for >each instance number. Really ? I never needed the session numbers. In every event callback i have the instance, and then pass all the event information the the c++ bot object responsible for that bot instance. doing it this way a bot object does only get the information related to him. If an avatar comes close to more than one bot at a time, i get the event twice, once for each bot instance, so that approach works just fine. i still have no idea for what the session number is needed outside the aw.dll. Walter > >Edward Sumerfield. > [View Quote] walter knupeNov 21, 1998, 2:51pm
It never rejected a positon change for me, and i errorneously had tests
running with 100 changes a second. i guess it discards them or does not propagate them to other people, but it does not reject them. Walter XelaG schrieb in Nachricht <3658c338.2969219 at news.activeworlds.com>... >Remember that the world server may reject your request to update the >position of the bot, if two requests reach the server within one >second, so that you must keep track of that and re-send a request >after a second. > walter knupeNov 21, 1998, 2:52pm
This is a multi-part message in MIME format.
------=_NextPart_000_006E_01BE1577.B951F440 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable What is G++ compared to C++ ?=20 :)=20 Walter Edward Sumerfield schrieb in Nachricht = <3656D683.B846DB09 at poboxes.com>... Xelag said it.=20 AWCPP is implemented entirely in GNU G++. The version implemented by = Cygnus at http://www.cygnus.com=20 ------=_NextPart_000_006E_01BE1577.B951F440 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN"> <HTML> <HEAD> <META content=3Dtext/html;charset=3Diso-8859-1 = http-equiv=3DContent-Type><!doctype html public "-//w3c//dtd html 4.0 = transitional//en"> <META content=3D'"MSHTML 4.72.3509.100"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT color=3D#000000 face=3DArial size=3D2>What is G++ compared to = C++ ?=20 </FONT></DIV> <DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>:) </FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Walter</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: = 5px"> <DIV>Edward Sumerfield<ESUMERFD at POBOXES.COM> schrieb in Nachricht = <<A=20 = href=3D"mailto:3656D683.B846DB09 at poboxes.com">3656D683.B846DB09 at poboxes.c= om</A>>...</DIV>Xelag=20 said it.=20 <P>AWCPP is implemented entirely in GNU G++. The version implemented = by=20 Cygnus at <A = href=3D"http://www.cygnus.com">http://www.cygnus.com</A>=20 <P> </P></BLOCKQUOTE></BODY></HTML> ------=_NextPart_000_006E_01BE1577.B951F440-- velenoNov 21, 1998, 2:56pm
--------------AE8D797CA06B21CC0CE1D288
Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I went to your AWCPP page, but I haven't been able to make much sense of it. In part, because I haven't done much in C++, just normal C.... The page says you have examples, but at the moment, if I'm to get started in this thing, it would be a great deal easier if I could just see the straight source of an example... like Rolland Vilett has on his SDK documentation... [View Quote] > Xelag said it. > > AWCPP is implemented entirely in GNU G++. The version implemented by > Cygnus at http://www.cygnus.com > > You can find the source I referenced at > > http://members.xoom.com/esumerfd/ActiveWorlds/AWCPP/ > > Infact, I just released version 0.3 that supports a complete Avatar > tracking model. > > The one thing I might modify in Xelags write-up is the design approach > and this depends entirely on where you are coming from as a developer. > Xelag mentioned the idea of multiple robots and how to keep track of > the appropriate positions. That is a C design problem. With the AWCPP > design in C++ we already have all that encapsulation. This is an > excellent example of why OO design is so powerful. > > So, if you are learning C I would recommend learning C++ straight away > and forget C. If you are a C programmer I would recommend getting into > C++ fast. It has taken me, a veteran C programmer, 5 years now to feel > comfortable working with OO design concepts. > > It seems to be an industry problem for procedural programmers (C) to > reenginner their thinking processes to become OO programmers (C++). > Good luck. > > Roland, thanks for the tip. I didn't spot that one. > > Edward Sumerfield. > [View Quote] --------------AE8D797CA06B21CC0CE1D288 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <body bgcolor="#FFFFFF"> I went to your AWCPP page, but I haven't been able to make much sense of it. In part, because I haven't done much in C++, just normal C.... The page says you have examples, but at the moment, if I'm to get started in this thing, it would be a great deal easier if I could just see the straight source of an example... like Rolland Vilett has on his SDK documentation... [View Quote] </body> </html> --------------AE8D797CA06B21CC0CE1D288-- canopusNov 21, 1998, 3:20pm
The instance pointers that are returned by aw_create (see Sample2e) let
you distinguish between several bots running in the same program, Any time you ask for a bot's attributes in such a program, you should preface the inquiry with aw_instance_set(instance pointer); ditto any time you have one bot say or do anything. The bot also has a session number, I think, like citizens. This number will be changed if the network is temporarily interrupted. See the aw_session document. There is an AW_AVATAR_SESSION but there also is AW_OBJECT_SESSION. AW_AVATAR_SESSION ought to give you session numbers for the avatar whether the avatar belongs to a bot or a citizen, if both bots and citizens have a session number. Since bots can't own objects, probably AW_OBJECT_SESSION won't return a bot session. [View Quote] > 1. BTW, I'm not sure if AW_AVATAR_SESSION refers to the bot or the > avatar, you also have AW_AVATAR_NAME, the login name of the avatar - > my bot is deaf in visual basic. > > 2. Can anyone clarify this: how do I know for which bot an event is > triggered? Supposing I have bots in different worlds, how do I know in > which world the trapped avatar is? If one can't use threads, one > should be able to identify a relation between event and bot, methinks. > > XelaG canopusNov 21, 1998, 3:29pm
You can tell which instance an event is for by calling aw_instance.
[View Quote] > 1. BTW, I'm not sure if AW_AVATAR_SESSION refers to the bot or the > avatar, you also have AW_AVATAR_NAME, the login name of the avatar - > my bot is deaf in visual basic. > > 2. Can anyone clarify this: how do I know for which bot an event is > triggered? Supposing I have bots in different worlds, how do I know in > which world the trapped avatar is? If one can't use threads, one > should be able to identify a relation between event and bot, methinks. > > XelaG x@x.com (xelag)Nov 21, 1998, 7:01pm
This solves my dilema. My poor deaf bot doesn't want to know this, he
avoids all dangerous talks with the dll.... Thanks. About session numbers for bots, although I can't test this yet, seems illogical they shouln't have one: they would not be able to track bots, only citizens and tourists... One can also track by name, but seeing so many BBot0's and BBot1's around, my bot might get confused... XelaG On Sat, 21 Nov 1998 12:29:48 -0500, Canopus <aek2 at ix.netcom.com> [View Quote] >You can tell which instance an event is for by calling aw_instance. > [View Quote] edward sumerfieldNov 21, 1998, 7:03pm
You are correct. You are using the instance to id the bot that received the
event. However, you didn't describe in your model what happens when two or more avatars approach your bot at the same time. Each avatar that approaches will have a separate session number (AW_AVATAR_SESSION). For example, I use the session number to identify an object that keeps track of conversation information with a specific avatar. You can track the same conversation with different approaching avatars at the same time. Of coarse the chat window looks a little crazy. [bot] Hello A A: What's up [bot] A, do you want something? [bot] Hello B A: What is the time? B: Robot dude. What's happenin. [bot] B, do you want something? [bot] A, it is 10 am. B: No go away. [bot] B, see ya. And so it goes on, and so on. If you look at my AvatarTrackerIF class if defines the callback as receiving AvatarThem* and void* as parameters. The AvatarThem represents the avatar that is chatting/moving and the void* represents a context object that I created and stored with the avatar information when the the avatar was added. The Nervous sample program implements this. Edward Sumerfield. [View Quote] > Edward > > Edward Sumerfield schrieb in Nachricht <3656D39C.9D01AB at poboxes.com>... > > Really ? I never needed the session numbers. In every event callback i have > the instance, and then pass all the event information the the c++ bot object > responsible for that bot instance. doing it this way a bot object does only > get the information related to him. If an avatar comes close to more than > one bot at a time, i get the event twice, once for each bot instance, so > that approach works just fine. > > i still have no idea for what the session number is needed outside the > aw.dll. > > Walter > edward sumerfieldNov 21, 1998, 7:06pm
--------------0FDF5ACF3EB4D242E50707D6
Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit GNU C++. [View Quote] > What is G++ compared to C++ ? :) Walter > > Edward Sumerfield schrieb in Nachricht > <3656D683.B846DB09 at poboxes.com>...Xelag said it. > > AWCPP is implemented entirely in GNU G++. The version implemented > by Cygnus at http://www.cygnus.com > > > --------------0FDF5ACF3EB4D242E50707D6 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <body bgcolor="#FFFFFF"> GNU C++. [View Quote] </body> </html> --------------0FDF5ACF3EB4D242E50707D6-- edward sumerfieldNov 21, 1998, 7:08pm
--------------B73AD52D3543021FCD4E9763
Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit There is full source, documentation and binary downloads on the download page. [View Quote] > I went to your AWCPP page, but I haven't been able to make much sense of it. > In part, because I haven't done much in C++, just normal C.... The page says > you have examples, but at the moment, if I'm to get started in this thing, > it would be a great deal easier if I could just see the straight source of > an example... like Rolland Vilett has on his SDK documentation... > [View Quote] --------------B73AD52D3543021FCD4E9763 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <body bgcolor="#FFFFFF"> There is full source, documentation and binary downloads on the download page. [View Quote] </body> </html> --------------B73AD52D3543021FCD4E9763-- x@x.com (xelag)Nov 21, 1998, 7:29pm
Don't you get an error message in rc = aw_state_change() ?
On Sat, 21 Nov 1998 17:51:38 +0100, "Walter Knupe" <wak at faber.ping.de> [View Quote] >It never rejected a positon change for me, and i errorneously had tests >running with 100 changes a second. i guess it discards them or does not >propagate them to other people, but it does not reject them. > >Walter > > >XelaG schrieb in Nachricht <3658c338.2969219 at news.activeworlds.com>... > walter knupeNov 22, 1998, 9:33am
Interesting...
i was building the bot from a AWBrowser-User point of view. You see if more than one person approaches you in AW and talks to you, you get all statements mixed in the chat window. this is, of course, just what happens to my bot if more than one guy is talking to it. For now that does not matter, because the conversations to my bot consist of simple give-a-command and get-a-direct-response. No conversation context. But if i wanted to establish chat context, there's still no need for a session id. for every conversation you have a bot's instance and an avavatar's name. So as soon as my c++ bot objects are able to keep conversation context, they would of course remember to whom, and there you are. so my AWBrowser-User point of view would work here. The user does not have "session ids" and therefore the bot does not need them either. Walter Edward Sumerfield schrieb in Nachricht <36572A8A.A28DE3A4 at poboxes.com>... >You are correct. You are using the instance to id the bot that received the >event. However, you didn't describe in your model what happens when two or more >avatars approach your bot at the same time. Each avatar that approaches will >have a separate session number (AW_AVATAR_SESSION). > >For example, I use the session number to identify an object that keeps track of >conversation information with a specific avatar. You can track the same >conversation with different approaching avatars at the same time. Of coarse the >chat window looks a little crazy. > >[bot] Hello A >A: What's up >[bot] A, do you want something? >[bot] Hello B >A: What is the time? >B: Robot dude. What's happenin. >[bot] B, do you want something? >[bot] A, it is 10 am. >B: No go away. >[bot] B, see ya. > >And so it goes on, and so on. > >If you look at my AvatarTrackerIF class if defines the callback as receiving >AvatarThem* and void* as parameters. The AvatarThem represents the avatar that >is chatting/moving and the void* represents a context object that I created and >stored with the avatar information when the the avatar was added. The Nervous >sample program implements this. > >Edward Sumerfield. > [View Quote] walter knupeNov 22, 1998, 9:36am
One more thing. i noticed that i am able to have my bot program run 3 bots,
all with the same name. i don't know for avatars, but if 2 avatars have the same name, like my bots, but if they differ in session id's, then i see the real advantage over my approach outlined below. Walter Walter Knupe schrieb in Nachricht <3657f6d1.0 at homer>... >Interesting... > >i was building the bot from a AWBrowser-User point of view. You see if more >than one person approaches you in AW and talks to you, you get all >statements mixed in the chat window. this is, of course, just what happens >to my bot if more than one guy is talking to it. > >For now that does not matter, because the conversations to my bot consist of >simple give-a-command and get-a-direct-response. No conversation context. > >But if i wanted to establish chat context, there's still no need for a >session id. for every conversation you have a bot's instance and an >avavatar's name. So as soon as my c++ bot objects are able to keep >conversation context, they would of course remember to whom, and there you >are. so my AWBrowser-User point of view would work here. The user does not >have "session ids" and therefore the bot does not need them either. > >Walter > > >Edward Sumerfield schrieb in Nachricht <36572A8A.A28DE3A4 at poboxes.com>... the >more >will walter knupeNov 22, 1998, 9:38am
Nope, not a single time. Bots can even go where avatar's can not (regarding
world boundaries). The only error codes i got were for aw_login, aw_enter and for building Walter aka Faber XelaG schrieb in Nachricht <36592ff5.30806517 at news.activeworlds.com>... >Don't you get an error message in rc = aw_state_change() ? > >On Sat, 21 Nov 1998 17:51:38 +0100, "Walter Knupe" <wak at faber.ping.de> [View Quote] edward sumerfieldNov 22, 1998, 2:01pm
I just did an experiment. Enter a world, spot a tourist, select Login->Tourist
and enter the same name. You can login just fine. This would not work for citizens of coarse. Now, session ids have this funky recovery problem, where the world can hit a glitch and reassign a session number to an avatar. I haven't coded around this yet. I just assume there will be no glitches. [View Quote] > One more thing. i noticed that i am able to have my bot program run 3 bots, > all with the same name. i don't know for avatars, but if 2 avatars have the > same name, like my bots, but if they differ in session id's, then i see the > real advantage over my approach outlined below. > > Walter > > Walter Knupe schrieb in Nachricht <3657f6d1.0 at homer>... > of > the roland vilettNov 23, 1998, 8:30pm
That is correct...extra calls to aw_state_change() are not rejected, they
just aren't propagated out to other users at more than one update per second. -Roland [View Quote] edward sumerfieldNov 24, 1998, 11:32am
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML> So the movements are not ignored, but recorded for your robot, its just that other users will only see the new positions once every second? <P>Edward Sumerfield. [View Quote] roland vilettNov 24, 1998, 4:51pm
This is a multi-part message in MIME format.
------=_NextPart_000_000A_01BE1798.5C2D67E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Yes that is correct. -Roland [View Quote] Edward Sumerfield.=20 [View Quote] That is correct...extra calls to aw_state_change() are not = rejected, they=20 just aren't propagated out to other users at more than one = update per=20 second.=20 -Roland=20 [View Quote] ------=_NextPart_000_000A_01BE1798.5C2D67E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN"> <HTML> <HEAD> <META content=3Dtext/html;charset=3Diso-8859-1 = http-equiv=3DContent-Type><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 = Transitional//EN"> <META content=3D'"MSHTML 4.72.2106.6"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT color=3D#000000 size=3D2>Yes that is correct.</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT size=3D2>-Roland</FONT></DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: = 5px"> [View Quote] = href=3D"mailto:365AB56E.6BF99EB9 at poboxes.com">365AB56E.6BF99EB9 at poboxes.c= om</A>>...</DIV>So=20 the movements are not ignored, but recorded for your robot, its just = that=20 other users will only see the new positions once every second?=20 <P>Edward Sumerfield.=20 [View Quote] ------=_NextPart_000_000A_01BE1798.5C2D67E0-- edward sumerfieldNov 30, 1998, 1:54am
I thought we had specked that out? Let me know were you are having problems.
[View Quote] > So i guess this means you haven't figured out how to get my SDK script to > chase ppl?<g> > > > [View Quote] fastNov 30, 1998, 2:56am
--------------8840F154C105033792169F2B
Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit So i guess this means you haven't figured out how to get my SDK script to chase ppl?<g> [View Quote] > There is full source, documentation and binary downloads on the > download page. > [View Quote] [View Quote] > There is full source, documentation and binary downloads on the > download page. > [View Quote] -- ************************************************************** *Fast's Avatar Bar:Making Fine Quality Avatars For the * * citizens of Active Worlds. * * A Division Of SPY WorldBuilders(www.FastWalker2.8m.com) * * * * Fas2 at Bellsouth.net * ************************************************************** --------------8840F154C105033792169F2B Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <HTML> <BODY BGCOLOR="#FFFFFF"> So i guess this means you haven't figured out how to get my SDK script to chase ppl?<g> <BR> <BR> [View Quote] [View Quote] [View Quote] <P>AWCPP is implemented entirely in GNU G++. The version implemented by Cygnus at <A HREF="http://www.cygnus.com">http://www.cygnus.com</A> <P>You can find the source I referenced at <P> <A HREF="http://members.xoom.com/esumerfd/ActiveWorlds/AWCPP/">http://members.xoom.com/esumerfd/ActiveWorlds/AWCPP/</A> <P>Infact, I just released version 0.3 that supports a complete Avatar tracking model. <P>The one thing I might modify in Xelags write-up is the design approach and this depends entirely on where you are coming from as a developer. Xelag mentioned the idea of multiple robots and how to keep track of the appropriate positions. That is a C design problem. With the AWCPP design in C++ we already have all that encapsulation. This is an excellent example of why OO design is so powerful. <P>So, if you are learning C I would recommend learning C++ straight away and forget C. If you are a C programmer I would recommend getting into C++ fast. It has taken me, a veteran C programmer, 5 years now to feel comfortable working with OO design concepts. <P>It seems to be an industry problem for procedural programmers (C) to reenginner their thinking processes to become OO programmers (C++). Good luck. <P>Roland, thanks for the tip. I didn't spot that one. <P>Edward Sumerfield. [View Quote] [View Quote] <P><B>1. avatar distance from robot.</B> <P>I implemented this using Pythagarous in the code in the AWCPP - Avatar.C, distanceFrom() method. Here is an excerpt <P> // Convert all positions to their absolute values. No negatives. <P> if (delta_x < 0) delta_x = -delta_x; <BR> if (delta_y < 0) delta_y = -delta_y; <BR> if (delta_z < 0) delta_z = -delta_z; <P> // Work out the horizontal hypotenuse using Pythagarous theorem. <BR> // <BR> // hypotenuse squared = opposite squared + adjacent squared; <P> float hor_h = sqrt(((delta_x * delta_x) + (delta_z * delta_z))); <P> // The vertical hypotenuse is the the actual distance between the <BR> // the avatars. <P> float <B>distance_from_avatar</B> = sqrt(((hor_h * hor_h) + (delta_y * delta_y))); <BR> <BR> </BLOCKQUOTE> </BLOCKQUOTE> </BLOCKQUOTE> </BLOCKQUOTE> </BLOCKQUOTE> </BLOCKQUOTE> [View Quote] [View Quote] [View Quote] <P>AWCPP is implemented entirely in GNU G++. The version implemented by Cygnus at <A HREF="http://www.cygnus.com">http://www.cygnus.com</A> <P>You can find the source I referenced at <P> <A HREF="http://members.xoom.com/esumerfd/ActiveWorlds/AWCPP/">http://members.xoom.com/esumerfd/ActiveWorlds/AWCPP/</A> <P>Infact, I just released version 0.3 that supports a complete Avatar tracking model. <P>The one thing I might modify in Xelags write-up is the design approach and this depends entirely on where you are coming from as a developer. Xelag mentioned the idea of multiple robots and how to keep track of the appropriate positions. That is a C design problem. With the AWCPP design in C++ we already have all that encapsulation. This is an excellent example of why OO design is so powerful. <P>So, if you are learning C I would recommend learning C++ straight away and forget C. If you are a C programmer I would recommend getting into C++ fast. It has taken me, a veteran C programmer, 5 years now to feel comfortable working with OO design concepts. <P>It seems to be an industry problem for procedural programmers (C) to reenginner their thinking processes to become OO programmers (C++). Good luck. <P>Roland, thanks for the tip. I didn't spot that one. <P>Edward Sumerfield. [View Quote] [View Quote] <P><B>1. avatar distance from robot.</B> <P>I implemented this using Pythagarous in the code in the AWCPP - Avatar.C, distanceFrom() method. Here is an excerpt <P> // Convert all positions to their absolute values. No negatives. <P> if (delta_x < 0) delta_x = -delta_x; <BR> if (delta_y < 0) delta_y = -delta_y; <BR> if (delta_z < 0) delta_z = -delta_z; <P> // Work out the horizontal hypotenuse using Pythagarous theorem. <BR> // <BR> // hypotenuse squared = opposite squared + adjacent squared; <P> float hor_h = sqrt(((delta_x * delta_x) + (delta_z * delta_z))); <P> // The vertical hypotenuse is the the actual distance between the <BR> // the avatars. <P> float <B>distance_from_avatar</B> = sqrt(((hor_h * hor_h) + (delta_y * delta_y))); <BR> <BR> </BLOCKQUOTE> </BLOCKQUOTE> </BLOCKQUOTE> </BLOCKQUOTE> </BLOCKQUOTE> </BLOCKQUOTE> <P>-- <BR>************************************************************** <BR>*Fast's Avatar Bar:Making Fine Quality Avatars For the * <BR>* citizens of Active Worlds. * <BR>* A Division Of SPY WorldBuilders(www.FastWalker2.8m.com) * <BR>* * <BR>* Fas2 at Bellsouth.net * <BR>************************************************************** <BR> </BODY> </HTML> --------------8840F154C105033792169F2B-- velenoNov 30, 1998, 8:45pm
I'm still unsure as where to start with what to get this to work....
[View Quote] > I thought we had specked that out? Let me know were you are having problems. > [View Quote] |