Game Development Community

Behavior Documentation

by Adam Larson · in Torque Game Builder · 04/03/2007 (4:41 pm) · 22 replies

Alright, I posted some basic behavior documentation on TDN (links at the bottom of that page). It is certainly not complete, but I'm hoping it's enough to get people started. Post here anything you don't understand or any questions you still have and I'll try to get them addressed.

There's also a section on there for the community to post behaviors they have created. I'm hoping it will start to fill up. :)
Page «Previous 1 2
#1
04/06/2007 (2:49 am)
I love the move to behaviors, I only wish the same moves were made with the component system for TGE/TSEA, but hey..

Another thing that just struck me, how do we control the execution of behaviors with other behaviors? I.e. how do we create "modal" behaviours such that one behavior can disable others from recieving events until its own internal state changes?


So another question is, what behaviours can we actually think of?

I'll share mine (note, some may already exist):

Click to destroy (i.e. pop baloon with mouse)
Highlight selection (i.e. click on, click off)
Click to animate (run an animation when clicked)
Avoid object (like the avoid mouse, but avoids another object)
Teleport on touch (hits trigger and teleports to its target)
Flock (moves towards object, think geometry wars)
Invader (moves like a space invader, side to side, down one line when hitting sides)
Eat (player object hits enemy, enemy disappears with particle + sound)
Warp (basically is influenced by space warps, with gravity)
SmartBomb (when touched, destroys all non player objects)
Attach (basically adds a mount to the touching object when touched)
Beacon (when added, basically adds a little flashing image to the owner)

Anyone care to share some more?
#2
04/06/2007 (3:39 am)
Your list is great Phil, I like it, I think we may need some AI enemy behavirs like :

FlowAndAvoidObstacles(i.e. the enemy follow you and avoid all defind obstacles).

effect behaviors like:
AddShadows(i.e. show a shadow for the selected object when move).


that all what I can think about now maybe I will add more later.
#3
04/06/2007 (4:02 am)
Adam, the behavior repository link you posted doesnt actually have any behaviors to download other than fade object (it has the links, but no files), is that as expected?

Got some more ideas:

Split(on collision with a missile, create N number of smaller objects)
Cluster(move towards any other clusterable objects, on contact, both objects fuse into one object)
Throb(adds a throbbing highlight arrow above any object when in selected state)
Invulnerable(for N seconds, the object does not take any damage from collision)
Damageable(if a collision happens, the object takes damage)
MouseOverStat(a mouse over causes a small stats panel to show)
DOT(damage over time effect)
Healer(on collision with another object, applies health to it)

More to follow
#4
04/13/2007 (8:26 am)
Some ideas:

Inventory
Collectable (adds itself to the Inventory-Behaviour of the object it collides with, if present)
Portal (brings objects that collide with it else where)
LevelExit (starts a new level)
Vehicle (behaves like a type of a vehicle)
Mount (player object disappears and mounted object becomes the new control object)

[Edit]

I just figured that names like "inventory" don't make much sense because.. it's not a "Behavior". Maybe we should come up with a kind of naming convention?
#5
04/15/2007 (8:27 pm)
I wonder how the bounty system would work for behaviors? hmm.

I added one to play a sound when the mouse moves over an object. It should be on TDN if anyone is interested.
#6
04/15/2007 (9:14 pm)
Sweet, thanks. I added one that sets damping on the object.

Keep them coming!
#7
04/15/2007 (10:27 pm)
Quote:I just figured that names like "inventory" don't make much sense because.. it's not a "Behavior". Maybe we should come up with a kind of naming convention?

Maybe I'm the only one, though "behavior" seems to fit perfectly in my mind... the object is behaving like an inventory.
#8
04/16/2007 (12:25 am)
I'll add a few tonight.

MouseShoots - when mouse down, object shoots a given projectile

I need the "clone with behaviors" fix, then I can make a nice "speed game prototyping" video. I reckon I can make a game in less then 5 minutes.

Need a few more behaviors:

Increase score - when object dies, it increases some global score counter object
Count score - counts the score and displays it, does a "ticker" effect
Float and fade - floats up the screen, slowly fading out
Invulnerable flash - makes the object invulnerable for X seconds and makes it flash white to highlight this
SpawnChild - spawns another object from this object every X seconds (might be already there)
#9
04/16/2007 (12:30 am)
Shield - when key is pressed, a shield appears around the object (glowing ball), object doesnt take damage and shield counts down energy value
DisplayShield - displays the shield energy of a target object
#10
04/16/2007 (1:13 pm)
My wish list and a few others are in this thread: www.garagegames.com/mg/forums/result.thread.php?qt=60013
#11
04/16/2007 (8:26 pm)
I was fiddling around earlier today trying to build a "mount camera to this object" behavior...so far I'm not having much luck. If anyone wants to poke around with that it would be awesome. (Otherwise, I'll get to it at the end of the day-job work week.)
#12
04/16/2007 (8:36 pm)
Jeremy, that should be extremely easy. (unless you meant something completely different).
I use something like this. (It could of course be made a bit more "generic" by adding some variables instead of the hardcoded values to the mount call, I just didn't need that at the time).



if (!isObject(AttachCameraBehavior))
{
   %template = new BehaviorTemplate(AttachCameraBehavior);
   
   %template.friendlyName = "Attach Camera";
   %template.behaviorType = "Camera";
   %template.description  = "Attach the camera to this object.";
}


function AttachCameraBehavior::onAddToScene(%this, %scenegraph)
{
   if (!isObject(sceneWindow2d))
      return; 
   
   sceneWindow2D.mount(%this.owner, "0 0", 4, true);
}
#13
04/17/2007 (12:27 am)
Hmmm...I was running into problems using onLevelLoaded for the behavior (which I assumed was necessary since the behavior was being implemented from the level editor). I'm still trying to get my head around which callbacks occur when at runtime.

Thanks for the help, Magnus.
#14
04/17/2007 (9:36 am)
Yeah, it is kind of confusing. Check out this page on TDN. Hopefully that can help clear it up a little bit.

@Magnus: You should post that to the TDN behavior listing. :)
#15
04/17/2007 (5:21 pm)
Now I don't feel quite so bad...I'm getting the same problems/errors using your script, Magnus. It seems like the routine isn't running until I strip the %this out of the initial onAddToScene(%scenegraph) callback. Once I do that, I get an error message stating that the mount command is trying to mount to an invalid object.

The console shows: t2dSceneWindow::mount() - Couldn't find/Invalid object (followed by a string of characters that makes the garagegames forums refuse to accept the rest of my post)

Is this happening for anyone else? I'm on the mac build of the beta.
#16
04/17/2007 (5:30 pm)
Hm... It seem to work fine here.
BUT, I just realized something, I'm NOT using this behavior on objects created with the level editor... (I use it on an object created dynamically through script), maybe sceneWindow2D isn't set up when onAddToScene is called?
#17
04/17/2007 (6:48 pm)
@Magnus,
While working on a behavior last night I also found this to be true, sceneWindow2D is not there when the behaviors onAddToScene function is called. For now I work around it by scheduling a function that sets up my behavior 500 milliseconds after the onAddToScene call. If there's a better way it'd be nice for someone to share it ;)
#18
04/19/2007 (3:29 pm)
The bahvior is finished. I've opened it up so that all of the normal properties of mount() are available through the behavior. It's going up on TDN shortly.
#19
04/19/2007 (3:45 pm)
Nice going. I was going to update mine for you to support all the mount settings but I didn't have the time, and now I guess I don't have to do it. =)
#20
04/19/2007 (6:15 pm)
Awesome.
Page «Previous 1 2