Unity blog with examples

Hi everyone,

We’ve been getting things organized at our site, and have finally gotten online a few Unity tutorials. The first one on behavior trees (using AngryAnt’s Behave) went up a couple days ago, and today I uploaded another one on proximity detection and flocking with triggers.

http://www.arges-systems.com/

I’ll have a more detailed Behave tutorial in the next few days, with a few agents interacting with each other and the environment.

Just noticed we forgot to include the RSS feed link in the template: http://www.arges-systems.com/rss

Drop me a note, let me know what you think.

Best,

Ricardo

Very nice.

Something you could improve are the code snippets. The font/size/color isn’t very easily readable at the moment(especially the blue).

And:

that should probably read: “Flock (Instance)”

Hi Leepo,

I’m still unsure about the code snippets, I might just end up going with un-colored text, like in the first example.

Thanks for pointing out the quote issue on this one.

Thanks for your blogging! I am interested in Behavior Trees for my iphone games, so will definitely be reading your article and checking out Behave. I had not run into Behave until now. I was just building up parented GameObjects with scripts, as kind of a dumb yet dynamic behavior tree. But Behave looks really nice.

Nice website Arges (Ric). Hope to see some beginner tutorials (general tut’s) as well there at some point.

Thomas

Hi there Mindlube,

Behave is really nice so far, if a work in progress and still somewhat undocumented. I keep pestering AngryAnt with e-mails about how Behave implements a concept or other, hopefully the process of writing these articles will clear up its usage.

Oh, and you’re really going to like the next one. :wink: The sample will go up tonight, the article soon after.

Hi Thomas! What type of beginner task do you think is not well covered by the available tutorials? I hesitated about going into that area, particularly because of how well detailed the 2D and 3D platform tutorials were.

I am thinking more of “short” and quick tutorials. Little things that help us artists understand the need and use of code snippets/short scripts. For example:

• How do I make something rotate via script
• How do I scale something via script
• How do I make the color of light switch via script
etc…

By learning those little “things” I can be more productive and don’t have to ask a programmer all the time to do such “trivial” tasks.

Thomas P.

Mindlube, before I forget: you may want to contact AngryAnt and ask him if he has profiled Behave, since the iPhone hardware is very limited. I haven’t done it myself, so I can’t speak to that. He’s usually quick to reply.

Thanks Ricardo I will do that.

Nice site! I’m looking for exactly the same kind of scripts tutorials explained by thomas

Hi Alex,

This is the other example I mentioned: http://www.arges-systems.com/examples/10/agent-handling-with-behavior-trees

Please do let me know what AngryAnt says about performance. I asked him if he knew of anyone using it on the iPhone, but he doesn’t.

Best,

Ric

Hey there

Yea I’m sorry about the lack of documentation. I’m really bad at that. Both projects are still WIP and I’m really just releasing builds (when I’m happy with stability and progress) and then going straight back to development. That’s why its so awesome that Ricardo is willing to spare some time to create these tutorials.

I did purchase some screen-casting software with the intend of launching some quick and dirty introductions to various parts of the projects, but I’m a bit pressed for time lately (I’ve only got what little spare time I have to do these projects in).

But please feel free to post questions / comments / suggestions to the forum threads tied with each project. If I get less feedback, I’m just gonna assume that either the projects are uninteresting / perfect (yea right!) and go ahead and implement what I find useful.

Really? Damn! I should be advertising or something. No wonder I’ve received so little feedback.

Regarding performance: Everything is compiled to optimised .net assemblies - you won’t hit a bottleneck in running the behaviour logic. That also means that the runtime works cross-platform (webplayer included).

Unfortunately I don’t have access to an iPhone license so I haven’t been able to test on iPhone yet. However it looks like assemblies currently aren’t AOT compiled on the Basic iPhone license. I’m hoping that this is only temporary as I find it a bit silly to have this barrier on the iPhone when its not there in the webplayer.

AOT compilation is always done when publishing to the iPhone - The iPhone kernel does not allow JITing code, so you either have to interpret the code (SLOOOW), or AOT-compile

Sure. I’m just wondering whether its not possible to AOT compile JIT compiled assemblies?

Basically I’m just looking for a way in - should I perhaps supply an already AOT compiled assembly and how would that work on the Basic license if at all?

There is one thing to keep in mind: Unity iPhone only supports .NET 1.1, so if you have a fully fledged Unity .Net 2.0 DLL it won’t work on the iPhone version at all.

Hi,

Maybe this is the wrong place for this, but I was wondering if there was any way to implement AngryAnt’s Behave using Javascript, or if you have to use C# or Boo only for Agent Interfaces.

Basically, I don’t know either C# or Boo very well :wink: I’m a JavaScripter.

This might be of assistance in implementing interfaces, but I haven’t tried it myself:

http://www.unifycommunity.com/wiki/index.php?title=JavaScript_Type_Inference#.28.21.29_A_Word_of_Caution_About_Interfaces

Someone else was having trouble with it on the forums, so perhaps a comment on that thread would bring some pointers:

http://forum.unity3d.com/viewtopic.php?t=15134

Not sure how you’d handle the enum comparison, since Unity’s quasi-Javascript doesn’t seem to support them, but you might be fine when simply comparing it against the predefined values.

As an aside I’m not very partial to Unity’s “Javascript”, and in general it seems to be there mostly to provide an easy point of entry. It might be worth to pick up one of the other languages if you’re getting into more complex code.

enum FileType {SceneLoad, HeightmapLoad, TextureLoad, SceneSave, HeightmapSave, SplatmapSave, ColormapSave, ObjSave}
private var fileType : FileType;

function FileWindow () {
	// some stuff
	if (fileType <= FileType.TextureLoad) {
		// do loading stuff here
	}
	else {
		// do saving stuff here
	}
}

That’s from Fractscape, which is in Javascript, and not lacking in complexity. :wink:

–Eric

Hi Eric,

So it can use enums, thanks for the tip. I understood you couldn’t declare them, is that correct?