Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Help creating truly autonomous agents/processes .....

Author
Message
ProfVersaggi
12
Years of Service
User Offline
Joined: 6th Apr 2012
Location: Maastricht Netherlands / Chicago, USA
Posted: 12th Mar 2013 23:56
I'm writing a series AI routines for the AppGameKit platform tier1 in purely physics game to control autonomous characters to the extent that you wind them up and let them go....

The problem I have ran straight into is *not* the simple commands like Seek, Flee, Evade, Arrive or Wander ... those you just call and that's it, they do their simple thing and it's over.


The real problems arise with complex commands ones like Patrol (An area), ... and the key issues seems to center around the autonomous character having to do *multiple* tasks w/in the framework of the screen refreshing and calling/recalling the command w/in the do-loop.

For instance: the Patrol command first constructs a Point Of Visibility Navigation Map (essentially 5 circle sprites arranged in line of sight graph in the world), and the character has to move from one node to the next, visiting each node and then starting over again. Simple for C++, Java, etc ... not so simple in AGK.

Since the command originates in the do-loop (as it must) it gets repeatedly called (which in some cases is a good thing), but in this case that means the same original parameters are always passed in which leads the character to simply goto the first node and stop, always ...

Now in order to move from one node to the other, etc, it must make decisions based upon data that's dynamic (which is easy) but that does *not* depend upon the parameters of the repeatedly calling original function in the do-loop. Does that make sense?

So ... has anyone any experience with this kind of thing whom can give me any pointers? Am I explaining the issue clearly enough?

Many thanks in advance ...

----
From the Desk of Prof Versaggi ...
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 13th Mar 2013 09:00 Edited at: 13th Mar 2013 09:01
It sounds like you need to simply save the current "state" of your character and create a state engine for him. Using the select command and saving the state variable you can then decide what to do in any given state.

For example:


I hope that helps answer your question. I'm not sure how using C++ or java it would work terribly differently.


this.mess = abs(sin(times#))
ProfVersaggi
12
Years of Service
User Offline
Joined: 6th Apr 2012
Location: Maastricht Netherlands / Chicago, USA
Posted: 13th Mar 2013 18:01
baxslash - yup, that was it. I had been barking up the wrong tree the whole time. That and a judicious use of if-than-elseif-endif statements and it worked properly.

Thanks for the help ....

----
From the Desk of Prof Versaggi ...
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 13th Mar 2013 19:20
When things get complex, case statements are a much clearer solution, and easier to support!

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 13th Mar 2013 19:32 Edited at: 13th Mar 2013 19:33
i think a command list with priority is fine.
a command can add command(s) to the list too.
some command are allways present, representing the loop for lookat etc.
some command will be removed if finished.
a select case do the commands in priority order.
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 16th Mar 2013 13:47 Edited at: 16th Mar 2013 13:49
As far as I know, the creation of autonomous agents needs all the basics behaviours (Seek, Flee etc..) along with path finding, decision trees etc. You will also need a robust set of state machine functions.
I don't think that the Tier 1 has all the power. Besides there is an importand bug when passing UDT among functions.
I recommend this:
http://www.amazon.com/Programming-Game-Example-Mat-Buckland/dp/1556220782
ProfVersaggi
12
Years of Service
User Offline
Joined: 6th Apr 2012
Location: Maastricht Netherlands / Chicago, USA
Posted: 16th Mar 2013 16:37 Edited at: 16th Mar 2013 17:38
Actually at the moment I have working: (Seek, Flee, Pursue, Evade, Arrive, Wander as well as the state machines in which to support them) all per Bucklands book. I also have working the POV navigational Maps and have all of the Stack and Queue support for the Depth First and Breadth First searches (again Per Buckland's book). I also have some other complex behavior completed like Patrol (using remedial POV graph traversals) ... all in Tier 1.

I did find that UDT error you spoke of as well as others and developed a work around them .. it's not pretty but it works.

I've got to complete Flock, Obstacle Avoidance and perhaps a few other complex behaviors and remedial decision making then I'm done this section.

I'd eventually like to make the code available to the user base but I'm not sure the proper channels at the moment.

Any ideas?

----
From the Desk of Prof Versaggi ...
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 17th Mar 2013 08:10
Perhaps the App Game Kit Community Wiki
http://forum.thegamecreators.com/?m=forum_view&t=200729&b=41
Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 18th Mar 2013 21:25 Edited at: 18th Mar 2013 21:26
Quote: "I did find that UDT error you spoke of as well as others and developed a work around them .. it's not pretty but it works"

I've taken to using strings for such as this - at least until UDTs are fixed, so for example, my create sprite function would take a parameter such as "X:100,Y:200,W:50,H:30,D:10".
Then use something like;

Again, not pretty and probably not fast, but it can handle a heck of a lot more parameters than a standard function call.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 18th Mar 2013 21:44
Marl, you can get a slight improvement in general processing by assigning the results of CountStringTokens to a variable and then using the variable in the 'for' loop.

Assuming there are at least two parameters in the string, you reduce your overhead by one function call. (I used to have to worry about saving bytes and clock cycles in some of the projects I used to do.)

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2024-05-07 07:03:46
Your offset time is: 2024-05-07 07:03:46