Today’s article is going to focus on a very effective form of video game AI that I’ve been looking into recently.
Rule-Based Systems, or RBS’ are extremely flexible techniques, capable of performing low-level control as well as decision making. Once the rulebase is in place, adding new behaviors is relatively easy as rules are modular.
Using a set of assertions, which collectively form the ‘working memory’, and a set of rules that specify how to act on the assertion set, a rule-based system can be created. Rule-based systems are fairly simplistic, consisting of little more than a set of if-then statements, but provide the basis for so-called “expert systems” which are widely used in many fields. The concept of an expert system is this: the knowledge of an expert is encoded into the rule set. When exposed to the same data, the expert system AI will perform in a similar manner to the expert.
Rule-based systems are a relatively simple model that can be adapted to any number of problems. As with any AI, a rule-based system has its strengths as well as limitations that must be considered before deciding if it’s the right technique to use for a given problem. Overall, rule-based systems are really only feasible for problems for which any and all knowledge in the problem area can be written in the form of if-then rules and for which this problem area is not large. If there are too many rules, the system can become difficult to maintain and can suffer a performance hit.
To create a rule-based system for a given problem, you must have (or create) the following:
1. A set of facts to represent the initial working memory. This should be anything relevant to the beginning state of the system. 2. A set of rules. This should encompass any and all actions that should be taken within the scope of a problem, but nothing irrelevant. The number of rules in the system can affect its performance, so you don’t want any that aren’t needed. 3. A condition that determines that a solution has been found or that none exists. This is necessary to terminate some rule-based systems that find themselves in infinite loops otherwise.
The rule-based system itself uses a simple technique: It starts with a rule-base, which contains all of the appropriate knowledge encoded into If-Then rules, and a working memory, which may or may not initially contain any data, assertions or initially known information. The system examines all the rule conditions (IF) and determines a subset, the conflict set, of the rules whose conditions are satisfied based on the working memory. Of this conflict set, one of those rules is triggered (fired). Which one is chosen is based on a conflict resolution strategy. When the rule is fired, any actions specified in its THEN clause are carried out. These actions can modify the working memory, the rule-base itself, or do just about anything else the system programmer decides to include. This loop of firing rules and performing actions continues until one of two conditions are met: there are no more rules whose conditions are satisfied or a rule is fired whose action specifies the program should terminate.
Which rule is chosen to fire is a function of the conflict resolution strategy. Which strategy is chosen can be determined by the problem or it may be a matter of preference. In any case, it is vital as it controls which of the applicable rules are fired and thus how the entire system behaves. There are several different strategies, but here are a few of the most common:
Forward-Chaining
Rule-based systems, as defined above, are adaptable to a variety of problems. In some problems, information is provided with the rules and the AI follows them to see where they lead. An example of this is a medical diagnosis in which the problem is to diagnose the underlying disease based on a set of symptoms (the working memory). A problem of this nature is solved using a forward-chaining, data-driven, system that compares data in the working memory against the conditions (IF parts) of the rules and determines which rules to fire.
Backward-Chaining
In other problems, a goal is specified and the AI must find a way to achieve that specified goal. For example, if there is an epidemic of a certain disease, this AI could presume a given individual had the disease and attempt to determine if its diagnosis is correct based on available information. A backward-chaining, goal-driven, system accomplishes this. To do this, the system looks for the action in the THEN clause of the rules that matches the specified goal. In other words, it looks for the rules that can produce this goal. If a rule is found and fired, it takes each of that rule’s conditions as goals and continues until either the available data satisfies all of the goals or there are no more rules that match.
Of the two methods available, forward- or backward-chaining, the one to use is determined by the problem itself. A comparison of conditions to actions in the rule base can help determine which chaining method is preferred. If the ‘average’ rule has more conditions than conclusions, that is the typical hypothesis or goal (the conclusions) can lead to many more questions (the conditions), forward-chaining is favored. If the opposite holds true and the average rule has more conclusions than conditions such that each fact may fan out into a large number of new facts or actions, backward-chaining is ideal.
If neither is dominant, the number of facts in the working memory may help the decision. If all (relevant) facts are already known, and the purpose of the system is to find where that information leads, forward-chaining should be selected. If, on the other hand, few or no facts are known and the goal is to find if one of many possible conclusions is true, use backward-chaining.
Having been a user of Blackbox for several years and many versions, I was a bit skeptical about Fluxbox’s ability to extend a window manager that in my opinion, was already great.
It should be pointed out that the instructions at the Fluxbox site for making Fluxbox your default window manager only apply if you are starting X from the console. If you have Mandrake configured for a graphical login, there aren’t any other steps necessary beyond installing the rpm. This worked very well on my test system. I only had to logout and log back in selecting Fluxbox as my window manager. Instructions for users that run “startx” from the console are included at the Fluxbox Web site and, are reasonably well written.
The differences in Fluxbox, and its ancestor, Blackbox are not immediately apparent. Visually, you may first notice the window tabs, something absent altogether from Blackbox. Window tabs are hardly the only difference, as Fluxbox provides support for KDE and Windowmaker dock applications. This is a little strange, coming from years of Blackbox use, because the lack of docked application support has always been one of its defining features. I do believe that Blackbox’s stability, speed and simplicity are still retained in Fluxbox and, if you’re not inclined to run docked applications, you’ll never notice a difference. If you have ever looked at Blackbox and said, “That’s nice but, I wish I could run that,” your wait is over. Support for docked applications is well done, and works just as you would expect.
Fluxbox also adds a native key grabber to the base functionality it inherits from Blackbox. The key grabber gives the ability to not only handle keyboard shortcuts for common window manager commands, but it also allows sophisticated multi-key sequences to be assigned in a manner similar to Emacs. For users who were running a separate program to manage keyboard shortcuts, this provides an integrated solution. Fluxbox’s Web site also provides a conversion utility for current users of Bbkeys.
Finally, on the list of enhanced features, are the changes made to Blackbox’s signature taskbar. All of your iconified windows are displayed on the taskbar, with a single click returning them to their previous state. This is a little more efficient than finding them through the middle mouse button menu but, you might find it cumbersome if you tend to have many windows iconified at once.
What hasn’t changed: Fear not, all of your Blackbox themes are still 100% compatible. If you are a current Blackbox user, the change to Fluxbox is almost invisible. You will, obviously, have to add your collected Blackbox themes to your new Fluxbox configuration and then select the theme you wish to use. This also gives Fluxbox the benefit of a well defined base of community provided themes, even though it’s a relatively new project, with version 0.1.6 the current release.
Overall, Fluxbox makes a very nice set of enhancements to the “no-nonsense” style of Blackbox. I have been a faithful Blackbox user over the years and, what it has lacked in flash and features has always been well worth the trade-offs in speed and stability. I found Fluxbox to be just as stable and fast, and the features it adds are definitely worth checking out.
I happily recommend Fluxbox to current Blackbox users and to users of other window managers who would like a more nimble environment, without giving up some of the creature comforts available in heavier window managers.
You can download FluxBox Here: Download
Apple’s implementation of keywords feels somewhat kludgy at best, and it’s a bit confusing, especially at first. You have to open a special keywords panel, and also show the keywords in the main library. From there, when you want to categorize an image, you select the image(s), then find the keyword to assign in the keyword panel. Once you’ve found the keyword, you have to then click the Assign button to add it to the selected photo(s). This works fine, if not somewhat clumsily, if you have two or three keywords. But if you have a reasonable number of images, then you’re probably going to have 20 or 30 keywords, which greatly complicates the task of finding the one you’re after. And it doesn’t help that the keyword panel isn’t even sorted!
This is where Keyword Assistant (KA from here on) comes into the picture (so to speak). KA installs an additional menu in iPhoto, as seen at left. In addition to some handy utilities, such as Alphabetize Keywords Panel Now, the real power is the Show Assistant Panel, which opens a new one-line input window. With this window open, assigning keywords becomes significantly easier: Select the images you wish to modify, and then type the keyword into the Assistant box. When you hit Enter, the keyword is assigned. Want to assign multiple keywords at once? Just separate them with a comma before you hit Enter. What makes this really powerful, though, is that KA knows all your keywords, and auto-completes your entries as soon as you’ve typed enough letters to uniquely identify them. In my case, I have only one “K” keyword (Kylie, of course), so I can categorize her images with one keystroke.
If you type a new keyword, you’ll be asked if you really want to create a new keyword (you can disable this warning in the KA menu), and then presto, you not only have a new keyword, but it’s been assigned to the images you selected.
The only missing from KA is that there’s not an easy way to remove just one keyword from an image — if you have a picture with three keywords, and one is incorrect, you’ll either need to use Apple’s keyword panel to remove the incorrect keyword, or use KA and remove all three then start over. It’d be nice if something like an Option-Click on the Assign button turned it into Remove instead. But this is a minor nitpick; KA is such a perfect addition to iPhoto, you’ll wonder why Apple didn’t build it in in the first place.
When I got a digital camera, I found that the integration between the camera and iPhoto wasn’t quite as tight as it was between my iPod and iTunes. iTunes automatically syncs and unmounts my iPod, whereas I have to click the “Import” button in iPhoto, and confirm that I want to delete the original images on the camera. Additionally, the camera isn’t automatically ejected, so when it powers off after a couple minutes of inactivity, the Finder gives the standard error about a disk being impropertly ejected. Here’s a script that imports, deletes, and ejects without any user intervention required.
To work, this script requires Panther with Folder Actions and GUI Scripting enabled. To turn on, click “Enable access for assistive devices” in the Universal Access preference pane. Place the script in Library > Scripts > Folder Action Scripts and enable it as a Folder action for /Volumes (you can get to /Volumes by using “Go to Folder” from the Finder’s Go menu). This script takes some hints from Apple’s GUI Scripting example page, and Apple’s Folder Action Scripting example page.
One caution: if you automatically delete images from your camera before verifying they imported correctly, you’re taking a bit of a risk. If there was an import problem, then your images are gone forever. For that reason, I use a manual import, and never tell iPhoto to delete the images when done.
Ever want to access the administrator account from the welcome window without having to boot to safe mode. When at the screen press CTRL-ALT-DEL twice. This will bring up the login screen were you can type a user name and password in.
Ever wanted you Windows shell to look more like Mac OSX? Changing the icon size would be a good touch. Mac OSX has a max size of 128×128 icons. (Windows Max: 72×72).
1. Open Registry Editor. 2. Click on HKEY_CURRENT_USER 3. Then expand Control Panel. 4. Then expand Desktop. 5. Then expand Windows Metrics 6. Select the Shell Icon Size key. 7. Right click Shell Icon Size and select Modify. 8. Then type 128 in the box, and there you go.
This is a slight ammendment as the original didnt work for me. Open up your favorite plain text editor (notepad, for example) and copy the following text into a new file:
REGEDIT4
[HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\ShellFolder]
“Attributes”=hex:50,01,00,20 “CallForAttributes”=dword:00000000
Now save this text file as a .reg file, such as “Rename Recycle Bin.reg” and put it wherever you like. Double click on the file, and when it asks you if you want to import it into the registry, choose Yes. You’ll notice a new option in the right-click menu to Rename the Recycle Bin. You can also rename it by highlighing the Bin and hitting F2, or by highlighting it and clicking on the file name (just like renaming any other file). If you want to turn off this new feature, make another .reg file with the same content as above, but change the first number in the “Attributes”=hex: line from 50 to 40 and import that file into the registry.
Do you sit and wait while Explorer seems to take it’s time showing the owner of each file/directory that is displayed? If so, then you might find the following useful:
1. Open Explorer and select “Details” under the “View” menu 2. Right click on any of the column headers (such as “Name”, “Size”, or “Owner”) 3. Uncheck “Owner” or any other you don’t need.
You should see immediate improvements as you navigate around.
To make this permanent for all folders,
4. Select “Folder Options” from the “Tools” menu 5. Select the “View” tab 6. Click the “Apply to All Folders” button
Now, you will not see “Owner” in any folder. If you want to re-display it, simply follow the instructions above and re-check “Owner” in step 3.
1. Right-click a shortcut on the desktop or in the start menu, and then click Properties . 2. On the Shortcut tab, click in the Shortcut Key box. 3. Press the key you want to use. Windows will add Ctrl+Alt to it. So if you choose U the combination will be Ctrl+Alt+U. You can also choose one of the function keys you don’t use otherwise, (ex. F7) 4. Click OK .
Well that’s going to do it, as soon as I get some free time the articles here at migraineheartache. will be a little longer. But for now, they’ll have to remain at a managable length. Alright peace out-
-b
Hello again and welcome to migraineheartache’s Weekend Update. Where you’ll find all the important news stories from this past week in tech. Well lets get on with it:
MobiTV has been billed as the first provider to offer/broadcast real-time video to cell phones. The service, offered by Sprint, costs an additional $9.99 monthly. They are now adding new channels, and support various handsets. Some of them typical broadcast channels are included like Fox Sports and MSNBC, others are even designed for the mobile environment, such as NBC Mobile. What’s it like to watch TV on a cell phone? Personally I’d love it. I really like the idea that I can pull my cell phone out of my pocket and catch up with the latest news and sports scores in an instant. Read the article over at MSN.
As reported on Cnet and others, an open source java iTunes client named ourTunes has been released under the GPL by a group of anonymous “hackers”. Unlike the Apple iTunes for Windows and Mac, ourTunes allows a user to queue up and download the music shared by other users on a given network. Recent court rulings have held that developers of p2p file sharing software cannot be held liable for ‘for any copyright infringement committed by people using their products.’ Therefore, I applaud the work of these programmers and I was even checking out their code and I must say, you get some mad props from me. Oh yeah and “Power To The People, Fight The Man, Blah, Blah, Blah….”
Osviews reported this week that Microsoft’s free email service, Hotmail, is throwing down to Google by increasing the free storage to 2GB. When will Bill and the gang learn that you just can’t beat Google, their just to darn cool for you.
Software, Hardware, and Everything giant Apple put out a recall this week on a certain group of PowerBook G4 batteries. If you have a PowerBook G4 (Aluminum) 15″ and your battery’s model number is A1045, and its serial number starts HQ404, HQ405, HQ406, HQ407, or HQ408, then you could be at risk of it overheating. Go to the link above if you’re affected. Oh and don’t worry I’m sure Mr. Jobs will make sure you get a new battery that looks even prettier than your old one. And maybe, just maybe (if you’re good) he’ll put a scroll wheel on it…
It is official. Google debuted its IPO thsi week at $85 per share. To quote the article, ‘At that price, the low end of its recently revised range, Google raised $1.67 billion, with $1.2 billion to go to the No. 1 Internet search engine and $473 million to Google executives and investors selling their shares.’ Trading began Thursday, August and you can check the current price of their shares by going here. If I only had some money to invest I’d throw it in right now. Personally, I can’t wait to see what good things Google will come up in the next few years.
Online protests targeting GOP websites could turn out to be more than symbolic during this month’s Republican National Convention, possibly blocking a critical communications tool for the party… “We want to bombard (the Republican sites) with so much traffic that nobody can get in,” said CrimethInc, a member of the so-called Black Hat Hackers Bloc. It’s one of several groups planning to distribute software tools to reload Republican sites over and over again. Thus causing Mr. Bush to ask “What happened to the my .GIF’s of the dancing Jesus and the monkey with the cymbals?”
Well that will do it for this week in tech. For Weekend Update, I’m signing off, Good Day, and Have A Pleseant Tmro.
Well in the ongoing to push to keep my content fresh and new and because I get bored easily I’m changing yet another day’s theme here at migraineheartache. Friday, will now be (And I hesitate to call it this, but…) Dark Tips. Now I’ve honestly stolen that term straight from my good friend Kev Rose from G4TechTv’s TSS. But nonetheless, I’m using it, there’s honestly no other way I can think of to describe these tips. Well, off we go:
Today’s Dark Tip is going to be on BitTorrent. For those of you who have already been indulged into the world of BitTorrent, good for you, go grab get yourself a cookie and feel free to skip this article. Anyways here’s a quick and (hopefully) simple explanation of what BitTorrent is (Pics courtesy of the fine official BitTorrent Site, and a big thanks to the author of BitTorrent - Bram Cohen):
As you can see in the second situation the file(s) is/are downloaded from everyone. Not just a single server, greatly lightening the load and in the long run increasing download speed.
(If at anytime you see a word or term that you don’t understand refer to the bottom of this article in the section labeled “BitTorrent Glossary”)
BitTorrent is a protocol for transferring files. It is peer-to-peer in nature, as users connect to each other directly to send and receive portions of the file. However, there is a central server (known as a ‘tracker’) which coordinates the action of all downloaders (called ‘peers’). The tracker only manages the connections, it does not have any knowledge of the contents of the files being distributed, and therefore a large number of users can be supported with relatively limited tracker bandwidth ( I run one occasionally on my home pc). The philosophy of BitTorrent is that users should upload (transmit out) at the same time they are downloading. This way, network bandwidth is utilized as efficiently as possible. BitTorrent is designed so that as the number of people getting a certain file increases, the overall speed available will increase. (And trust me it works like a charm.)
Visualize a group of people sitting at a table. Each person at the table can both talk and listen to any other person at the table. These people are each trying to get a complete copy of a book. Person A announces that he has pages 1-10, 23, 42-50, and 75. Persons C, D, and E are each missing some of those pages that A has, and so they coordinate such that A gives them each copies of the pages he has that they are missing. Person B then announces that she has pages 11-22, 31-37, and 63-70. Persons A, D, and E tell B they would like some of her pages, so she gives them copies of the pages that she has. The process continues around the table until everyone has announced what they have (and hence what they are missing.) The people at the table coordinate to swap parts of this book until everyone has everything. There is also another person at the table, who we’ll call ‘S’. This person has a complete copy of the book, and so that person doesn’t need anything sent to him. He responds with pages that no one else in the group has. At first, when everyone has just arrived, they all must talk to him to get their first set of pages. However, the people are smart enough to not all get the same pages from him. After a short while they all have most of the book amongst themselves, even if no one person has the whole thing. In this manner, this one person can share a book that he has with many other people, without having to give a full copy to everyone that’s interested. He can instead give out different parts to different people, and they will be able to share it amongst themselves. This person who we’ve referred to as ‘S’ is referred to as a ‘Seed.’
If you’ve read this far, your’re probably wondering what’s so Dark about this Dark Tip. Well BitTorrent has been adopted by MANY people as an alternative to P2P clients such as Kazaa. Sites like SuprNova.org have even spawned applications to allow users to quickly grab pretty much ANY .torrent file they wish. Basically, if there’s some sort of media or content out there that you wish to have. With BitTorrent, you can- Its just that simple. And unlike Kazaa and many other P2P services, there are no “fake” or “corrupt” files. Everything is kosher and (usually) presented in the best quality available.
The way it works is that the user (You) goto a site or some other source and download a small metadata file with the extension ‘.torrent’ You then use a BitTorrent client to open that file and begin downloading it. The client will connect to the tracker and get the list of seeds/peers. It will then begin asking them what pieces of the file(s) they all have and then compare that to the pieces you have. If they have a piece that you don’t then your client will begin downloading it from them.
There are ALOT of BitTorrent clients out there for you to choose from. If you don’t want to listen to me, just go google for “bittorrent client” and watch the results pour in. I will tell you right now that I’ve used many and hands down my favorite and the one that is most respected in the “scene” is called Azureus and you can get it here.
Now here’s a quick glossary of some terms that you’ll likely hear thrown around when discussing BitTorrent (Courtesy of Brian’s BitTorrent Guide & FAQ) (You’re welcome Tyler).
torrent Usually this refers to the small metadata file you receive from the web server (the one that ends in .torrent.) Metadata here means that the file contains information about the data you want to download, not the data itself. This is what is sent to your computer when you click on a download link on a website. You can also save the torrent file to your local system, and then click on it to open the BitTorrent download. This is useful if you want to be able to re-open the torrent later on without having to find the link again. In some uses, it can also refer to everything associated with a certain file available with BitTorrent. For example, someone might say “I downloaded that torrent” or “that server has a lot of good torrents”, meaning there are lots of good files available via BitTorrent on that server.
peer A peer is another computer on the Internet that you connect to and transfer data. Generally a peer does not have the complete file, otherwise it would be called a seed. Some people also refer to peers as leeches, to distinguish them from those generous folks who have completed their download and continue to leave the client running and act as a seed.
seed A computer that has a complete copy of a certain torrent. Once your client finishes downloading, it will remain open until you click the Finish button (or otherwise close it.) This is known as being a seed or seeding. You can also start a BT client with a complete file, and once BT has checked the file it will connect and seed the file to others. Generally, it’s considered good manners to continue seeding a file after you have finished downloading, to help out others. Also, when a new torrent is posted to a tracker, someone must seed it in order for it to be available to others. Remember, the tracker doesn’t know anything of the actual contents of a file, so it’s important to follow through and seed a file if you upload the torrent to a tracker.
reseed When there are zero seeds for a given torrent (and not enough peers to have a distributed copy), then eventually all the peers will get stuck with an incomplete file, since no one in the swarm has the missing pieces. When this happens, someone with a complete file (a seed) must connect to the swarm so that those missing pieces can be transferred. This is called reseeding. Usually a request for a reseed comes with an implicit promise that the requester will leave his or her client open for some time period after finishing (to add longevity to the torrent) in return for the kind soul reseeding the file.
swarm The group of machines that are collectively connected for a particular file. For example, if you start a BitTorrent client and it tells you that you’re connected to 10 peers and 3 seeds, then the swarm consists of you and those 13 other people.
tracker A server on the Internet that acts to coordinate the action of BitTorrent clients. When you open a torrent, your machine contacts the tracker and asks for a list of peers to contact. Periodically throughout the transfer, your machine will check in with the tracker, telling it how much you’ve downloaded and uploaded, how much you have left before finishing, and the state you’re in (starting, finished download, stopping.) If a tracker is down and you try to open a torrent, you will be unable to connect. If a tracker goes down during a torrent (i.e., you have already connected at some point and are already talking to peers), you will be able to continue transferring with those peers, but no new peers will be able to contact you. Often tracker errors are temporary, so the best thing to do is just wait and leave the client open to continue trying.
downloading Receiving data FROM another computer.
uploading Sending data TO another computer.
share rating Most clients will show you this stat. This is simply the ratio of your amount uploaded divided by your amount downloaded. The amounts used are for the current session only, not over the history of the file. If you achieve a share ratio of 1.0, that would mean you’ve uploaded as much as you’ve downloaded. The higher the number, the more you have contributed. If you see a share ratio of “oo”, this means infinity, which will happen if you open a BT client with a complete file (i.e., you seed the file.) In this case you download nothing since you have the full file, and so anything you send will cause the ratio to reach infinity. Note: The share rating is just a number that is displayed for your convenience. It does not directly affect any aspect of the client at all. In general, out of courtesy to others you should strive to keep this ratio as high as possible, of course.
distributed copies In some clients, you will see the text “Connected to X seeds; also seeing X.XXX distributed copies.” A seed is a machine with the complete file. However, the swarm can collectively have a complete copy (or copies) of the file, and that is what this is telling you. Referring again to the “people at a table” analogy, consider the case where the book has 10 pages, and person A has pp.1-5 and B has pp.6-10. Collectively, A and B have a complete copy of the book, even though no one person has the whole thing. In other words, even if there are no seeds, as long as there is at least one distributed copy of the file everyone can eventually get a complete file. Meditate on this, the Zen of BitTorrent, grasshopper.
choked This is a term used in the description of the BitTorrent protocol. It refers to the state of an uploader, i.e. the thread that sends data to another peer. When a connection is choked, it means that the transmitter doesn’t currently want to send anything on that link. A BT client signals that it’s choked to other clients for a number of reasons, but the most common is that by default a client will only maintain –max_uploads active simultaneous uploads, the rest will be marked choked. (The default value is 4 and this is the same setting that experimental client GUI lets you adjust.) A connection can also be choked for other reasons, for example a peer downloading from a seed will mark his connection as choked since the seed is not interested in receiving anything. Note that since each connection is bidirectional and symmetrical, there are two choked flags for each connection, one for each Tx endpoint.
interested Another term used in the protocol specification. This is the corollary to the choked flag, in that interested refers to the state of a downloader with respect to a connection. A downloader is marked as interested if the other end of the link has any pieces that the client wants, otherwise the connection is marked as not interested.
snubbed If your client has not received anything after a certain period of time, it will likely mark a connection as snubbed, in that the peer on the other end has chosen not to send in a while. See the definition of choked for reasons why an uploader might mark a connection as choked. The real function of keeping track of this variable is to improve download speeds. Occasionally the client will find itself in a state where even though it is connected to many peers, it is choked by all of them. The client uses the snubbed flag in an attempt to prevent this situation. It notes that a peer with whom it would like to trade pieces with has not sent anything in a while, and rather than leaving it up to the optimistic choking to eventuall select that peer, it instead reserves one of its upload slots for sending to that peer.
optimistic unchoking Periodically, the client shakes up the list of uploaders and tries sending on different connections that were previously choked, and choking the connections it was just using. You can observe this action every 10 or 20 seconds or so, by watching the “Advanced” panel of one of the experimental clients.
Well that was a long tip, but I hope you liked it, and again if you have any ideas for future tips please send them my way and I’ll gladly add them to my queue. Thanks for reading and peace out-
Well I was just frequenting one of my many Google Groups and someone posted that Google had just released their (to my knowledge) very first piece of standalone software! The Gmail Notifier which can be found here:
http://toolbar.google.com/gmail-helper/.
It allows the user to keep the program running in their system tray all the time and have a visual AND audio alert activated whenever new mail arrives. Now needless to say this must be in response to the many Gmail Tools/Utilities being developed currently by third party and indepedent developers.
Here’s the creepy part of all this: The page and the software itself aren’t showing up on ANY search engines and Google never links to the page from any other part of their site. Try it and let me know what you think. So far, I’m pretty impressed even I forgot to include that audio alert option, my bad-
Well I’ve decided to switch focus… a little. In the migraineheartache. Weekly Schedules - Thursday is going to now become Programming Articles/Tips day. Today I’m going to start with a quick little one on Game AI:
A method for handling computer intelligence that I’m using is a little simpler to implement than neural-nets: not necessarily better or worse, maybe just “different.”
All units in any type of strategy game have limitted situations that they can be put into (the broader the definition, the smaller the number.) IE: If you have a game with 10 tanks on each side it could be said that there are only 11 possible situations: 1 situation for each number of tanks visible to the player and 1 situation where none is visible. Of course, that is too broad to really _do_ anything with. To be of any real value the situations must take into account strength, ranges and other aspects of the situation.
Since I have a smaller number of units in my game, I make little “situation objects” composed of all the various possible situations. Each situation object also contains the orders to give to the player. The orders are executed if it is determined that this particular “situation object” is the best match for the current state of the player. The higher the number of possibilites, the greater the intellect of the computer controlled player.
To me, this was much simpler than hand-coding a tree because I could make a move construction kit that builds these situations and the resultant decision and saves them into a library. Beta testers can help build them too.
In a SSI wargame it would not be a viable solution. However, in alot of games there are limitted types of units and limited quantities of units in each mission or scenerio.
For example, if there were only 5 units which can have various attributes (larger weapons, higher speeds etc.) then those factors are taken into each database, or “situation object” entry.
Only 30 or so data elements is needed for each unit type to give what appears to be nearly adequate responses. I also curb the results slightly by giving units commands like “move here stealthy” or “move here while attacking whomever you see” to stack the deck in the decision making.
Mind you, this idea of “situation objects” is purely one way to do it that may be practicle in some gaming situations. I’m not a big fan of simulations (like SSI games) and hence wouldn’t do a game like that. Those SSI games couldn’t use my idea, but Dune II could (and it would probably be smarter :))
The idea of finding the nearest “situation object,” isn’t nearly as difficult as you may think.
First off, these objects are based completely on “relative situations” i.e. if a guy is stronger and to the upper-left of the character then that would be one situation. So, thetree goes something like this:
1) How many opponents are visible? ( branch to the decision objects sorted for each answer ) - branch if 1 or more 2) How many can hit me within X moves - branch if safe to not run 3) How many can I hurt? - branch if any 4) SHOULD I try to hit him or run - branch if try to hit 5) Which is most benefical to hit - branch etc…
Now, in some games, each unit is also given priorities that factor into this decision. So, you may tell a unit to scout but give him the order to engage or hide, this of course adds weight to different tree decisions.
The major advantage of a system like this, as I said, is that you can make the AI as good or bad as you like.
Well I hope you enjoyed the first official Programming Article here at migraineheartache. If you have any suggestions for future artciles or tips, please let me know, peace out-
A very nice feature of the Linux kernel is the modules. Modules are pieces of software that can be loaded and unloaded from the kernel at runtime. That way you can save kernel memory (and that’s important for small machines, since kernel memory is never swapped out on disk), and keep your kernel clean when you’re not working with some of your hardware.
Especially sound and network cards are really good to compile as modules, since sometimes they are a bit hard to configure, and when you have a module, you don’t have to recompile and reboot your kernel to configure some irq or io setting.
The tools you use to handle modules are all located in /sbin. They are insmod, modprobe, lsmod, depmod and rmmod.. Notice the names, and compare them to some often used unix commands such as ls and rm and you’ll immediatelly understand what each command will do for you. As always I recommend reading the manual pages. Anyway, here’s what they do:
When you compile your kernel, you choose to make things as modules, instead of into the kernel itself.
The modules will be installed when you do a make modules ; make modules_install after your kernel is compiled. They will reside in a directory called /lib/modules/xx.yy.zz where xx.yy.zz is your kernel version.
When I use OSX I find always finding myself discovering little things that if I’d known them before I could have done things much more efficiently. Here are a few of ‘em:
This is an interesting little iPhoto feature I just found. When making a smart album, ? and * are wildcards. A ? will match “any single character,” so that K??e will match “Kate” and “Kyle.” A * will match “any number of characters,” including none, so K*e will match “Kate” and “Kill me” and “Ke.”
I couldn’t, however, discover how to search for the actual ? and * characters. Backslashes — the usual escape character — don’t seem to work; K?ate is treated the same as Kate, but K\ate will find only “Kate.” Adding an ‘escape’ character (Control-Q, Esc) also failed.
In having frustrations of having to go back and hit the reconnect on Yahoo and MSN Messenger after booting up my Mac at home (iChat works fine) due to the slight delay in logging on to my Airport network, I decided a script was in order. By the time the startup items are complete and you’re ready to use it, all of the IM sessions are logged in, instead of having to click on the reconnect buttons. I also added WeatherPop to this so it won’t try to run and grab your forecast when the network isn’t there yet.
on idle try do shell script “curl www.google.com” tell application “MSN Messenger” activate close the front window end tell tell application “Yahoo! Messenger” activate delay 2 close window “Yahoo! Messenger” end tell tell application “iChat” activate close the front window end tell tell application “WeatherPop” activate end tell quit on error — say “Network Not Available!” end try return 2 end idle
Use the ‘Stay Open’ option when saving this AppleScript, and it will check every two seconds for network availability. Then it launchs the IM’s and WeatherPop. You’ll probably need to modify the script if you’re on a proxy.
I just noticed this behaviour in Firefox. If you hold down the mouse button, after about two seconds the context menu will pop-up. This seems to only work in Firefox. This is a huge help for laptop users who use the built-in trackpad. Now if only the rest of OS X could adopt this behaviour, Apple’s one-button mouse philosophy would work even better.
Having the date and time in the menubar clock is an often-requested hack for OS X — there have been a number of hints about how to do this, as well as a previous Pick of the Week (iClock). Here’s yet one more, this time by Peter Maurer, author of my all-time-fave utility, Butler. Calendarclock is a simple application that places the time and date (or some combo thereof) in the menubar when it’s running.
Calendarclock puts nearly any version of date and time in your menubar that you’d like to see — it uses the syntax from the Unix strftime command to display a format of your choice (with a number of pre-defined options). Do a man strftime in the Terminal and you’ll see the various formatting options available. After some experimenting, I settled on %a %b %e %1I:%M%p, which leads to a date/time display of Mon Aug 2 9:03am (I’m usually alert enough to know the current year).
In addition to the date/time display, Calendarclock will display a full-month calendar when you click on the date/time in the menubar, as seen at left. The pop-up menu at top lets you change the month shown, or you can use the small arrows below the calendar. If you double-click a date in the calendar, iCal opens with that date selected. Below the calendar, the selected day’s iCal entries are shown (they can be hidden by clicking the circular three-line icon). Alternatively, you can use the preferences to display the entire month’s iCal events, but such a list will tend to be quite long. And yes, I do have Kylie’s pick-up time scheduled, mainly so I get a reminder that I need to go pick her up! The circular down-arrow icon lets you donate, open Calendarclock’s preferences, and launch iCal or the Date & Time preferences panel.
There are obviously other tools that do this, including the previously-discussed iClock and wClock, but I prefer Calendarclock. The only reason it lost a point at all is that it cannot be moved from the top-right corner of the menubar, and I’d prefer to have something else in that corner. However, this is a minor quibble, and the flexibility of Calendarclock more than makes up for it.
Well folks, that’s all for now. That last one maybe doesn’t fit, but I’ve been wanting to tell you guys about it for a while. Anways, if you’ve got any tips or suggestion(s) for future Mac Tips, please let me know, peace out-