Using Angry Ant’s Behave Library in UnityScript

I have been learning how to use Unity3D recently, and I really wanted to use the Behave library without having to use C#. It took me a little while, but here is an example of doing it:

#pragma strict


// Where we store our new Behave Tree

var BTree : Behave.Runtime.Tree;


// Where we store our Behave IAgent

var Agent : BSIAgent;


// Where we implement all of our Behave level functions

public class BSIAgent implements Behave.Runtime.IAgent {


public function Tick (sender : Behave.Runtime.Tree, init : System.Boolean) {


return Behave.Runtime.BehaveResult.Success;



public function Reset (sender : Behave.Runtime.Tree) {



public function SelectTopPriority (sender : Behave.Runtime.Tree, IDs : int[]){

return IDs[0];




function Start() {

// Create a new agent

Agent = new BSIAgent();

// Create our tree

BTree = BLBasicMiner.InstantiateTree( BLBasicMiner.TreeType.Task_Systems_BasicTS,   Agent   );

// While the application is running and our tree exists

while (Application.isPlaying && minerTree != null) {

// Wait for a certain amount of time

yield new WaitForSeconds(1.0f / minerTree.Frequency);

// Tick the tree





function AIUpdate() {



Yes, this is a bit of a hack, but I haven’t had much time to refine it. Hopefully in the future I will be able to provide a more readable version.

Getting Unity Web Player to work on Mac Lion

I have been getting back into using Unity 3D, which I believe is a very useful and insightful tool, but I have been having trouble getting the Web Player to work. For some reason, when I would install it, Safari wouldn’t recognize that it was installed, even after  restarting Safari.

Turns out that when the web player was being installed, it was being installed in the Unused Folder inside the plugins directory. So to fix it was as simple as moving it up a directory. Huh, funny bug.

Getting the Lion C/C++ Compiler

Unfortunately for developers like me, Mac Lion does not come with GCC, G++ or anything else pre-installed on the computer (plus the compilers are not GNU standard, so you can’t update them by compiling a newer version).

However, Apple has produced a disk image with an installer for these tools, if you want command-line tools like me, or you can download Xcode and use that instead.

If you have Xcode and want the command-line tools, all you have to do is go to the Xcode menu while Xcode is open, choose the Preferences item, click on the Downloads tab and press the button saying you want to install the command-line tools.

If you want Xcode, go to the App Store and download it. Personally, I like having both, mainly because I like the structure of Xcode for certain projects, but I enjoy the flexibility of the command line. Plus, it is simpler to update the command line tools through Xcode because it informs you of updates. Of course, this can be undesirable; I had to recompile some custom libraries that I had installed because of changes in the updates…

If you just want the command-line tools, follow these steps:

  1. Go to the Apple Developer’s Download page (This requires that you have a Developer Profile. You can get one for free, so you might as well.)
  2. Click on the latest version of the Command Line Tools
  3. On the right side of the screen there will be a link to the file. Click it and it will start the download.
  4. Once it has finished downloading, open the disk image and install the package.

NOTE: You need to have Administrator Privileges to install the command line tools! 

Update: Kernel Development

I decided that I was going to convert my c code into c++ today. Big mistake. C code does not and cannot be directly converted into C++ code, at least in this case. I was running around, trying to get all of my void * casts to work, getting const char * casted… blearg. I just gave up and I am returning to C.

Maybe in the future I will try to write a kernel from scratch in C++ because I could see objects being very useful.

Kernel Development – Amazing!

I have recently started a journey into the world of Kernel Land… That was an eye opener. I never realized how complex operating systems were before I decided to roll my own from scratch.

Currently I am at the point where I can accept input from the keyboard and display it on the screen in Mode 7. I am working on a floppy driver right now, and am going to work on File Systems after that.

I have been developing it for fun, in all actuality, but know that I know a little bit more I am going to put a bit of effort into making something a bit different than Linux or Mac or Windows ( At least as different as I can make it.) Probably something that is more pointed towards multi-core CPUs from the get-go.

I started learning by using Bona Fide OS Developer tutorials and the OSDev wiki. These are very good resources for the beginner, in my opinion.