Thread

movement etc... (Sdk)

movement etc... // Sdk

1  |  

x@x.com (xelag)

Nov 15, 1998, 10:31pm
I'd like to give my bot some autonomous movement (like the hambot's
random movement), but don't quite know where to start. I recently
migrated from windows 3.11 (shame on me) so know nothing about
threads, except that they exist. What are the options?

I could create a timer object for each bot (would that be = to
creating a new thread?). I already have one timer object for
aw_wait(). Can anybody give a hint? I use vb, its bad enough having a
deaf bot, I don't want him to look paralized as well!

;o) confused, XelaG

walter knupe

Nov 15, 1998, 11:08pm
Hey Xelag,

XelaG schrieb in Nachricht <364f700e.6446890 at news.activeworlds.com>...
>I'd like to give my bot some autonomous movement (like the hambot's
>random movement), but don't quite know where to start. I recently
>migrated from windows 3.11 (shame on me) so know nothing about
>threads, except that they exist. What are the options?
>
>I could create a timer object for each bot (would that be = to
>creating a new thread?). I already have one timer object for
>aw_wait(). Can anybody give a hint? I use vb, its bad enough having a
>deaf bot, I don't want him to look paralized as well!

a WM_TIMER is not at all the same as a seperate thread, but since the SDK is
not thread safe anyway and since it doesn't make sense to move more than
once a second, a WM_TIMER does the job.

so set up a second timer, and add a routine to it which does the following
(pseudo code following)

OnMoveTimer ()
{
get_old_position();
my_current_x := my_current_x + random_value_between(-100, 100);
my_current_z := my_current_x + random_value_between(-100, 100);
my_current_yaw := my_current_x + random_value_between(-100, 100);
my_current_yaw := my_current_yaw MODULO 3600;
int success = aw_change_state();

if (success)
{
save_current_position();
}
}

well, i think i got 3 languages in the above code, but the point should be
clear :)

hope that help a little,

Walter aka Faber

thierry nabeth

Nov 16, 1998, 7:07am
Hello,

I would just like to mention some theoretical work (well, let's say
academic work, since prototypes are built) related to the concurent
object models.
Practically, it consist in introducing concurency by associated a thread
of execution to objects.
Those objects are called "active objects".

I remember to have read a very interesting paper writen by Denis Caromel
in JOOP (Journal of Object Oriented Programing) many years ago. I was not
able to remember the exact reference of the paper, but you will find some
information about active object in Denis Caromel page.
(http://www.inria.fr/sloop/personnel/Denis.Caromel/).
I know this is more academic work, but it might give you an interesting
perspective (models) about how to define a software architecture with
many different bots.

Note:
However, you have to be aware (see "Walter Knupe" message) that the SDK
is not currently thread safed, and therefore that you can not use this
model in Active World now. I hope this will be possible in the future.


Another field of computer sciences that have addressed object autonomy is
Distributed Artificial Intelligence, and more particularly Agent
Technologies.
You will find a starting point about Agent Technologies at:
http://www.insead.fr/CALT/Encyclopedia/ComputerSciences/Agents/

Bye,

Thierry Nabeth
Research Fellow,
INSEAD CALT (the Centre for Advanced Learning Technologies)
http://www.insead.fr/CALT/


[View Quote] > I'd like to give my bot some autonomous movement (like the hambot's
> random movement), but don't quite know where to start. I recently
> migrated from windows 3.11 (shame on me) so know nothing about
> threads, except that they exist. What are the options?
>
> I could create a timer object for each bot (would that be = to
> creating a new thread?). I already have one timer object for
> aw_wait(). Can anybody give a hint? I use vb, its bad enough having a
> deaf bot, I don't want him to look paralized as well!
>
> ;o) confused, XelaG

x@x.com (xelag)

Nov 16, 1998, 8:02am
Thanks Walter aka Faber ! I'll try this later today, your synchretic
code is clear.

XelaG.

On Mon, 16 Nov 1998 02:08:18 +0100, "Walter Knupe" <wak at faber.ping.de>
[View Quote] >Hey Xelag,
>
>XelaG schrieb in Nachricht <364f700e.6446890 at news.activeworlds.com>...
>
>a WM_TIMER is not at all the same as a seperate thread, but since the SDK is
>not thread safe anyway and since it doesn't make sense to move more than
>once a second, a WM_TIMER does the job.
>
>so set up a second timer, and add a routine to it which does the following
>(pseudo code following)
>
>OnMoveTimer ()
>{
> get_old_position();
> my_current_x := my_current_x + random_value_between(-100, 100);
> my_current_z := my_current_x + random_value_between(-100, 100);
> my_current_yaw := my_current_x + random_value_between(-100, 100);
> my_current_yaw := my_current_yaw MODULO 3600;
> int success = aw_change_state();
>
> if (success)
> {
> save_current_position();
> }
>}
>
>well, i think i got 3 languages in the above code, but the point should be
>clear :)
>
>hope that help a little,
>
>Walter aka Faber
>
>

walter knupe

Nov 16, 1998, 8:28pm
Since a bot programm has a 3 bots limit, i guess you don't need active
objects for it. the programm responds quite well to 3 bots from a single
thread. even lengthy build operations do not stop other bots from
responding, since the sdk functions call your callbacks while waiting for
server results.

just my 2 cents..

Walter

Thierry Nabeth schrieb in Nachricht <364FEB68.1C6F396B at insead.fr>...
>Hello,
>
>I would just like to mention some theoretical work (well, let's say
>academic work, since prototypes are built) related to the concurent
>object models.
>Practically, it consist in introducing concurency by associated a thread
>of execution to objects.
>Those objects are called "active objects".
>

x@x.com (xelag)

Nov 17, 1998, 7:55pm
Thanks again, Walter, it works fine. I use the same timer for aw_wait
and for the random walk for 3 bots, an array of boleans regulates the
traffic in the movement routine, combining with the 'if success' bit.
The bots step 70 cm per second, from time to time if the browser skips
a heartbeat they gliiiiiiiiide. XelaG.



On Mon, 16 Nov 1998 02:08:18 +0100, "Walter Knupe" <wak at faber.ping.de>
[View Quote] >Hey Xelag,
>
>XelaG schrieb in Nachricht <364f700e.6446890 at news.activeworlds.com>...
>
>a WM_TIMER is not at all the same as a seperate thread, but since the SDK is
>not thread safe anyway and since it doesn't make sense to move more than
>once a second, a WM_TIMER does the job.
>
>so set up a second timer, and add a routine to it which does the following
>(pseudo code following)
>
>OnMoveTimer ()
>{
> get_old_position();
> my_current_x := my_current_x + random_value_between(-100, 100);
> my_current_z := my_current_x + random_value_between(-100, 100);
> my_current_yaw := my_current_x + random_value_between(-100, 100);
> my_current_yaw := my_current_yaw MODULO 3600;
> int success = aw_change_state();
>
> if (success)
> {
> save_current_position();
> }
>}
>
>well, i think i got 3 languages in the above code, but the point should be
>clear :)
>
>hope that help a little,
>
>Walter aka Faber
>
>

thierry nabeth

Nov 19, 1998, 8:26am
Hello,

objects for it.

I agree, active objects are not absolutely needed, and would be "overkill" in
that case.
On the other hand, such approach allows the implementation of a more
distributed architecture,
that is very clean and easier to maintain.

My intention in previous email was more to suggest alternative directions to
design
AW applications rather than providing a very concrete answer to the original
email.
(I apologize if I have confused some of you)

The limit to 3 bots may be changed in the future, and you could imagine
very easily the design in AW of a AW SDK application that would animate many
(tens of) smart
(but not neccessary very intelligent) objects. Such an approach is very
common in the domain or artificial life
(see the SWARM system for instance).

Thierry Nabeth
--- calt.


[View Quote] > Since a bot programm has a 3 bots limit, i guess you don't need active
> objects for it. the programm responds quite well to 3 bots from a single
> thread. even lengthy build operations do not stop other bots from
> responding, since the sdk functions call your callbacks while waiting for
> server results.
>
> just my 2 cents..
>
> Walter
>
> Thierry Nabeth schrieb in Nachricht <364FEB68.1C6F396B at insead.fr>...

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn