by date
On Our Best Behaviors
On Our Best Behaviors
| Name: | Adam Larson | ![]() |
|---|---|---|
| Date Posted: | Apr 03, 2007 | |
| Rating: | 4.9 out of 5 | |
| Public: | YES | |
| Comments: | YES | |
| RSS Feed: | or Subscribe with . | |
| Profile Page: | View profile page for Adam Larson |
Blog post
In case you missed it yesterday because you were busy puzzling over the Constructor announcement, we launched an open beta of TGB 1.5. Read more about that here. One of the many new features in TGB 1.5 is that of behaviors. So far everybody seems to like the concept and potential of this system, but there's probably a lot of confusion as to exactly what they can do and how they can be used. I'll try to clear that up.
The high level description: A behavior is a small, self-contained piece of functionality that can be added to any scene object and configured through the editor. They are modular, so you can add many behaviors to an object and the same behavior to multiple objects. The behavior itself defines how an object reacts to certain events.
The first thing you should do when you install the beta is open the BehaviorPlayground project. You can do this by clicking on the giant 'Open' button, navigating to (TGBInstallDirectory)/games/BehaviorPlayground, and opening the project.t2dproj file. The playground level should open by default, but if it doesn't, go to file->open and select playground.t2d. This level is basically just a bunch of objects with various behaviors added to them. Hit the play button to see it in action.

I want to emphasize an important point here. There is no custom scripting done outside of the behavior definitions themselves in this level. If you don't actually have TGB, or haven't downloaded the beta yet, then this may not sound all that impressive. The point is, we are taking a big step here towards having full game building done entirely inside of the editor. Picture with me a library of hundreds of behaviors (created by us at GarageGames and TGB users). These behaviors are all on a site somewhere, complete with a description of what each one does. Then, users can <insert method of easily getting these behaviors into the editor> (This hasn't been fully fleshed out or implemented yet). Prototyping will be a breeze and artists and game dev novices can learn the basics without having to learn to code.
Now, of course, I'm sure there are people out there who like the power of scripting, or even coding directly in c++. Rest assured, the behaviors are merely an addition to everything that exists, not a replacement. But, I will say to those people, just because behaviors are ridiculously easy to use does not mean they don't have a lot of power. If I were to start making a game right now, the majority of the game logic would be done through behaviors. There are definitely things that are easier to do outside of behaviors, but for the most part, this is the way future TGB games are going to be made.
A story: The first demo we did with behaviors was last November. We had something pretty similar in appearance to the behavior playground that shipped with the beta. Me and Mark F were giving a demo that, to be honest, was mostly just us playing around (playing with the behaviors is pretty much a game in itself). So I had added an 'AsteroidsControl' behavior to an object (adds keybindings and the functionality for controlling an object like the ship in asteroids). To that same object, Mark added an 'AvoidMouse' behavior. The result was me trying to fly the ship to an arbitrary goal while Mark repelled it with the mouse. This was most definitely not something we intended to do, but it turned out to be pretty fun. And I got to thinking, how would I have actually coded that? I can guarantee my code would have been much more complicated than what was in the behavior definitions.
What I really want to see now is tons of community created behaviors on TDN. There's also potential for behavior packs that contain a set of behaviors for creating a certain type of game. In any case, that can't really happen until people know how to write them. A good place to start is by looking at the examples in the BehaviorPlayground project. Even better, I'll be writing a doc on TDN in the near future (tonight or tomorrow).
Hope everyone's enjoying the beta so far. Feel free to give feedback in the beta forums.
-Adam
The high level description: A behavior is a small, self-contained piece of functionality that can be added to any scene object and configured through the editor. They are modular, so you can add many behaviors to an object and the same behavior to multiple objects. The behavior itself defines how an object reacts to certain events.
The first thing you should do when you install the beta is open the BehaviorPlayground project. You can do this by clicking on the giant 'Open' button, navigating to (TGBInstallDirectory)/games/BehaviorPlayground, and opening the project.t2dproj file. The playground level should open by default, but if it doesn't, go to file->open and select playground.t2d. This level is basically just a bunch of objects with various behaviors added to them. Hit the play button to see it in action.

I want to emphasize an important point here. There is no custom scripting done outside of the behavior definitions themselves in this level. If you don't actually have TGB, or haven't downloaded the beta yet, then this may not sound all that impressive. The point is, we are taking a big step here towards having full game building done entirely inside of the editor. Picture with me a library of hundreds of behaviors (created by us at GarageGames and TGB users). These behaviors are all on a site somewhere, complete with a description of what each one does. Then, users can <insert method of easily getting these behaviors into the editor> (This hasn't been fully fleshed out or implemented yet). Prototyping will be a breeze and artists and game dev novices can learn the basics without having to learn to code.
Now, of course, I'm sure there are people out there who like the power of scripting, or even coding directly in c++. Rest assured, the behaviors are merely an addition to everything that exists, not a replacement. But, I will say to those people, just because behaviors are ridiculously easy to use does not mean they don't have a lot of power. If I were to start making a game right now, the majority of the game logic would be done through behaviors. There are definitely things that are easier to do outside of behaviors, but for the most part, this is the way future TGB games are going to be made.
A story: The first demo we did with behaviors was last November. We had something pretty similar in appearance to the behavior playground that shipped with the beta. Me and Mark F were giving a demo that, to be honest, was mostly just us playing around (playing with the behaviors is pretty much a game in itself). So I had added an 'AsteroidsControl' behavior to an object (adds keybindings and the functionality for controlling an object like the ship in asteroids). To that same object, Mark added an 'AvoidMouse' behavior. The result was me trying to fly the ship to an arbitrary goal while Mark repelled it with the mouse. This was most definitely not something we intended to do, but it turned out to be pretty fun. And I got to thinking, how would I have actually coded that? I can guarantee my code would have been much more complicated than what was in the behavior definitions.
What I really want to see now is tons of community created behaviors on TDN. There's also potential for behavior packs that contain a set of behaviors for creating a certain type of game. In any case, that can't really happen until people know how to write them. A good place to start is by looking at the examples in the BehaviorPlayground project. Even better, I'll be writing a doc on TDN in the near future (tonight or tomorrow).
Hope everyone's enjoying the beta so far. Feel free to give feedback in the beta forums.
-Adam
Recent Blog Posts
| List: | 04/03/07 - On Our Best Behaviors 01/31/06 - Meet the T2D Level Builder 12/08/05 - Plan for Adam Larson 08/26/05 - Plan for Adam Larson 07/28/05 - Plan for Adam Larson 07/18/05 - Plan for Adam Larson |
|---|
Submit your own resources!| Leroy Frederick (Apr 03, 2007 at 00:47 GMT) Resource Rating: 5 |
Definitely the future of TGB (and general) game making, especially if it allows you to do things that have already been coded in the past with ease by allowing you to just plug em' in, thus allowing for more concentration on gameplay and vision, and less on re-inventing the wheel ;0)
EDIT: Opps, I almost forgot guys and gals, thanks for the great work, TGB (and other good gg products) just keeps getting better and better with every upgrade! It's most appreciated! :0)
Edited on Apr 03, 2007 00:49 GMT
| Gina-Marie \"Netjera\" Hammer (Apr 03, 2007 at 01:19 GMT) Resource Rating: 5 |
| David Higgins (Apr 03, 2007 at 03:15 GMT) |
a 'Grab' behavior, which actives a Follow Mouse code snippet when the object is Clicked ... and drops the object when it's clicked again ...
adding a very little amount of code around this ... you could recreate Solitaire in a fairly short period of time, where as with the current 1.1.3 build, you'd have to write a bunch of onMouseDown, onMouseDrag (or schedule based, I like schedules personally) .. then spend time testing this code, etc, etc ... now, you can skip the tedious 'reinventing the wheel' process and jump right to the core logic ...
I'm viewing behaviors as a way to create code libraries, of reusable, easy to write, simply to apply snippets and functionalities you can assign to objects ...
Now ... can we add/remove behaviors to objects on-the-fly through script easily ... or is there a convoluted series of whacky script calls we have to make to assign behaviors "on the fly" ... like for example, to recreate solitaire, we may want to assign different behaviors to cards based on a logic check ... if it's the Ace, assign the "Jump to Position" behavior ... otherwise, assign the "Drag and Drop" behavior ...
Can we also cancel a behaviors action ... for example, in a "Drag and Drop" behavior where you click to grab, follow mouse and click to release ... can we cancel the release of the object through a logic check ... or re-initiate the 'grab' after a release has been made based on a logic check -- ie; behaviors allow us to tie into 'events' (as it was put), but do behaviors themselves have 'events' (or call backs)
And, I can't wait to start getting into coding behaviors and flooding TDN with tons of cool things .... </grin>

| A Herrera (Apr 03, 2007 at 03:27 GMT) |
I would guess that a lot of people will jump on the bandwagon of creating bahavior packs.
This is definitely worth spending the time to learn.
Edited on Apr 03, 2007 03:44 GMT
| Tom Eastman (Eastbeast314) (Apr 03, 2007 at 15:21 GMT) |
Awesome to see them so close to release, Adam!
| Justin DuJardin (Apr 03, 2007 at 17:25 GMT) Resource Rating: 5 |
%object.addBehavior(BehaviorName.createInstance()); will add BehaviorName behavior to your %object.
Cheers,
-Justin
| Tom Bentz (Apr 03, 2007 at 19:44 GMT) |
| Matthew Langley (Apr 03, 2007 at 19:56 GMT) |
| Simon Love (Apr 03, 2007 at 21:22 GMT) |
The first thing that came to mind was how easy TGB would be to pick up for the Gamemaker audience.
Congrats GG, you keep throwing surprises in my sad, boring life :)
| Chris Jorgensen (Apr 03, 2007 at 22:08 GMT) |
| Joe Rossi (Apr 04, 2007 at 00:06 GMT) |
Edited on Apr 04, 2007 00:07 GMT
| Bruno Campolo (Apr 04, 2007 at 22:38 GMT) |
You must be a member and be logged in to either append comments or rate this resource.



4.9 out of 5


