Microsoft Expression Blend in Games — Part 3

Well a bit of a wait involved for this part. Due to heavy work­load at the moment expect the next few parts to be slow.

This part of the art­icle is how to extract the Styles out into ras­ter bit­maps. In Expres­sion Blend you can store your graph­ics as either Vec­tor or Bit­map, it doesn’t really mat­ter. At Infin­ite a lot of the UI was using Bit­map graph­ics but they were tiling the side pieces to make vari­able size dia­log boxes. In my per­sonal pro­jects I have used vec­tor graph­ics which by its very nature res­izes. I will do a art­icle later on show­ing simple code/tool which will help designers/artists get graph­ics from Expres­sion Design (the graph­ics tool) into Expres­sion Blend inside a resource dictionary.

We will later sup­port anim­a­tions cre­ated using key frame anim­a­tion inside blend, and export them out as a mont­age of images. When the menu is run­ning inside the game, the images will swap to being vis­ible, giv­ing the anim­a­tion effect in bit­map. We will ideally put some smarts into the anim­a­tion sys­tem so it won’t take samples if noth­ing has changed.

For optim­isa­tion pur­poses we will com­bine many of the graph­ics ele­ments into one lar­ger image. This will reduce the amount of tex­ture memory you have to alloc­ate to the screen. Also another con­straint this helps us with is that many plat­forms require that images be in power of 2. If you aren’t doing some sort of image pack­ing then you have a awful lot of wasted tex­ture space with pixels that aren’t being used.

Each ele­ment of the GUI will also have mul­tiple states, for example when the con­trol is act­ive or dis­abled. Some con­trols will have spe­cial­ised states, for example for a but­ton when it is clicked. We will export out dif­fer­ent images for each one of these states.

First we need some code that will take a frame­work ele­ment and gen­er­ate a ras­ter image.

pub­lic static void CreateImageFromElement(FrameworkElement ele­ment, string imageFilePath)
  1. {
  2.  // We must show a win­dow to get all the cal­cu­la­tions done for the element.
  3.  // Note that the ele­ment must not have been shown in a win­dow earlier
  4.  // Win­dows can only be shown and then closed once (they can be hid­den mul­tiple times).
  5.  // We likely want to cre­ate a clone of the ori­ginal ele­ment, copy its setting
  6.  // and then show it in a new win­dow because our ele­ments would of already
  7.  // been shown in another win­dow (and ele­ments can­not belong to two windows).
  8.  Win­dow win­dow = ShowWin­dow­ForE­le­ment(ele­ment);
  9.  
  10.  // Per­form a refresh on the con­trol. This causes the lay­out cal­cu­la­tions to be done
  11.  
  12.  // Size the Grid.
  13.     ele­ment.Meas­ure(new Size(Double.Pos­it­i­veIn­fin­ity, Double.Pos­it­i­veIn­fin­ity));
  14.  
  15.     // Lay­out pass.
  16.     ele­ment.Arrange(new Rect(new Point(0, 0), ele­ment.Desired­Size));
  17.  
  18.     // Get the width/height of the ele­ment, which will be used as the image height/width
  19.  int imageWidth = (int)ele­ment.Actu­al­Width;
  20.  int image­Height = (int)ele­ment.Actu­al­Height;
  21.  
  22.  // Cre­ate a new Alpha’d 32bit Bit­map tar­get. This will take the con­trol and render it
  23.  // in a bit­map object. This is then used to out­put the ele­ment to a tex­ture file.
  24.  Render­Tar­get­Bit­map bmp = new Render­Tar­get­Bit­map(imageWidth, image­Height, 96, 96, Pixel­Formats.Pbgra32);
  25.  bmp.Render(ele­ment);
  26.  
  27.  // Cre­ate a PNG bit­map encoder, this is used to encode the render
  28.  // tar­get bit­map into PNG format. There are other encoders you can use
  29.  // for other formats.
  30.  Png­Bit­ma­pEn­coder encoder = new Png­Bit­ma­pEn­coder();
  31.  encoder.Frames.Add(Bit­map­Frame.Cre­ate(bmp));
  32.  
  33.  // Now out­put the con­tents of the encoded PNG to a file.
  34.   using (Stream stream = File.Cre­ate(image­File­Path))
  35.     {
  36.   encoder.Save(stream);
  37.  }
  38.  
  39.     // Close the win­dow we opened earlier.
  40.  if (win­dow != null)
  41.  {
  42.   win­dow.Close();
  43.  }
  44. }
  45.  
  46. pub­lic static void ShowWin­dow­ForE­le­ment(Frame­workEle­ment ele­ment)
  47. {
  48.  // Get the win­dow for the element
  49.  Win­dow win­dow = Win­dow.GetWin­dow(ele­ment);
  50.  
  51.  // If no Win­dow has been alloc­ated to the win­dow before now
  52.  // cre­ate a brand new win­dow for the element.
  53.  if (win­dow == null)
  54.  {
  55.   win­dow = new Win­dow();
  56.   win­dow.Con­tent = element;
  57.   win­dow.Show();
  58.  }
  59.  
  60.  return window;
  61. }

To be able to export the ele­ment out, we can’t do it to the ori­ginal con­trol. This is because when we export the con­trol to a image, we want to isol­ate it to be the only con­trol that is expor­ted. This is easi­est if we add the con­trol to a fresh win­dow with noth­ing but the con­trol inside of it. We need to clone the con­trol and copy across com­mon set­tings such as the style, the resources from the ori­ginal win­dow etc.

  1. private static T Cre­ate­Con­trol<T>(Con­trol ele­ment) where T : Control
  2. {
  3.     if (ele­ment == null)
  4.     {
  5.         return null;
  6.     }
  7.     T newEle­ment = (T)Activ­ator.Cre­ateIn­stance(ele­ment.Get­Type());
  8.  
  9.     newEle­ment.Width = ele­ment.Actu­al­Width;
  10.     newEle­ment.Resources = Win­dow.GetWin­dow(ele­ment).Resources;
  11.     newEle­ment.Height = ele­ment.Actu­al­Height;
  12.     newEle­ment.Tem­plate = ele­ment.Tem­plate;
  13.     newEle­ment.Style = ele­ment.Style;
  14.     return newElement;
  15. }
Posted in Games, UI Tools | Leave a comment

Microsoft Expression Blend in Games — Part 2

Alright, in this art­icle I am going to focus on how to get mean­ing­ful inform­a­tion out of the con­trols con­tained within a GUI screen.

The first thing we need to do is extract some mean­ing­ful inform­a­tion from the ele­ments con­tained inside WPF. I will show you a num­ber of helper func­tion firsts that will extract things like a ele­ments loc­a­tion or the style name asso­ci­ated with the con­trol (which we can then use dur­ing the image gen­er­a­tion stage).

In WPF we can ask for coordin­ates of a object rel­at­ive to another object. In our case want the pos­i­tions to be rel­at­ive to the Win­dow it has been placed within. This will give us our screen coördin­ate position.

// Get the point of the ele­ment rel­at­ive to where it is placed on the
  1. // Win­dow. Basic­ally the X,Y pos­i­tion where it is placed on the window.
  2. // 99% of times you’ll pass 0,0 for the poin­tOnEle­ment, this means the top
  3. // left hand corner of the ele­ment where you want the coördin­ate, but you
  4. // may want to get the coördin­ate to the centre for example so will pass in
  5. // width / 2, height / 2
  6. pub­lic static Point Point­ToW­in­dow(Frame­workEle­ment ele­ment, Point poin­tOnEle­ment)
  7. {
  8.  Win­dow wnd = Win­dow.GetWin­dow(ele­ment);
  9.  
  10.  if (wnd == null)
  11.  {
  12.   throw new Inval­id­Op­er­a­tionEx­cep­tion(“tar­get ele­ment is not yet con­nec­ted to the Win­dow draw­ing sur­face”);
  13.  }
  14.  
  15.  Point value = ele­ment.Trans­formToAncestor(wnd).Trans­form(poin­tOnEle­ment);
  16.  
  17.  return value;
  18. }

Next we have to be able to get the name of the Style that the con­trol is asso­ci­ated with. We will hunt down the styles asso­ci­ated with the win­dow. One poten­tial issue with this approach is that the styles must be asso­ci­ated with the Win­dow, in WPF tech­nic­ally you can have uni­ver­sal styles for the entire applic­a­tion (by adding them to the Applic­a­tion object), but adding a resource dic­tion­ary takes around 15 seconds in Blend through the resource tab.

private static string GetResourceName(ResourceDictionary resour­ce­Dic­tion­ary, object resource)
  1. {
  2.  if (resource == null)
  3.  {
  4.   return string.Empty;
  5.  }
  6.  
  7.  // Check the merged dic­tion­ar­ies to see if they have the resource object
  8.  // con­tained inside of them.
  9.  if (resour­ce­Dic­tion­ary.Merged­Dic­tion­ar­ies != null)
  10.  {
  11.   foreach (Resour­ce­Dic­tion­ary child­Dic­tion­ary in resour­ce­Dic­tion­ary.Merged­Dic­tion­ar­ies)
  12.   {
  13.    string resource­Name = GetRe­source­Name(child­Dic­tion­ary, resource);
  14.  
  15.    if (string.IsNul­lOr­Empty(resource­Name) == false)
  16.    {
  17.     return resourceName;
  18.    }
  19.   }
  20.  }
  21.  
  22.  // Check each dic­tion­ary entry to see if they have the resource
  23.  // con­tained within them, if there are no matches
  24.  // return a empty string.
  25.  foreach (Dic­tion­ary­Entry entry in resour­ce­Dic­tion­ary)
  26.  {
  27.   if (entry.Value != resource)
  28.   {
  29.    con­tinue;
  30.   }
  31.  
  32.   string key = entry.Key as string;
  33.  
  34.   if (string.IsNul­lOr­Empty(key) == false)
  35.   {
  36.    return key;
  37.   }
  38.  }
  39.  
  40.  return string.Empty;
  41. }
  42.  
  43. private static string GetEle­ment­Style­Name(Frame­workEle­ment ele­ment)
  44. {
  45.  Win­dow win­dow = Win­dow.GetWin­dow(ele­ment);
  46.  
  47.  string resource­Name = GetRe­source­Name(win­dow.Resources, ele­ment.Style);
  48.  
  49.  // If we don’t have a valid resource name, give it just the name of the type
  50.  if (string.IsNul­lOr­Empty(resource­Name) == true)
  51.  {
  52.   resource­Name = ele­ment.Get­Type().Name;
  53.  }
  54.  
  55.  // Add the size to the ele­ment. Due to the fact we are converting
  56.  // to a ras­ter image, we want to have each size of the style
  57.  // be con­sidered another style type.
  58.  return string.Format(”{0}_{1}x{2}”, resource­Name, (int)ele­ment.Actu­al­Width, (int)ele­ment.Actu­al­Height);
  59. }

Essen­tially we need to iter­ate through our col­lec­tion of cre­ated win­dows. We then will iter­ate through all the child ele­ments of a window.

pub­lic void ProcessMenus(Window[] windows)
  1. {
  2.     foreach (Win­dow win­dow in win­dows)
  3.     {
  4.         Pro­cessEle­ments(win­dow);
  5.     }
  6. }

The next step is to pro­cess the indi­vidual con­trols. We don’t pro­cess Pan­els, Win­dows or Page’s dir­ectly, instead we are inter­ested in their chil­dren. With Window’s and Page’s we will use the Logic­al­Tree­Helper, which is a class which allows us to iter­ate down the chil­dren as the designer has set inside Expres­sion Blend (for example but­tons, text­b­locks etc), WPF also has the concept of Visu­al­Tree­Helper, which con­tains the list of chil­dren who haven’t been optim­ised out of the screen and also visual chrome objects, we are not inter­ested in the Visu­al­Tree­Helper in our scenario.

Once we have the chil­dren we are then able to extract out the inform­a­tion about the child. There is com­mon inform­a­tion such as Loc­a­tion, Width, Height that is com­mon to all chil­dren, while cer­tain types of chil­dren we may want to extract out addi­tional information.

  1. private void Pro­cessEle­ments(Frame­workEle­ment ele­ment)
  2. {
  3.     if (ele­ment == null)
  4.         return null;
  5.  
  6.  // If the ele­ment is a Panel (such as Grid, Dock­Panel etc) then pro­cess its
  7.  // chil­dren and bypass the Panel (we don’t want to store the panel details).
  8.  Panel panel = ele­ment as Panel;
  9.  if (panel != null)
  10.  {
  11.   foreach (Frame­workEle­ment childEle­ment in panel.Chil­dren)
  12.   {
  13.    Pro­cessEle­ments(ele­ment);
  14.   }
  15.  
  16.   return;
  17.  }
  18.  
  19.  // If the ele­ment is a Win­dow or Page, use the Logic­al­Tree­Helper to get
  20.  // access to the chil­dren con­tained within the Win­dow or Page.
  21.  // We don’t care about the Window/Page directly.
  22.  Win­dow win­dow = ele­ment as Window;
  23.  if (win­dow != null)
  24.  {
  25.   foreach (Frame­workEle­ment childEle­ment in Logic­al­Tree­Helper.GetChil­dren(win­dow);
  26.   {
  27.    Pro­cessEle­ment(ele­ment);
  28.   }
  29.  
  30.   return;
  31.  }
  32.  
  33.  Page page = ele­ment as Page;
  34.  if (page != null)
  35.  {
  36.   foreach (Frame­workEle­ment childEle­ment in Logic­al­Tree­Helper.GetChil­dren(page);
  37.   {
  38.    Pro­cessEle­ment(ele­ment);
  39.   }
  40.  
  41.   return;
  42.  }
  43.  
  44.  // A object that con­tains details about our GuiElement.
  45.  // This ele­ment is what is saved out for the optim­ised game format.
  46.  GuiEle­ment guiEle­ment = null;
  47.  
  48.  // Now we have to check to see what type of ele­ment it is.
  49.  Check­Box check­Box = ele­ment as CheckBox;
  50.  
  51.  if (check­Box != null)
  52.  {
  53.   Check­BoxGuiEle­ment check­BoxGuiEle­ment = new Check­BoxGuiEle­ment();
  54.   check­BoxGuiEle­ment.Text = check­Box.Con­tent.ToString();
  55.   guiEle­ment = checkBoxGuiElement;
  56.  }
  57.  
  58.  Pro­gress­Bar pro­gress­Bar = ele­ment as ProgressBar;
  59.  if (pro­gress­Bar != null)
  60.  {
  61.   Pro­gress­Bar­GuiEle­ment pro­gress­Bar­GuiEle­ment = new Pro­gress­Bar­GuiEle­ment();
  62.   pro­gress­Bar­GuiEle­ment.Max = (int)pro­gress­Bar.max;
  63.   guiEle­ment = progressBarGuiElement;
  64.  }
  65.  
  66.  
  67.  // If the guiEle­ment is null then some­thing went wrong.
  68.  // We didn’t dis­cover what type of ele­ment it was.
  69.  // Throw an exception
  70.  if (guiEle­ment == null)
  71.  {
  72.   throw new Inval­id­Op­er­a­tionEx­cep­tion(“invalid gui ele­ment type.”);
  73.  }
  74.  
  75.  
  76.  // Get com­mon details that all Frame­workEle­ment share in common
  77.  // such as the loc­a­tion rel­at­ive to the top left of the Window
  78.  // The width/height and if they are focusable.
  79.  Point loc­a­tion = Point­ToW­in­dow(ele­ment, new Point(0, 0));
  80.  guiEle­ment.Style­Name = GetEle­ment­Style­Name(ele­ment);
  81.  guiEle­ment.X = (float)Math.Round(point.X);
  82.  guiEle­ment.Y = (float)Math.Round(point.Y);
  83.  guiEle­ment.Width = (float)Math.Round(ele­ment.Actu­al­Width);
  84.  guiEle­ment.Height = (float)Math.Round(ele­ment.Actu­al­Height);
  85.  
  86.  guiEle­ment.Focus­able = ele­ment.Focus­able;
  87.  
  88.  // Add the gui ele­ment to the screen
  89.  // which con­tains all the elements.
  90.  guiS­creen.Ele­ments.Add(guiEle­ment);
  91.  
  92. }
Posted in Games, UI Tools | Leave a comment

Microsoft Expression Blend in Games

As prom­ised, this post relates to a talk I gave recently at FreePlay.

Microsoft Expres­sion Blend is a GUI cre­ation tool. It allows for users to cre­ate extremely cus­tom­ised GUI’s using advanced Pan­el­ing tech­niques and vec­tor based graph­ics that allow for res­ol­u­tion inde­pend­ent screens. All of this is done in a XML based GUI declar­a­tion lan­guage which allows users to quickly get GUI’s up and running.

At Infin­ite Inter­act­ive I designed a parser that would take GUI’s developed in Microsoft Expres­sion Blend and then take them to be used inside their cus­tom UI engine. Before using Expres­sion Blend they would manu­ally con­fig­ure their GUI’s by hand by manip­u­lat­ing pos­i­tion data inside a XML file. The Expres­sion Blend con­ver­sion util­ity would take the Win­dows cre­ated inside Expres­sion Blend and out­put the same XML File.

This first of sev­eral part series of art­icles will focus on cre­at­ing game optim­ised GUI screens.

So why aren’t Expres­sion Blend GUI’s optim­ised already for game use. There are sev­eral prob­lems with using Expres­sion Blend Screens right out the box:

  • The coordin­ates are not cal­cu­lated until runtime. Hav­ing abso­lute pixel coordin­ates can reduce the cal­cu­la­tions done dur­ing GUI load up.
  • The graph­ics are in Vec­tor format which take CPU time to gen­er­ate. Bit­map images which are sized to the cor­rect size are much more effi­cient since they can be loaded dir­ectly into tex­ture memory and then blit­ted to the screen.
  • Runtime spe­cial effects can also be just stored as tex­tures rather than cal­cu­lated at runtime, again redu­cing the need on the CPU.

So the first thing I looked at when it came to con­vert­ing into the optim­ised format was using the XAML XML script. It seemed it might be easy just to parse the XML and then cre­ate a optim­ised ver­sion from that. I didn’t take this approach for sev­eral reas­ons, the main two are that its dif­fi­cult to extract the coordin­ates for ele­ments, since for screen inde­pend­ence Expres­sion Blend keeps everything rel­at­ive to the panel the ele­ment is a child of (this goes for anim­a­tions as well). The second reason is that it’s very easy to grab ras­ter images of ele­ments when access­ing the assembly (its only a few lines of code), if I was to use the XAML I would have to work out how to cal­cu­late all this by hand myself.

The approach I took was when you com­pile the WPF applic­a­tion, it pro­duces a assembly (either a .DLL or .EXE file), and .NET allows you to access classes inside this assembly. So essen­tially you load the Assembly into memory and then you can cre­ate Types con­tained within that assembly.

private static Win­dow[] LoadWindowsInAssembly(string assemblyFileName)
  1.         {
  2.             List win­dow­sList = new List();
  3.  
  4.             if (File.Exists(assembly­Fi­le­Name) == false)
  5.             {
  6.                 Con­sole.WriteLine(“Error: The assembly {0} is not a valid file”, assembly­Fi­le­Name);
  7.                 return win­dow­sList.ToAr­ray();
  8.             }
  9.  
  10.             Assembly assembly = Assembly.Load­From(assembly­Fi­le­Name);
  11.  
  12.             foreach (Type type in assembly.Get­Types())
  13.             {
  14.                 if (type.IsSub­clas­sOf(typeof(Win­dow)))
  15.                 {
  16.                     Win­dow win­dow = Activ­ator.Cre­ateIn­stance(type) as Window;
  17.  
  18.                     if (win­dow == null)
  19.                     {
  20.                         Con­sole.WriteLine(“Error: Can­not cre­ate a win­dow from assembly {0} with type {1}.”, assembly­Fi­le­Name, type.Name);
  21.                         con­tinue;
  22.                     }
  23.  
  24.                     win­dow­sList.Add(win­dow);
  25.                 }
  26.                 else if (type.IsSub­clas­sOf(typeof(Page)))
  27.                 {
  28.                     // With pages, place them inside a con­tain­ing window.
  29.                     // Since we don’t provide a size for the window
  30.                     // it should size to acco­mod­ate the Page.
  31.                     Page page = Activ­ator.Cre­ateIn­stance(type) as Page;
  32.  
  33.                     if (page == null)
  34.                     {
  35.                         Con­sole.WriteLine(“Error: Can­not cre­ate a page from assembly {0} of type {1}.”, assembly­Fi­le­Name, type.Name);
  36.                         con­tinue;
  37.                     }
  38.  
  39.                     Win­dow win­dow = new Win­dow();
  40.                     win­dow.Name = page.Name;
  41.                     win­dow.Con­tent = page;
  42.                     win­dow­sList.Add(win­dow);
  43.                 }
  44.             }
  45.  
  46.             // Have to tem­por­ar­ily show and hide the win­dows. The reason being
  47.             // all the pos­i­tion­ing data is not set until the win­dows are shown.
  48.             foreach (Win­dow win­dow in win­dow­sList)
  49.             {
  50.                 win­dow.Show();
  51.                 win­dow.Hide();
  52.             }
  53.  
  54.             return win­dow­sList.ToAr­ray();
  55.         }

The next few art­icles I will focus on the following:

  • Gen­er­at­ing a GUI XML (or other metadata lan­guage like YML) which con­tains abso­lute pos­i­tion­ing inform­a­tion optim­ised for game use.
  • Gen­er­at­ing images and metadata inform­a­tion for the styles con­tained within the GUI screens. Since GUI screens may share styles we will out­put images for each res­ol­u­tion a style is used only once.
  • Gen­er­at­ing the anim­a­tion asso­ci­ated with the GUI Screens.
  • A test applic­a­tion on the iPhone/iPad demon­strat­ing the GUI Screen system.
Posted in UI Tools | Tagged | 3 Comments

Games Programmer who happens to be Gay

Hmm, If this post goes out it’ll be to much internal debate in my head.

I am gay, and by defin­i­tion a gay games pro­gram­mer. I want to write about how being gay has effected my life in terms of my work­ing career.

I don’t hold much in the “gay com­munity”. I tend to think of gay people with very diverse back­grounds. I only act as myself nor­mally, and most of my gay friends do as well. There is a cer­tain amount of expec­ted beha­viour in the com­munity in how you’re sup­posed to act if your gay, but the real­ity is I like guys and that’s about the end of how being gay effects my per­son­al­ity. People who know me, I hope, see me as a nice guy and I hope they see all of me just not that I am gay.

I also am not the typ­ical gay per­son in terms of looks/appearance. I have no dress sense; I don’t wear tight fit­ting clothes. I don’t have the nor­mal physique; I am a bit on the chubby side.

I have found being gay in the work­place has been tough at times. I remem­ber my first job at MYOB, they just had a set of redund­an­cies. A group of fel­low employ­ees gathered around near my work­sta­tion and said “Oh my god we got rid of one of those”, and they were all talk­ing how relieved they were to have a gay employee let go dur­ing the redund­an­cies. No men­tion that he was a fel­low col­league and had just lost his job, it was all about just one aspect of his life and that was it. This event affected me but not in a good way.

I joined the gam­ing industry because I wanted some­thing with chal­lenge and cre­ativ­ity. I decided when I was work­ing for MYOB and later Élite work­ing on tax soft­ware that gam­ing was what I wanted to do. I ended up spend­ing a for­tune buy­ing games book after games book on Amazon, this was before they were easy to get hold of. As a high school dro­pout my maths skills were shock­ing, and I knew from all the research I had done that I needed to improve. I spent 2.5 years learn­ing the maths required, much of which I would of learnt dur­ing high school.

I then got my final big break into the games industry. Ratbag was an amaz­ing exper­i­ence for me. I have many fond memor­ies from my time there, includ­ing my first pub-crawl, through the streets of Adelaide. The job came at a good time, almost a week after break­ing up with my first boy­friend I got the call to come for the inter­view. It was just the thing to boost my spir­its. Unfor­tu­nately Rat­bag only las­ted for a few months before things didn’t go well. I got told I wasn’t going to pass my pro­ba­tion, and was given a gen­er­ous pay­out and I headed back to Melbourne.

IR Gurus/Transmission was my next stop. It took around 6 months to find this job. As a junior in the games industry it’s hard to land on your feet again, and I spent many an hour going to inter­views. Hav­ing Rat­bag on the resume did help to a degree. At IR Gurus I was told I was going to be on a 3-month con­tract. I basic­ally spent about a week doing the job they hired me to-do, then I was given other duties pretty much straight away and quickly became full time. I spent a year at IR Gurus work­ing on their sports titles.

I ended up for­cing myself into the role of graph­ics pro­gram­mer. So I ended up rewrit­ing a lot of the graphic engine for the play­ers, and I think I ended up improv­ing how things worked. In terms of my gay life it was quite hard to IR Gurus, the guys in the sports team I felt were pretty homo­phobic, mak­ing homo­phobic jokes all over the place. IR Gurus had two very dif­fer­ent cul­tures because when I joined two com­pan­ies com­bined together into one, there was “That Game” who worked on Her­oes over the Pacific and IR Gurus who worked on the sports title. The “That Game” team were cool; I had issues with the IR Gurus team. I was never happy at IR Gurus due to other factors as well, such as bad work­ing con­di­tions. They were con­tinu­ally “ask­ing” us to work week­ends, pub­lic hol­i­days, and they were late with our monthly pays con­tinu­ously. I ended up hav­ing one of the worst work­ing morale’s in my work­ing life there. I almost got out of games. I ended up quit­ting and was con­tem­plat­ing going over­seas to work. I put my resumes around to dif­fer­ent com­pan­ies. I ended up quit­ting without another job to go to out of frustration.

Krome rang me about a week after quit­ting IR Gurus and asked me to-do a phone Inter­view, and later that month I accep­ted a offer to work in Bris­bane. Now Krome was a inter­est­ing place to work for. I made tech for some very excit­ing games while I was at Krome, Viva Piñata Party Anim­als, Scene It: Box Office Smash and about half a dozen other titles. I was ori­gin­ally employed in the engine team only as a tem­por­ary pos­i­tion until a pos­i­tion on a game team opened up, but the guys were suf­fi­ciently impressed with my work so I was work­ing on their tools inside the engine team. The engine team in Bris­bane had a great vibe, inter­est­ingly enough they made gay jokes all the time but I was never fazed because it was always in good spirit. One of the fel­low employ­ees made a com­ment one day “If there was any gay guys on the team, I always won­der what they think”, and to be hon­est I never had any issues. The only issue I had was isol­ated to one employee who hated gay people with such dis­taste it was fright­en­ing in a way. Things were improving.

When Krome bought out Mel­bourne House I took the first oppor­tun­ity to head back to Mel­bourne. Mel­bourne House was a great place to work. The engine team in Mel­bourne were some of the most exper­i­enced guys I’ve ever worked for, and I was learn­ing things con­tinu­ously.  I had a very sim­ilar per­son­al­ity I felt to one of the other engine pro­gram­mers, who had worked for Mel­bourne House the longest, so we had a great work­ing rela­tion­ship. There were also other gay employ­ees in the office, they weren’t “open” in terms they tell every­one about their part­ners or some­thing, but went with the policy if you asked they wouldn’t deny anything.

One thing that I always found annoy­ing though is the fact that if people asked if I was gay I would always deny it. It would be very unpleas­ant feel­ing and I would instantly turn off. I had this hap­pen a lot at Krome. I did tell one girl on my team I was gay, but that took a great deal of effort. She was great because she had a circle of friends who were gay. Also the employee who had been around Mel­bourne House for some time had a great atti­tude towards gay people. Gen­er­ally the atmo­sphere around Mel­bourne House inspired me in a lot of ways.  I guess I was hav­ing issues with my lead, I respec­ted him a lot, but we had very dif­fer­ent ways of work­ing on things. He was very much dot all the i’s type, and make sure everything came in on time. I was very much the type that would under­es­tim­ate the effort on things, which never fit­ted in well :) . In some ways I regret leav­ing Krome, when I left it was for a pos­i­tion with more money and it was the first time I wasn’t leav­ing because I was unhappy.

Infin­ite Inter­act­ive was the next place. I really loved their games, part of the reason why I jumped ship. Infin­ite was very much extremes in terms of the work­ing envir­on­ment. There were things that were extremely good, and things that were extremely bad. There was no middle ground in terms of the exper­i­ence there. The greats were the open doors to Steve office, I chat­ted to him for hours. I chat­ted to him about gay guys and he had some great stor­ies about that. While he worked at Stra­tegic Strategies Group, he said that boss there hated gay guys and prom­ised never to hire any, but dur­ing one Christ­mas party about 4 employ­ees all came out of the closet. Steve said he’s never had any issues with work­ing with gay guys, used to-do Dan­cing as a hobby so had many gay friends. He would get upset if any­one had issues with gay people in his com­pany. At Infin­ite there were 2 other gay employ­ees that I know of, one was very openly gay and would talk about his part­ner (and they were prac­tic­ally mar­ried), the other was a bit more intro­ver­ted any­way but never hid any­thing from any­one. I dis­covered I had good pro­ject man­age­ment skills when I was there, I organ­ised soft­ware pur­chas­ing, fix­ing of equip­ment, and fix­ing up the equip­ment. This was the extreme down­side; I had such trouble with the IT equip­ment that was bought second hand it just ended up dom­in­at­ing all my time. It spilt over into all the other ele­ments of my career, and I had angry people when my tools were late. I also felt like I was extremely unpro­duct­ive while work­ing there. I felt frus­trated at myself while work­ing there, I was in a rela­tion­ship of sorts with a guy from New Zea­l­and, and I phys­ic­ally could not tell any­one. One guy even asked me “Are you talk­ing about a girl or guy?” and I couldn’t say, I just had a phys­ical issue say­ing it out loud. In such a great envir­on­ment for homo­sexual employ­ees I should of been able to say some­thing.  The issues with the IT equip­ment, me work­ing long hours, and I had star­ted to go to Uni at that stage part time, meant I was get­ting angry, get­ting poorer and poorer in my health and some­thing had to give. I was really enjoy­ing Uni at this stage, more so than my work­ing career, so I ended up quitting.

Hmm so then I ended up being a full time uni stu­dent. I have to admit I haven’t lost the buzz of enjoy­ing learn­ing yet. Part of the reason for doing Uni (well one reason amongst many) was to meet guys. I am very phys­ic­ally attrac­ted to reg­u­lar Uni going guys, and my ex from NZ was also doing CompSci. I have been doing uni now for a year and a half.

I have done a whole heap of games units at Mon­ash. I have to admit it was a little tough. I was act­ing the intro­vert dur­ing the semester, when in fact I love being social (and introverted/extroverted I’m weird like that). I was just told by a few work col­leagues at Infin­ite to lay low don’t let any­one know.

I’ve also star­ted my own com­pany doing some iPhone games. We applied for fund­ing back in March but got declined and now I really want to focus in get­ting some tech done over the next few weeks. We couldn’t pro­gress with the game until we knew what was hap­pen­ing with the fund­ing, which was frus­trat­ing since the fund­ing can only develop new stuff, not stuff already developed.

I went to the Mon­ash Games Boot Camp; iron­ic­ally I prob­ably wouldn’t have issues with com­ing out to most people there. I found out a friend was gay there, and I found out another acquaint­ance was “bi”.

I guess if someone is read­ing this and maybe decid­ing to become a games pro­gram­mer and is gay, take com­fort, things are get­ting bet­ter. I would say that the games industry des­pite my earlier prob­lems things have got­ten a lot bet­ter, it is a cre­at­ive industry so people are going to be from all sorts of back­grounds. If you’re in high school, Uni is a lot dif­fer­ent; you’re going to have some level of accept­ance in Uni. I per­son­ally dropped out of high school and part of that were the con­flict­ing feel­ings of being gay. Don’t feel the need to be any­one but your­self, and real­ise that people have issues with being gay all the way in their 20s and I’m soon to see in their 30s I’m sure.

Also don’t let being Gay define who you are. I am start­ing to learn that emo­tion­ally it has to be a part of you but don’t let being Gay determ­ine your actions. Your attrac­ted to guys (or girls) and there are many ele­ments that make up the rest of you. I believe the path to true integ­ra­tion into soci­ety is for people who are homo­phobic just to real­ise that gay guys and girls are just like them, they play games, they pro­gram, they go home to part­ners, they are short, they are tall, and they are chubby (like me), and some dress well, some don’t, some hit the gym every day, some don’t. I real­ised when I went through the stage of get­ting gay friends “hey these guys are just guys, with their good points and bad”.

I guess that’s why I have a fun­da­mental issue with gay cul­tural stuff. I see gay bars as being a import­ant thing, in terms you can go there and hit on someone and you know they aren’t going to get weirded out, but gay magazines and stuff are strange. You can find gay gam­ing magazines now, if I want to find out if a game is good enough, what does being gay have to-do with it? i.e. Halo 3 is going to suck if a straight or gay guy reviews the game.

*edit* I don’t want to be known as the gay games pro­gram­mer, I don’t think its rel­ev­ant most of the time. I don’t want to shout from the hill­tops I’m gay or any­thing. The three things I con­sider import­ant in a employer is,

1. Can I take my part­ner along to the christ­mas part­ner
2. Can I tell other col­leagues about  sig­ni­fic­ant life events such as buy­ing a house with a part­ner.
3. Ideally I don’t want a ton of gay jokes. It just makes it more com­fort­able without it.

Any­way, I hope someone finds this useful.

Posted in Games | 17 Comments

Monash Computer Games Boot Camp

Today I did a speech (or attemp­ted to) for Com­puter Games Boot Camp.

It was my first pub­lic speak­ing appear­ance ever.

I had pre­pared before hand a full speech. I wrote out the first 15 minutes of dia­log which I inten­ded to deliver. I rehearsed this in front of some friends of mine, who said over­all the deliv­ery was good. They men­tioned that a few things I did wrong such as men­tion­ing “So” too many times and a few things like that.

I then decided to make it all into bul­let point form. Got it onto paper before hand.

I had some fancy slides put all together with a mont­age of images about each job.

Then day of speech. Was feel­ing a bit intim­id­ated, but not overly. Was get­ting the com­puter prepared.

I was going to talk to them about how I had come from noth­ing, basic­ally just pro­gram­ming in my spare hours, and just had a pas­sion for games to get into the industry. I also wanted to give them a real­istic expect­a­tion other than what the other presenters were giv­ing them, that the games industry is overly harsh at times but at the same time there was hope for get­ting a job and the games industry is a great industry to work for. I wanted to por­tray to them how in recent years I’ve enjoyed it for its diversity, work­ing with a lot of people of vari­ous minor­it­ies nation­al­it­ies, sexu­al­it­ies were accep­ted quite eas­ily in my last few pos­i­tions, and that as one of those minor­it­ies it felt quite lib­er­at­ing. I then wanted to talk about how they can get into the industry, talk­ing about my exper­i­ences in com­puter sci­ence and how it’d trans­late well into their work­ing careers and give them breath­ing room if the games industry is going through a bad patch.

Well that was the inten­tion any­way. I got in front of the lectern and star­ted talk­ing. I lost com­plete momentum, the inform­a­tion I had inten­ded to por­tray to the audi­ence just wasn’t mak­ing it out there, and it seemed I going through what in prac­tice had taken 30 minutes in 5 minutes. I star­ted to panic a little and real­ised I was loos­ing the audi­ence. I made some stu­pid ana­logy to the “IT Crowd” and “Big Bang The­ory” but I kept mis­pron­cing “Big-Bang The­ory” and I real­ised it too in my head.

Then I quickly asked for ques­tions some­how and this is where I star­ted to get impressed. One kid towards the front of the audi­ence just kept ask­ing amaz­ing ques­tion after amaz­ing ques­tion. He asked about MUD cul­ture and how hav­ing worked on MUDs trans­lated into the games industry. I said pro­gram­ming on MUDs still gave me great skills to use in any games, about things being data driven and hav­ing big dynamic worlds. He obvi­ously had given things great deal of thought.

Then another guy asked “You do real­ise its the big bang the­ory don’t you?” and I replied mis­takenly “You do real­ise I’m not very good at this?” and he replied “We know”. I wasn’t shocked as such, but I asked for the game I wanted to have a demo of be played. So I then star­ted answer­ing more ques­tions, and the other kid kept ask­ing great ques­tions. It ended up being too much for with the crowd enjoy­ing the game.

I stood around for a few minutes just watch­ing in amuse­ment the game. Then I wasn’t sure what I should do and I headed back to the AV con­trol booth. Stephan Schutze was in the booth and ended up giv­ing me quite a few point­ers on how to improve things. He men­tioned it just takes exper­i­ence with pub­lic speak­ing exper­i­ence and I just needed more exper­i­ence. He also said you need to get into the mode of “talk­ing to a mate” rather than speak­ing to a crowd. Pre­tend your just talk­ing to a mate out in the audi­ence about your material.

Andrew Owen came over won­der­ing where I had gone. He seemed a bit con­fused and must of only real­ised then I was being a bit self con­cious hanging out in the AV con­trol booth. He men­tioned “do you want to answer some more ques­tions?”, to which I replied “Can you come along­side?” an we both went out and he basic­ally ran the show while I answered ques­tions. It went much smoother then, and the smart kid in the audi­ence kept ask­ing questions.

After­wards I did my nor­mal, “Wander around, try not to talk to the same per­son too much so I don’t annoy them” type thing. I felt in a way being back in high school at this event, being a speaker I wasn’t a volun­teer, not a teen­ager who could play the games, so felt a bit out of it. And many of the presenters were media types who tend to go after their next big story so not really there to have exten­ded chats.

I have to say though for a mar­ket­ing type Andrew Owen seems pretty genu­ine, sure he’s a busy guy but he seems pretty genu­ine and he is pas­sion­ate about his event. I also had a great chat later with Dale the pro­du­cer for Level 3, who is also a extremely genu­ine guy. Cape Dude who is one of the celebrity kids from the pre­vi­ous years also was extremely pleased about his uni marks, get­ting higher than expec­ted marks.

Couple things stood out for me for the event. First the smart kid came over to say “Hi” and apo­li­gised for the reac­tion of the kids earlier. He said he wanted to be a designer but real­ised it wasn’t a entry level pos­i­tion. I was happy he came over. Secondly the kid who made the remarks in the audi­ence came over and said “I was just being a idiot and after you star­ted the game demo it improved quite a bit”. Later he con­trib­uted some great com­ments with other stu­dents about what you should do to get into the industry and he looked to me later as if “You do know your stuff after all”.

The other big high­light was a kid went to Andrew Owen to thank him. I put in a few com­ments as Andrew was talk­ing to him, but then he ran up after the con­ver­sa­tion fin­ished and said “Did you present first off? Thanks for the talk it was pretty good for your first time”. The ges­ture was much appreciated.

I am going to speak in pub­lic again. I kinda have that grime determ­in­a­tion to get good at it now :)

Posted in Games | 7 Comments

Artificial Neural Networks

A single neuron takes a num­ber of inputs, each with their own weight. A activ­a­tion func­tion determ­ines if a neuron is going to be fired or as referred to in the icon above Static non lin­ear char­ac­ter­istic. There can be a num­ber of dif­fer­ent ones. This activ­a­tion func­tion will take as input the sum of the input weights against a bias. It will then determ­ine if the value is in the cor­rect range for a neuron to fire.

There are three com­mon activ­a­tion functions:

  • A step func­tion can be used to emit only one of two val­ues if a threshold has been reached.
  • A logistic func­tion is sim­ilar how­ever it will inter­pol­ate a smooth range of values.
  • A Gaus­sian func­tion allows a gradual ramp­ing up and down around a cent­ral input.

The set of neur­ons get con­nec­ted into a neural net­work. There are some rules when con­nect­ing a neural net­work to make them use­ful is as follows:

  • Have an input layer. The input layer takes inputs from the envir­on­ment that you are try­ing to test. Inputs for example for a robot in a maze may be the loc­a­tion in the maze.
  • Have an hid­den layer.
  • Have an out­put layer. These take data from the hid­den layer and then send out­puts to its limbs to change the envir­o­ment. For example the speed at which to turn the wheels, or the dir­ec­tion to turn.

The rules is that each of the input nodes is con­nec­ted to the nodes in the hid­den layer. Then each of the hid­den layer nodes is con­nec­ted to the out­put nodes. The idea is that when you get inputs com­ing in that the out­puts are sens­ible val­ues based on the situ­ation. That relies how­ever on the hid­den lay­ing hav­ing valid biases/weights etc. This is unlikely to occur when you first setup the net­work. These type of net­works are called feed for­ward and fully con­nec­ted net­work. It turns out you don’t need to leave out con­nec­tions because each neuron has a weight and if it turns out a neuron is com­pletely undesir­able a weight of 0 can be applied.

What you need to do is train the net­work. You take a ton of sample data. You attempt to eval­u­ate the data against a end res­ult. For example a robot suc­cess­fully nav­ig­a­tion a maze. Based on the suc­cess meas­ure we adjust the val­ues of the neuron’s weight and biases.

Out­side of games neural net­works have been used quite extens­ively. They are extremely good at recog­nising pat­terns. For example pick­ing up human hand­writ­ing when sort­ing envel­opes in a post office. Whenever you got a com­plex pat­tern you want to detect then neural net­works can be quite good.

In a game though for example, we could have a neural net­work that would steer a ship in the world so it could probe and land on a planet. We could provide inputs such as the ships head­ing and the plan­ets dir­ec­tion. The out­puts would be the dir­ec­tion we should take with the ship. We could test the neural net­work based on if we were head­ing in the cor­rect dir­ec­tion towards the planet.

Another example for a game could be for a sword fight­ing game. An NPC could get from the human player the human player sword pos­i­tion, human player shield pos­i­tion, human player crouch pos­i­tion, human player move­ment dir­ec­tion. The NPC responses can then determ­ine the height of the shield, and the way in which the NPC swings the sword.

In games how­ever, Neural net­works aren’t com­mon. One of the major issues is the amount of time it takes to train the net­work, when a finite state machine can achieve sim­ilar res­ults with much less time involve­ment. Some games how­ever have used neural net­work data but they would of already provided the pre-trained data and then switch­ing off the learn­ing beha­viour and then using a fixed con­trol­ler. The second approach is still to pre­train the game but leave the AI learn­ing turned on which will adapt to the player. The dis­ad­vant­age of this approach is from the QA point of view where the AI may become unpredictable.

One advant­age of a neural net­work for games is you can have emo­tions come into play inside the neural net­work. For example the NPC gets scared and will run away if its gets hit badly, or gets angry if only mildly hit. Inputs can be also NPC state of other NPC’s to cre­ate group behaviour.

Posted in AI | Leave a comment

Neural Networks

Neural net­works is a top down approach to Arti­fi­cial Intel­li­gence. Top down mean­ing we think about how humans would achieve result.

In the brain there is no neuron that stores the inform­a­tion that our grand­mother is 80 for example. This is not how our brains work. There was a big debate in com­puter sci­ence should it be a sym­bolic approach or should it be the way our brain works where our brain changes into dif­fer­ent states based on what we know and don’t know. So every­one has dif­fer­ent con­nec­tions between neuron, dif­fer­ent num­ber of neur­ons and dif­fer­ent strengths. Should we build­ing a sys­tem that is sym­bolic or non-symbolic. A neural net­work is non-symbolic and there are no states as there would be in some­thing like a finite state machine. There are no vari­ables to describ­ing know­ing a par­tic­u­lar bit of knowledge.

We have in our brains about 100 bil­lion neur­ons. Each neuron has inputs to the cell body, these inputs are called Den­rites and they con­duct weak elec­trical sig­nals. The beha­viour of the cell as the inputs come into it, the cell mon­it­ors if the sig­nals com­ing in are meet­ing some strength threshold or not and if they do then one sig­nal through a axon will send out an out­put. These are con­nec­ted to one another in a com­plic­ated net­work and they are con­nec­ted in a syn­pase and from here they enter the den­rites of the next cell.

As well as going to receiv­ing inputs and out­puts from other neur­ons, some of them have spe­cial inputs and out­puts. The inputs con­nect up to our sens­ory organs and they said sig­nals about whats hap­pen­ing in our envir­on­ment (for example, optic nerve etc). The out­puts would be for con­trolling muscles etc which allows us to move for example.

The thing about human brains is they aren’t fixed at birth, you don’t get given one fixed brain where you know everything. As you take in input from around the envir­on­ment your brain chem­istry changes. The paths that get fired often are rein­forced and become more likely in the future to fire. Espe­cially if the same input con­di­tions are met. Some­times you are less likely to use some path­ways and these are less likely to be fired in the future. This can be a phys­ical thing, for example con­tinu­ously hit­ting a ten­nis ball, if you prac­tice hit­ting a ten­nis ball your brain chem­istry actu­ally changes and the path­ways for hit­ting the ten­nis ball get rein­force and are more likely to fire in the future.

Dif­fer­ent sec­tions of the brain are respons­ible for con­trolling dif­fer­ent parts of the body and are respons­ible for pro­cessing the dif­fer­ent inputs from the dif­fer­ent sens­ory inputs from the body. There are some­times times when a neuron fires it will slow down or decrease the like­li­hood that other neur­ons will fire and thats its job. It’s a inhib­it­ory neuron and it will pre­vent some­thing from fir­ing. Some­times the reverse is true, if a par­tic­u­lar set of neur­ons fire and that can encour­age oth­ers to fire. For example the neur­ons that are respons­ible for detect­ing heat, if you touch a hot object, the inhib­itor neuron will fire to pre­vent the neur­ons from fir­ing that caused you to touch the hot object. In reverse, those neur­ons may be con­nec­ted to the neur­ons that make your arm move away from the object and cause them fire more frequently.

Brains how­ever are not par­tic­u­larly fast com­pared to mod­ern day CPU’s. In terms of indi­vidual neur­ons, but there 100 bil­lion neur­ons work­ing in par­al­lel, they don’t have to wait for the next one to fire they can all work in uni­son. Most applic­a­tions on a mod­ern com­puter will only run on one thread, and have to wait around for one pro­cess to com­plete before mov­ing to the next one. This allows us todo things eas­ily that com­puters have alot of trouble with.

Artifical neural net­works are not a pure sim­u­la­tion of how the brain works. It’s based off work done by McCul­loch, Pits work in the 1940s and it was roughly based around the under­stand­ing at the time of how the human mind worked. Hebb only 6 years later found a way to make the neural net­work start to learn by chan­ging weights so you didn’t have to hard code the neural net­work cor­rectly in the first place. So ini­tially you can build the net­work with ran­dom val­ues and weights and give it data to allow it to improve at tasks over time. In the 1950s people actu­ally star­ted to attempt to make com­puters that were wired up based on the concept of a neural network.

Next art­icle will be more about actual imple­ment­a­tion of a Neural net­work in terms of com­puter science.

Posted in AI | Leave a comment

Modern AI History.

All mod­ern com­puters are based off a model that Alan Tur­ing cre­ated dur­ing the 1940s. He developed a the­or­et­ical machine that could run any algorithm and called it A uni­ver­sal tur­ing machine.  A uni­ver­sal tur­ing machine is not pos­sible with todays tech­no­logy because it requires a infin­ite amount of stor­age space. It’s import­ant to have a com­mon model for com­put­ing so we can under­stand the lim­it­a­tions of our pos­sible algorithms. Mod­ern PCs are imple­men­ted as a con­crete ver­sion of Tur­ing machines with lim­it­a­tions. So you can in the­ory run the same algorithm on any com­puter that is based on a Tur­ing machine and the meth­ods should func­tion in the­ory. So it shouldn’t mat­ter if its a mod­ern com­puter or a 1980s Macin­tosh, in the­ory they should all be able to run the same algorithms. Some PCs may be quick, some slow, you can in the­ory run the same pro­grams. There are some things how­ever that can’t be com­puted on any Tur­ing machine, if the prob­lem isn’t pos­sible to com­pute on one Tur­ing based machine its not pos­sible on any Tur­ing based machine. This includes the Halt­ing Prob­lem men­tioned in a earlier post. So one of things we want to know, is it pos­sible to use a Tur­ing based machine to com­pute intel­li­gence and is it pos­sible to write an algorithm that will give us rational thought or rational actions. So in the­ory it may be pos­sible to achieve these things but our com­puters are so slow that its just not feas­ible for such a com­plex algorithm.

One of the first ideas for com­ing up with Artifical Intel­li­gence was in 1943, which was a Arti­fi­cial Neural Net­work by Pitts and McCul­loch. It was a the­ory of com­pu­ta­tion back when it was inven­ted, i.e. they didn’t really have the pro­cessing power back then to actu­ally run the neural net­work. It was based off the human bio­logy of neur­ons fir­ing in our brains and based pro­pos­i­tional logic. It’s a attempt to rep­lic­ate how humans think. The idea is that a Neuron has a num­ber of con­nect­ing inputs. The inputs are numer­ical val­ues which can be mod­i­fied. The idea is that you can rein­force val­ues that are achiev­ing the cor­rect res­ult, and pen­al­ise (not allow­ing to fire again) inputs that are achiev­ing sub­op­timal res­ults. A very simple example of a neural net­work is a space invaders game, for the ship to avoid bombs. The out­put of the neuron can be if the ship should move left or right, if the shop is col­lid­ing with many bombs then we pun­ish the neural net­work and adjust the input weights accordingly. Minksy and Edmonds built the first neural net­work com­puter in 1951. The com­puter was actu­ally wired up like a neural network.

Back in 1956 there was a sum­mer research work­shop in Dart­mouth, research­ers such as McCarthy, Min­sky, Shan­non, Rochester, More, Samuel, Solomonoff, Sel­fridge, Newell and Simon atten­ded. These guys shaped the route of AI for the next 20 years and bey­ond and it was the first time that a research field in Arti­fi­cial Intel­li­gence was suggested.

Simon and Newell at the time of the work­shop had soft­ware which was a reas­on­ing pro­gram, Logic The­or­ist, that was cap­able of “think­ing non-numerically”. That is a way of manip­u­lat­ing ideas. Their suc­cess lead to a Hypo­thesis called the “Phys­ical Sys­tem Sym­bol Hypo­thesis”. This Hypo­thesis stated that A phys­ical sym­bol sys­tem has neces­sary and suf­fi­cient means for gen­eral intel­li­gent action. That is if you build a machine, like a com­puter or a series of buck­ets setup in the right way, and you set it up so it can manip­u­late sym­bols, that is enough so you rep­lic­ate gen­eral intel­li­gent action. Manip­u­la­tion of sym­bols is quite a dif­fer­ent way of achiev­ing res­ults to Neural net­works. Neural net­works don’t store sym­bols only numer­ical val­ues. So for example in a space invaders game, there is noth­ing in a neural net­work that would rep­res­ent one of the enemies on the screen or rock­ets on the screen. All a neural net­work has is numbers/weights and neur­ons, neural net­works are a non-symbolic approach to Arti­fi­cial Intel­li­gence. Simon and Newell approach was very dif­fer­ent because there would of been sym­bols for the vari­ous objects in the environment.

In the 50s and 60s research con­tin­ued and they were able to build pro­grams that could prove math­em­at­ical the­or­ems that most under­gradu­ate stu­dents would of found extremely dif­fi­cult. A learn­ing pro­gram was con­struc­ted by Samuel to play draughts which dis­proved the hypo­thesis that com­puters could only do what they were told. It didn’t just play the same game over again, it could actu­ally gain exper­i­ence by play­ing the game. This proved that com­puters can even­tu­ally do more than their ori­ginal pro­gram­ming. One of the early com­ments about com­puters was that they couldn’t ori­gin­ate any new ideas, they couldn’t do any­thing they weren’t told todo. If you imple­ment a learn­ing algorithm how­ever they can gain exper­i­ence and they can act dif­fer­ently over time.

Lisp which is a very pop­u­lar lan­guage for AI which was inven­ted by McCarthy. Its a func­tional lan­guage which is con­sidered one of the core lan­guages used in AI development.

Min­sky super­vised a bunch of stu­dents deal­ing with micro­worlds. To have a robot to nav­ig­ate in the real world is a really big chal­lenge. To con­dense the prob­lem down into micro­world allows com­puter sci­ent­ists to focus on smal­ler prob­lems and build­ing upwards. They were very con­strained, only a few objects in them, only a few type of oper­a­tions avail­able and only a few type of responses that were suf­fi­cient to describe the world. Terry Winograd’s PhD thesis in 1971 focused on hav­ing a robot per­form tasks based on nat­ural lan­guage (how humans would ask a task to be done). For example “Pick up a big read block”, and also being able to use the same nat­ural lan­guage to be able to query about the world, for example “How many blocks are not in the world?”.

Early com­puter sci­ent­ists had dif­fer­ent pre­dic­tions when com­puters will have intelligence?

Alan Tur­ing pre­dicted in 1950 that we’d have intel­li­gent com­puters by the year 2000 cap­able of passing the Tur­ing test..

Her­bert Simon (1959) thought it’d be within 10 years that a com­puter would be able to beat a human chess cham­pion and a sig­ni­fic­ant math­em­at­ical the­orem would be proven by a computer.

Ray Kur­z­weil (2008) said that in 2029 that both hard­ware and soft­ware can achieve human level intel­li­gence with a broad sup­ple­ness of human intel­li­gence includ­ing our emo­tional intelligence.

Posted in AI | Leave a comment

AI History

As I men­tioned in the last post, AI has a lot of found­ing in philosophy.

Aris­totle attemp­ted back around 384–322 BCE to come up with a form­al­ised set of laws for reas­on­ing. If you can make a set of rules based on how todo a argu­ment you can then use those rules to con­struct a machine to argue. Without rules its not pos­sible to con­struct a autonom­ous agent that can act ration­ally, or think like a human. Aris­totle also had a algorithm called regres­sion plan­ning that assisted in mak­ing know­ledge into action. For example, you regresse back­wards based on your goal. “I need cov­er­ing. I need a cloak”. So the first goal is that you need cov­er­ing, there­fore you regresse back­wards in your think­ing to “I need a cloak”.  This tech­nique doesn’t focus on the end res­ult, it focuses on the means of achiev­ing that result.

Around 1232–1315 AC a man named Ramon Lull con­struc­ted a machine based on a earlier Arabic device that could take two ideas and suc­cess­fully cre­ate a new idea. The machine would have dif­fer­ent arabic sym­bols that would rep­res­ents ideas, then based on cer­tain rules it was able to com­bine other sym­bols to con­struct new ideas.

Leonardo da Vinci designed one of the world’s first mech­an­ical cal­cu­lator in around 1452–1519. Shick­ard and Pas­cal both built (rather than just designed) cal­cu­lat­ing machines. that could per­form math­em­at­ical computation.

It wasn’t though until Hobbes in around 1588–1679 linked numer­ical com­pu­ta­tion to reas­on­ing. He pro­posed there was a link between numer­ical com­pu­ta­tion and reas­on­ing. Just as we today we are think­ing we can sim­u­late intel­li­gence on the com­puter now-a-days. Leib­niz took the concept even fur­ther and between 1646–1716 con­struc­ted a simple mech­an­ical concept manip­u­la­tion device. Remem­ber these mech­an­ical devices are with gears and cogs without any electronics.

There were two tra­di­tional views on the brain. Descartes who lived between 1596–1650 was fam­ous for the say­ing “I think there­fore I am”. His idea called Dual­ism was that there were two type of things for our brain, which is that the brain is mat­ter while the mind being non-physical. If you accept this idea you have to come up with some way for a non-physical mind can alter a phys­ical body but there is no clear indic­a­tion that this can occur. The altern­at­ive view is called “Mater­i­al­ism” and that what we think has to be related to some­thing phys­ical such as neur­ons fir­ing etc. Descartes believed that anim­als didn’t have a mind so there­fore were like clock­work machines.

Fran­cis Bacon (1561–1626) and John Locke(1632–1704) were try­ing to work out where know­ledge came from. Their approach was that all know­ledge has to come from the sensors. If you put a child in a black box with no stim­uli then they will have no know­ledge. David Hume (1711–1776) pro­posed through induc­tion that humans can work out a com­mon set of asso­ci­ation with objects. For example a light switch will all work in sim­u­lar ways and there­fore we have a under­stand­ing of how to turn them on and off. If we fol­lowed the approach that only know­ledge comes from the sensors we would have to have explore each light switch to determ­ine how it worked. So for AI agent the concept of induc­tion is crit­ical because we can’t pro­gram ever situ­ation the AI agent will encounter. We have to give it cer­tain com­mon rules about its environment.

Then came the notion  from Mor­itz Schlock (1882–1936) that we can make the­or­ies about our world, and cre­ate our own rules about the envir­on­ment. For example if you exhale viol­ently your likely to be breath­less. Even though you haven’t exper­i­enced this before. You can then use your sensors to con­firm or deny these the­or­ies. So we as humans are build­ing up our own internal rep­res­ent­a­tion of the world or model. So this is very com­mon way to build an AI agent, for example the AI agent can start build­ing a map intern­ally of the room as it moves around the room.

Charles Bag­gage (1791–1871) was the first to con­struct some­thing sim­ilar to a mod­ern CPU. Charles was quite the mad genius for his time. He had him­self lowered into a vol­cano he could observe mini erup­tions in pro­gress. His dif­fer­ence engine was able to cal­cu­late dif­fer­ent math­em­at­ical computations.

Thats it for this post, the next post moves away from Philo­sophy and more towards the elec­tronic com­puter age.

Posted in AI | Leave a comment

AI Introduction

This art­icle is about what Arti­fi­cial Intel­li­gence (AI) is, and some brief his­tory points about it.

To find out what Arti­fi­cial Intel­li­gence is, you need to start out to identi­fy­ing what Intel­li­gence is. Intel­li­gence is the abil­ity to acquire and apply know­ledge and skills. And life is the con­di­tion that dis­tin­guishes anim­als and plants from inor­ganic mat­ter, includ­ing the capa­city for growth, repro­duc­tion, func­tional activ­ity and con­tinual change  pre­ced­ing death.  The defin­i­tion of life how­ever is hard to define.

Nor­mally at the moment we attrib­ute intel­li­gence to liv­ing things. We don’t attrib­ute for example intel­li­gence to rocks or the sky etc, although in ancient his­tory this what they might have done. This is the ori­gin of alot of religions.

There are four dif­fer­ent aims when build­ing a artifical intel­li­gence. These are:

  • Thinks like a human.
  • Acts like a human.
  • Thinks ration­ally.
  • Acts ration­ally.

When com­puters were first intro­duced around about 60 years ago, people were mis­con­ceived into think­ing they were a arti­fi­cial brain. The reason for this is because they could things like cal­cu­late tra­ject­or­ies of shells much quicker than a human being. The real­ity is there is no intel­li­gence behind these actions and the com­puter is just being a fancy calculator.

One approach is to make the com­puter act as a human brain does. Humans con­tain soft bod­ies with cells and chem­ic­als that per­form the intel­li­gence. We can’t achieve exactly this in the com­pu­ter­ised world but we could sim­u­late a human brain and body. The other main approach though is not to worry about how the machine thinks, but get the out­come to be the same as the human. For example, one per­son may use a sheet and paper to work out a proper, while a com­puter algorithm uses com­pu­ta­tional the­ory to solve the prob­lem. The solu­tion is the same in both cases but the way the solu­tion is solved is done in dra­mat­ic­ally dif­fer­ent ways.

So in AI one ques­tion is are we con­cerned so much in how humans think, or are we con­cerned about rep­lic­at­ing the res­ults of the out­come of the human thought pro­cess. Both ways of think­ing about the prob­lem are equally note worthy.

When people star­ted out with AI it was pre­sumed in approx­im­ately 50 years they could get a com­puter to be more intel­li­gent than a com­puter. Gen­er­ally AI is focused around a fam­ous quote “The study of how to make com­puters do things at which, at the moment, people are bet­ter”. So when they star­ted research­ing AI one of the tasks they decided to rep­lic­ate was chess. They choose chess because in humans it requires a great deal of intel­li­gence to play chess. How­ever, they found com­puters can use a approach which requires no intel­li­gence, which is a brute force tech­nique that tries every move pos­sible. The com­puter can make these cal­cu­la­tions much faster than a human. So its not the fact that the com­puter is smarter than the human, its just that the com­puter is smarter at cal­cu­lat­ing the moves. So you can’t expect a human to try all the dif­fer­ent com­bin­a­tions because there are poten­tially bil­lions but com­puters have actu­ally done these type of com­pu­ta­tions. The inter­est­ing thing though is that Chess was determ­ined as the great determ­in­a­tion if a com­puter was intel­li­gent, but after the com­puter star­ted beat­ing humans at chess com­puter sci­ent­ists redesign their mean­ing of AI because it was obvi­ous the com­puter was not intel­li­gent in the human sense since the human is still able to per­form many tasks bet­ter than the computer.

The hard­est things todo in AI are some of the things earlier com­puter sci­ent­ists thought would be easy todo. For example, hav­ing a com­puter fly an air­plane with the skill of a com­mon house­hold fly is impossible. At the moment its thought that cock­roaches have been accur­ately sim­u­lated as a intel­li­gence by the com­puter, but small mam­mals like cats and dogs have not been.

So how do you know if some­thing is act­ing like a human? Turns out its extremely hard to tell. Alan Tur­ing came up with a test for determ­in­ing if a com­puter could act like a human. He came up with the idea of two black boxes, each with a ter­minal on top. One had a human inside the black box respond­ing to quer­ies from a user out­side the boxes, the other with a com­puter inside but the out­side user has no idea which is which. So the idea is the user will type in a ques­tion at both ter­min­als. If the user can’t tell which one is the com­puter and which one is the human than the com­puter has said to have passed the Tur­ing test.

To pass the Tur­ing test there are a num­ber of things a com­puter must be able todo. It must be able to pro­cess nat­ural lan­guage, it has to have some way of rep­res­ent­ing know­ledge so it can respond with a respons­ible answer, it needs to be able to reason about things for example to have a argu­ment with it, and it has to be able to learn over time. For example with the learn­ing if you tell the com­puter your name and then later ask the com­puter your own name then it might be a good sign that it is not a human.

A autonom­ous agent is a agent inside the com­puter that is able to per­ceive itself in some way about its envir­on­ment and it’s able to adapt to changes in its envir­on­ment. A autonom­ous agent is usu­ally able to set goals. For example a agent may have the goal to explore its envir­on­ment, to defend itself etc.

Another import­ant con­sid­er­a­tion in AI, is to ask the ques­tion is it pos­sible to have the com­puter rep­res­ent a intel­li­gence in some way. For example in com­puter sci­ence there are prob­lems which have been proven not to solv­able. For example the halt­ing prob­lem, where you can detect if a pro­gram is going to halt, or keep loop­ing. At one point though they received mil­lion of dol­lars to attempt to solve the prob­lem even though it had been proven it couldn’t be done. You need to make sure there is no proof that a prob­lem is unsolv­able so you don’t go research­ing an entire branch of know­ledge without jus­ti­fic­a­tion. At the moment though there is no known such proof at the moment for AI.

At the end of the day, we are just a chem­ical reac­tion with neur­ons fir­ing. How does that relate to intel­li­gence, this one of the aven­ues where alot of AI research is going into (and med­ical for that mat­ter). How is it the thoughts in our mind allow our body to manip­u­late our environment?

Next post I will talk about the his­tory of AI.

Posted in AI | Leave a comment