Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #16  
Old 03-19-2010, 07:19 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
I have to agree with WD here 100%. (Also, I prefer JSON but still haven't gotten around to finishing a JSON parser for GS2...)

Anyways, new release!

Behavior Tree Version 1.1
I have added the ability to load behavior trees from a simple file format.
PHP Code:
this.behavior = new TStaticVar();
this.behavior.join("ai-behaviortree");
this.behavior.loadFromFile("behavior_tree_name"this); 
This will load a behavior tree from a "behaviors/behavior_tree_name.txt" dynamically. Make sure that your npc-server has rights to this. The comments in the script should explain the further details.

Here's what the example script in the first post looks like in file format:
PHP Code:
rootSelector
  leaf search 
%this
    decorator filter 
%this,state,idle
    getParent
  sequence
    decorator filter 
%this,state,chase
    leaf findPath 
%target
      getParent
    leaf move 
%this
      decorator loop 
%path_size
      getParent
    getParent
  sequence
    decorator filter 
%this,state,attack
    leaf attack 
%this
      getParent
    macro pause 0.5
    getParent
  sequence
    decorator filter 
%this,state,dead
    macro setCharAni
dead
    getParent 
You may note that what was once this.path.size() is now %path_size. Unfortunately, I don't have any real way to allow calling a function of an object like that, so for situations like that you'll have to save info like that elsewhere, in this case a variable called path_size.

The next step is a Behavior Tree editor, so you won't have to mess with any of this!
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #17  
Old 03-19-2010, 05:11 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Like the format, but the getParent lines seem like it's redundant.

Alright, I'll probably never suggest XML again. Thanks for that little explanation.
__________________
Quote:
Reply With Quote
  #18  
Old 03-19-2010, 06:01 PM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
lol, Damn man. Just wanna say people this was fun to watch coreys work on. You wouldn't believe the RC spam it caused from the updates on it but it was very nice to see what came out of it. I think this could be a very nice advancement towards making gameplay better and efficient with the right people working with it. Definitely not me because I don't understand a lick of what this all does except for making baddies run more efficiently and probably allow more options to the creatures and such you create. Good job bro. +Rep
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #19  
Old 03-19-2010, 06:41 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Can you post a real example or two to prove that it works?
Reply With Quote
  #20  
Old 03-19-2010, 08:01 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by DrakilorP2P View Post
Can you post a real example or two to prove that it works?
It's in the works! I've also gotten a lot done on a graphical behavior editor for these.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #21  
Old 03-19-2010, 11:37 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura about
Send a message via AIM to adam
Your dedication is admirable!
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #22  
Old 04-28-2010, 06:56 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
I'm sorry for this huge delay in getting this out (just been so busy) but I finally have a graphical Behavior Editor! (As well as a new shiny update to the behavior trees) My next task is a fully working example AI.

Behavior Editor Version 1.0

This simple to use GUI will allow you to quickly and easily create and edit AI Behaviors on the fly. To fire up this GUI simple use the command "/behavioredit".

All behaviors are saved as behavior files in the "behaviors/" directory, so be sure to give your NPC-Server access to this directory.

As stated in the last update, you can load a behavior file as such:
PHP Code:
this.behavior = new TStaticVar();
this.behavior.join("ai-behaviortree");
this.behavior.loadFromFile("behavior_tree_name"this); 
Behavior Trees Version 1.2.1
Several updates here.
  • All root nodes are selectors now, which is initialized with just "root".
  • Because all roots are now selectors, the behavior file syntax no longer needs the root function (so no "rootSelector" or "rootSequence").
  • Selectors now cache the last child node that succeeded (returned true) and tries that node first.
  • The loop function will now loop until a node returns false if the loop number argument is -1.
  • Added security to the loadFromFile function so that allow certain function names.

Download
The full set, along with it's dependencies, can be downloaded here.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #23  
Old 04-28-2010, 10:15 AM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Looks like the interface is stupid easy to follow, Only issue is figuring how it all works. Great job man.
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #24  
Old 04-29-2010, 07:11 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
When I was in school, I did a lot of research projects in robotics, but never had the chance to get into AI behavior trees too much. So, this was definitely interesting for me to look at. If I ever get back into the Graal coding trenches, this is one thing I'm sure to play around with. Great job!

The only suggestion I have is: attach your code! Heaven forbid, coreymedia goes down and poor little Billy can't tinker with your behavior editing goodness.
Reply With Quote
  #25  
Old 04-29-2010, 08:22 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Haha, well I intend to have that site up for some time, so if it goes down I'll know to do that.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:09 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.