January 13th, 2008
After a long time tweaking and puttering with the physics engine I think I have finally gotten close to the kind of settings that are needed for the kind of simulation that I want (dContactApprox is the flag that finally fixed a lot of my problems). I have also introduced projectiles into the mix by adding the “Shell” class. The Shell class is actually just an Actor and is treated the same was as any other tank or other object in the game. It just so happens that tanks create shells and they initially have a great force exerted on them.
I have also put a lot more work into NSObjectInspector (probably to be renamed in the future) so as to be able to support more debugging of the plugins at runtime. I am getting the hankering to spin it off as a general debugging tool for developers because it is just so darn useful.
The idea behind NSObjectInspector is that when you debug a program sometimes you want to just change a value in an object while you are debugging your program at runtime instead of recompiling or writing some sort of user interface to interact with an object’s value. Because the Objective-C runtime affords us a lot of information about what instance variables an object has or what methods it has implementations to, we can provide a general class that can inspect other objects and provide a user interface with which to poke at them with.
Currently it provides interfaces to object instance variables, accessors (method or method pairs in the form of -(void)setMethod:(type)a and -(type)method) and commands (methods in the form of -(void)method). It currently excludes anything in the class NSObject and well known methods that have substantial peripheral effects such as -(id)init, -(void)dealloc and -(void)finalize. Currently supported values are any sort of number type and ids of type NSString. Eventually I plan on creation of class specific exemption lists as well as control hookups.
Posted in Computer Games, Debugging, ODE, Programming, Razor | No Comments »
December 29th, 2007
After doing a lot more research I decided that I don’t really want to implement the physics engine in Razor myself. Thus I have decided to use the Open Dynamics Engine and I am already pleased with the results. It took me about a day to hook it in (had trouble for a while because my tanks were falling through the ground because of some weird collision setting). It might take a bit to figure out how to do movement and projectiles correctly but it might not be long before we actually have little tanks running around doing battle with each other.
And now I give you pile o’ tanks:
Posted in Computer Games, ODE, Programming, Razor | No Comments »
December 20th, 2007
So I have been thinking about what level of physics model I want to implement in Razor. Specifically I have been doing a lot of thinking about collision detection. There are a lot of different ways of doing things with their own strengths and drawbacks. I have initially made the decision of going for more precision and complexity versus speed and ease of computation. I have been spending a lot of time at Wolfram Mathworld trying to remember all the stuff I learned in college.
In preparation for the impending physics tests I have added optional bounding box drawing to all the Actor objects:
I looked around and didn’t immediately see any optimized math libraries that calculate determinants on the mac. If anybody knows of one please let me know. I did find this thread which had some helpful ways of doing it manually.
Posted in Computer Games, Games, Graphics, Programming, Razor | No Comments »
December 18th, 2007
I actually had a very hard time thinking of a name for this project. Nothing really seemed to fit too well or sound that good. But I needed some sort of name for my new project. You have to call it something… I finally settled on “Razor”. What does it mean? Nothing. What does it have to do with the project? Nothing other than now that is what the project will be known by. After not being able to think of a name for a while and itching to just start coding on the darn thing I just picked the name and it has just kind of settled.
Ok, so what is it? On the Google Code page that it is hosted at I wrote:
Razor is a strategy game engine which is oriented around programming the AI of the units rather than direct control by humans. The idea is that human players compete by engineering the intelligence of the units under their control in order to fulfill an objective. The game world is in 3D and will employ some basic physics. Units, AI, physics models and many other aspects are extensible through a plugin system.
Razor is for Mac OS X Leopard only due to leverage of certain Leopard exclusive features such as dynamic loading/unloading of Objective-C, Garbage Collection and more as time goes on.
This is an idea I have had banging around in my head for a long time. Ever since I worked on an AI lab in college where the final semester objective was to program the AI of 5 tanks to play capture the flag against 5 other tanks controlled by one of the AIs of my many classmates. At the end of the semester the class had a tournament in which the prize was an instant ‘A’ in the class and didn’t have to take the final! My lab partner and I won the tournament and even though we both had As in the class at that point, not having to take the final exam was a big time relief at the end of a very busy semester. Perhaps I will make a blog post on our winning strategy later.
Along with that, I have always loved the great strategy involved in RTS games like Starcraft (which in my opinion is the best RTS ever made). I loved thinking of crazy new strategies that would find kinks in established defenses or play with the psychology of the other players. The only thing that prevented me from pulling off my grand designs was the limitations of my own reflexes. Some people just have the twitch and can bounce from scene to scene, keep everything in their heads at once and make lightning fast and precise mouse movements. But if the Korean Starcraft scene is any indicator, these cyber-athletes like gymnasts have a limited lifespan. Once you hit the ripe old age of 22 your reflexes aren’t what they used to be and some pretty young 16 year old is going to take your spot. What I want in some respects is AI programmable Starcraft.
Now the project is only in its infancy and is nowhere near doing anything of significant interest at this point but I decided that I wanted to get the code into an initial functional state that would at least be worthy of initial check-in. Because the project is open source I will be commenting here about the work that I am doing on it, future feature additions and other issues with great openness and frequency unlike my closed projects.
Below is a screenshot of the Simulation Viewer app that you can build and run right now from the source that is posted on the project page. It is not much but it is a start.
Posted in Computer Games, Games, Graphics, Networking, Programming, Psychology, Razor, Security/Cryptography, Video Games | No Comments »
October 23rd, 2007
There are four fairly major changes/additions in this version of Language Aid which make it more compatible and easier to use.
The first of which is the added “Services” menu item. This new feature adds a Language Aid submenu to the Services item in the application menu. From here you can trigger any of your currently enabled plugin modules and have them act on the text you currently have selected in an application. This has the added benefit of being able to grab text from applications that don’t support the Accessibility API (required for Language Aid compatibility before) very well or even at all! This does not mean that Language Aid can act on text in every application but it does get it a lot closer!
The second major addition to version 1.1.1 is the contextual menu item which is very similar to the services menu. If you select a block of text in an application that supports contextual menu items and right click (or control-click for one button mice) a contextual menu with your active plugins are displayed which can act on the selected text block. Now you can have your plugin act on exactly what you select in Safari instead of having it broken up by links and other formatting! Again, this doesn’t work with every application but it significantly broadens Language Aid’s reach.
The third major feature is the inclusion of the MDBG plugin! This is a new plugin that performs Chinese dictionary lookups in a similar manner to the WWWJDIC plugin. This plugin was originally announced in a previous post and has been available through Language Aid’s built in software update but is now included standard with Language Aid. Gradually we hope to expand Language Aid’s reach to more and more languages!
The last reason to upgrade to version 1.1.1 is for Mac OS X Leopard compatibility. There were a few changes in Apple’s new operating system that caused previous versions (<= 1.1) to not behave as expected. These changes have now been accounted for and going forward Language Aid should be fully compatible with both Tiger and Leopard. Perhaps at one point in the future we will start to take advantage of Leopard specific behavior.
Posted in Language Aid, MDBG | No Comments »
October 15th, 2007

At long last we have another plugin for Language Aid! Today a plugin for the Chinese dictionary lookup site MDBG was released for Language Aid version 1.1. This plugin is similar in function to the WWJDIC plugin in that it can take small or large chunks of Chinese text, send them off to the MDBG which provides dictionary lookups for words that it parses out of the text and then display the results. Much thanks goes to the administrator of the MDBG who was very cooperative and helpful in the development of the plugin! You can get the MDBG plugin by clicking on the “Add New Modules” button the Language Aid preference pane and selecting the MDBG plugin. You may need to wait a bit before it shows up in the plugin modules list after installing and restart Language Aid to get it to work correctly. If you know of a web service that can perform translation or dictionary lookups for your favorite language let me know. Also, Language Aid 1.1.1 is just around the corner with some small (but nice) new features.
Posted in Language Aid, MDBG, Programming | No Comments »
August 27th, 2007

Ugh, this bug was so nasty to track down… Apparently if you call this family of methods a couple of times it screws up whether NSBundle can find resources in the future. My specific situation is that I would call this method to find what bundles are in a directory. I would then run it one more time (because that is how the code is laid out). Then when kqueue tells me that something has changed in that directory (because I added a new bundle to the target directory) I call it one more time. It finds the new bundle just fine, but for some reason it completely ignores the stuff in Resources/ when trying to query the contents of said new bundle! I don’t know if this is the result of some errant caching or what but it is consistently reproducible. The old bundles work fine but there is nothing that can make Cocoa see the contents of this new bundle. This is a big problem because it means that [NSBundle loadNibNamed:owner:] now can’t find any nibs in the new bundle (which was what first tipped me off to the problem). In the current Developer Tools Documentation under the entry for [NSBundle pathsForResourcesOfType:inDirectory:] there is a statement:
Note: This method is best suited only for the occasional retrieval of resource files. In most cases where you need to retrieve bundle resources, it is preferable to use the NSBundle instance methods instead.
I hope that is not implying this weird (caching?) behavior. Also, after the damage has been done NSBundle instance methods no longer work either. The solution to this has been to instead use a UNIXy way like scandir() to find out what bundles are in a directory. Not nearly as graceful, but at least I don’t have weird peripheral behavior. So anyway…fair warning to all against using these routines.
Posted in Bugs, Programming | No Comments »
August 18th, 2007

So one idea that I have had knocking around in my head for a while has been a digital quoteboard. I remember how in college I would go over to somebody’s apartment and there would be this quoteboard full of funny one-liners which if taken of context or more often, taken in the context of who said them, were hilarious. Of course they are usually only funny if you knew the people that said them. I thought about how there are a lot of online communities of tight knit people who could have a little bit of fun with a digital equivalent and so I whipped up this little example. I will probably refine it here and there over time and will probably release the source soon (it is not that much code). Other things I have thought of were live javascript based editing and Wordpress permissions hook ins. It currently works by having a php page render a csv quote database into a jpg so you can have static links to the results, ensuring that it will work in every browser (the above image is the actual linked image and thus may change as the database changes). So far what I have found is that there is a great disparity in exact results or even basic functionality in using the same Truetype font on different operating systems and different versions of the graphics libraries that PHP hooks into. Also, it appears that some fonts do not fully define things like punctuation and formating such as tabs. Feel free to leave a quote by going here. Although I may decide to remove general access to it in the future 
Posted in General, Graphics, Programming, Web | 4 Comments »
August 4th, 2007
A while ago one of the editors at マックピープル (Mac People) magazine asked if they could feature Language Aid in their section on shareware/freeware. I happily accepted and greatly appreciated the free advertising. A while later they asked if they could include Language Aid on a DVD-ROM that they publish containing freeware/shareware called オンラインウェアDVD (Onlineware DVD). The DVD arrived in the mail yesterday (picture is at the right). I have not worked directly on Language Aid for a while but I do have a couple more plugin modules in mind that I want to implement and the next set of new features are all laid out. I have been working a project peripherally connected to Language Aid which has taken a lot of my time lately, but this has come to a good stopping point so that I can return to working on Language Aid more.
Posted in Language Aid | No Comments »
July 28th, 2007
I had an interesting thought the other day as I set up my iPhone. When setting up my security lockout number I realized that I didn’t actually know what my bank’s pin number was. This is because my bank pin number is a derivative of another number that I know and my hands just do the right thing as it constructs the derivative of my memorized number. I thought about how this might be useful if someone was ever interrogating me through drugs or sleepiness because I honestly don’t know the answer off the top of my head. I would have to sit there and work through the numbers one by one to construct what the pin actually is. It reminds me of the “Gnilleps” card in Cranium where you have to spell a word backwards. It is fairly difficult for me to do because that is contrary to how my brain visualizes and catalogs the word, but if given enough time I can slowly crank it out.
Posted in Board Games, Psychology, Security/Cryptography, iPhone | 1 Comment »