Sunday, January 22, 2006

Artificial Intelligence for Computer Games Book Review

This week I read "Artificial Intelligence for Computer Games" by John David Funge. The first thing I noticed when I got it up was how thin it was. It reminded me of the small reference O'reilly books. Props for having a hardcover though. I think that it is really called "Artificial Intelligence for Computer Game An Introduction", but you would only know that by seeing it on the first page as that isn't on the cover, side or back. Reading through the preface I found that he hopes his book will inspire new academic research for AI in computer games and that he is working for a startup that is developing AI technology. This first I doubt will happen and the second clearly showed me where the next hundred pages was headed.

Before getting into the book I have to mention the code. You get your first glimpse of code on page seventeen where a class header is shown. The class name is tgGameState. Any guess what "tg" stands for? Neither do I. He tries to save on space by having functions with partial words like "inline getNumCharacters()", but the follows it with a pointless comment // Get the number of characters. In appendix B (Programming) it says that code is written to be as easy to understand as possible and is therefore not that efficient. If he had wanted to go for readability he would have expanded the function names, removed the pointless comment, and ditched all the inlines and not of even mentioned the constructor, deconstructor (which aren't defined in the book anyway) etc. Poor variable names, missing error checking, it would have been much better to use sudo code. I noticed a few bugs even. Overall this was the worst part of the book and I wouldn't want someone in the "entertainment industry" reading this if I was trying to sell them my code.

Onto the actual book. My mention of the reference O'reilly books wasn't just to point out the size. This book really does feel like a jumping off point for AI in computer games. topics are briefly mentioned, but never really gone into depth and to make it sound complicated greek symbols are used when showing a formula. I would have appreciated five or six footnotes per pages telling where to get more information, but most of the time there wasn't. The first two chapters where more of a crash course in game design. So by the time I was on chapter three and on page 33 you can tell that was nervous that i was 1/3 through the book and really hadn't gotten into any sort of real AI stuff. but it picks up from there. There are a lot of hints for how to integrate AI into games. For example a Non-player controller (NPC) could have an arrow drawn on its chest (where it thinks the player is) and other visuals indicating its internal state. Of course these are more likely just basic game tips and nothing to do with AI. One neat idea was that your NPC could have several decision making units that could be swapped out. When really close to the player the most CPU intensive one would be used and when far away in the locked room the "stand still" one could be used. Perception, Mood, Remembering, Searching, some basic physics were all touched upon. In chapter 7 it gets very close to mentioning/talking about genetic algorithms, but alas it was not to be. The last part of the book was very boring and I found myself putting down the book a lot before finally finishing it.

Overall I feet like I was cheated because of the poor cover title. The cover really should have had "an introduction" on it. I expected it to be bigger with more in-depth explanations that didn't leave me hanging, and not such sub-par code for a coding book. On the plus side I found out the name of the orc on the cover is named "Fluffy".

I have previously listed some books I highly recommend and am interested in hearing what you recommend is good.

Friday, January 20, 2006

66 million rows in QTreeView

Inspired by the recent work with gtktreeview I decided to see how far I could push the item view framework. Modifing the interview demo from 1000 rows by 100 columns I was able to get around sixty million rows by twenty million columns. Once I would go past that (somewhere around ~75 rows and ~25 columns) I started hitting some int overflows, but even with showing that model in the tree view, list view and table view took about 1 second (including showing the icon, text etc) for the application to run. Not bad I must say.

Sunday, January 15, 2006

Job Trends

On reddit there was a link comparing job postings for lisp, python and ruby.

So of course I had to put in for kde and gnome. There were both near zero and gnome even did have 0 at one point. Either way they are both so small that the difference is inconsequential. But when you put in some different keyboards you will find out some more interesting things.


  • There are about as many jobs for khtml as gtk+

  • Companies don't seem to hire gtk programmers, but mono (now the future of gnome with it in fc4?)

  • The mono and gtk graphs seem a little in sync again suggesting that if you program in gtk you should know mono too.

  • There is about twice as many people hiring with qt experience as mono

  • At least right now ajax really does pay to learn

  • Companies want more "developers" then "programmers"

  • More companies are looking for qt experience than coco (even apple had a job posting looking for Qt experience)




Oh course this is just a graph off some web page so take it with a grain of salt.


On monster.com you can subscribe to keywords and they will e-mail you when a new job is posted with that keyword. It was fun watching as the Qt job postings grew from one every few months to sometimes more then once in a day ( at which point I unsubscribed). It was very easy to see what kind of companies were hiring qt developers. I bet you there is someone out there who is exploiting similar information on the stock market for tools companies. Knowing what a company is hiring often shows where a company is and where it is going.
"

Friday, January 13, 2006

Emotional Design Book Review

I read "Emotional Design" by Donald A. Norman this evening. After reading his other book "The Design Of Everyday things a few months ago I had high hopes for this book, but after reading it I felt like it was just a collection of notes put together. The main idea took up the first half of the book teaching you something that could just as well have been in a well written 12 page essay. The gist of it is that emotional design is broken down into three things:

  • Visceral - Appearance - Look at that, it is shiny and so smooth!

  • Behavioral - The pleasure and effectiveness of use - My ipod is a pleasure to use because it just *works*<.li>
  • Reflective - Self image, personal satisfaction, memories - I remember the first time I saw someone else wearing white headphones too, the ipod is fun to show off to people who hadn't seen it.


Now those three things mean very different things to different people. A good example is given in the first chapter:

Go outside. Get some air.
Watch a sunset.
Boy, does that get old fast.
-XBox advertisement

This is a very well designed add, but really only for guys 18-35. Everyone else will get different results for the three sections.

Take Qt (at least for me)
  • Visceral - Eye Candy, Nice themes, Easy to read GUI code

  • Behavioral - I enjoy using it to create my applications, the design is consistent and works with me

  • Reflective - Learning Qt was a breeze due to the well written documentation, I really enjoyed showing off what I was able to do and accomplish in a short amount of time.

You learned all this in the first chapter and the rest of the first half of the book fleshed it out. For example you can have something that is annoying to use and doesn't look that great, but has a really high Reflective level (such as an expensive car you can show off) that makes it worth while to have.

The second half of the book seems to jump from topic to topic vaguely related. There are two sections all about robots and giving them emotions, incorporating them into our lives etc, but this just seemed like filler and didn't contain anything new that isn't covered in many other books. The author spends some time dissecting movies, video games, and many other thing too.

I was expecting much more a continuation of "The Design Of Everyday things" (which is very good) and so I was very disappointed. Overall an interesting book to barrow from the library or pick up used off Amazon.

Sunday, January 01, 2006

Fireworks in Norway

Went to a new years party this evening and at twenty of twelve we left the apartment and headed a few blocks away to the local park which has hill and a very nice view. As we were walking there it was mesmerizing to watch as more and more people were appearing from every direction heading to the park creating a large stream of people up the hill. All day long I have heard fireworks going off and even from our window we watched a father and his kids set off some large fireworks in the parks across the street earlier in the evening. While we walked down to the party we heard (but couldn't see most) a firework or two every minute. When we turned the corner and could see the park we could also see many fireworks also going off all over the hill. We walked up the hill and onto the first flat area. There were people everywhere and in the middle there was an unofficial area where people were walking up and launching their fireworks from. A number of other similar spots could be seen elsewhere in the park. The fireworks being set off were not little fireworks, but every size, many very large (that wouldn't be at all legal in the US). Now I have seen big fireworks (mostly at forth of july in Boston from the river bank), but not fifty feet above me. Because there was no government run show (let alone a synchronized radio firework show) for about a hour people where continuously setting off fireworks everywhere you looked. And up on the hill you could see the same thing was happening all across the town at other parks. Look left right, behind you, in front of you everywhere another massive firework was going off. Occasionally the fireworks would explode on the ground or just a few feet off the ground spitting out into the crowds. I realized that I probably had a better chance of getting hurt then anytime in my recent past. Words really can not describe the shear chaos, noise and marvel. So of course next year I will definitely be going out again.

Popular Posts