Wednesday, January 23, 2008

The law of juggling and the U-defense in desktop tower defense

As you have seen from previous videos, juggling is required to get high score, and to survive the 100 levels. This is a study to find successful juggling strategies and to simplify juggling, so easy that nobody hates it anymore.

For various reasons, the line of creeps in your maze will grow longer and longer, making it impossible to block your creeps in the maze by selling and building towers in different places.

To be successful you have to minimize the line of creeps, and to be able to shorten the line.

Minimizing the length of the line of creeps is easy to say:
  1. The creeps on the two entrance should enter you maze at the same time. For the worse timing, you have lines of creeps twice as long.
  2. Creeps should come out at the same time rather than gradually, using the "send next creeps button".
What prevents the creeps from coming out altogether is the flying creeps. If two waves come out at the same time they will easily overwhelm your air defenses. So basically you sent 7 level of creeps together if possible and keep them in by juggling. When the air creeps are about to clear you send another 6 levels together, but time their entrance so that they will join the creeps already in the maze.

To be able to shorten the line of creeps in the maze keep you in an invincible position. For this I came up with the U-defense. But sadly, after I reinvented it, I spot something similar in the videos that was not obvious because of the fast play speed.

The maze shown is a straight forward implementation of a double U-defense. The middle 4x6 towers are about enough to deploy air defense in a mix of swarm, boost and snap towers. The lower right corner shows the two exits of the maze. One of the exist are always blocked. Since you can actually shorten the line of creeps, other strategy isn't that important, unless you reach the point of aiming at the highest score.

The critical tower are the two towers marked "g", which can be seen as a return valve by passing a large U shaped path. When the creeps enter the U, they are slowed down. When they passed the U and then returns because of blocking, if the U valve is open, the later creeps to return will catch up with the earlier creeps, shortening the line of creeps!

The timing principle is simple. When the first creep enters and exits the U, passing the g-tower the 2nd time, this g valve can be open at the exact time but no earlier. If the valve is opened earlier, other creeps will find a short cut and pass the first creep to lengthen the line of creeps. Now when the exit is blocked and the first creep returns, it will return via the g-valve, catching up with other creeps returning not from the g-valve. So the line of creeps is shortened.

The juggling sequence is very simple. One of the exits is blocked. When the first creep passes through the middle of the U, it's time to sell the valve and the blocking tower in the other exit at the same time. It's so simple you can't forget it, and there's no extra difficulty other than simple juggling. When the selling is complete, you block the current exit, so some creeps return via the normal path and some return via the valve. After the last creep returns via the valve, block it. Then rest a little and do the same for the other path. Note that this timing is for the maximum sell time. When selling is fast at the beginning of the game, you can sell the valve-tower and the block-tower later.

Sunday, January 13, 2008

Personal computer regular maintenance

Do PCs, like cars, need oil and filter change? Sure, unless you, like many people, replace whole desktops or laptops every two years. But even if you do, you will have measurable benefits by doing regular maintenance.

The efficiency of air cooling systems using fans and heat sinks degrade with time. Most PCs have mechanisms to slow down the processor when over heating occurs. Typically mobile processors in laptops slow down significantly after long use, especially with the fan grills blocked. Slow down support is built into mobile processors. Desktop processors didn't, not until the latest ones. You also need system board level and operating system level support. So, if you keep the fans and heat sinks at top form, your PC runs fast and runs safe.

One more thing you may need to do is to reapply thermal paste between the CPU and the head sink. The chewing gum like paste that comes with new CPU's last for years. But once you disconnect the CPU from the heat sink, the paste will be very bad to reuse. So if you build your own system, you get only one chance if you want a good thermal contact. They are not supposed to be good anyway. Circuit City has a lot of more fluid like thermal compounds on sale, which claim to be better. But I just discovered that they don't last that long. But replying them is trivial.

Other maintenance include cleaning the monitor and keyboard. They are hardly life threatening, unless you have a wife like mine. I have quality screen cleaning fluid and micro fiber cloth for my expensive monitor. Normally it's quite dusty as I believe cleaning cause degradation. I only clean it when I need to calibrate color for example, or to view some very high quality image, or just it's too dirty to look at. But once I left my monitor alone for a while, my wife cleaned it like windows, not the software kind but the glass kind. I was horrified by the marks left on my dear monitor. I could image how she cleaned windows, spray on some Windex, and rub it hard with a towel, OMG. Luckily, after I wipe the screen repeatedly with my cleaning fluid, there didn't seem to be any harm done.

When do you need to do maintenance work? I had no choice because my system board alarm went off due to over heating. Lesson number one, you must turn on the temperature monitor alarms. In the past, I use the system board software utilities when the board is new, to verify that everything is working and no overheating. After that, I tend to ignore those utilities because they are quite primitive software from hardware manufacturers, a pain to use. But I learned to keep them on when the system boots, it will be useful years later.

My CPU reaches 60 deg C whenever the anti virus software is scanning my disks. The CPU usage is only some 50%. So I know there must be something wrong. Lesson number two, on a brand new PC, record the fan speed and temperatures when your PC is doing something heavy continuously, such as anti virus scanning, and playing videos. So when your fan speed or temperatures are significantly higher at the same conditions, you know it's time. Or, you can just wait for the alarms to go off.

I clean the heat sinks on the system board using a can of compressed gas duster for computers, which you can find in hardware stores nowadays. I also use it for all the fans in the power supply and in the case. Otherwise, it's hard to wipe the fans clean. I also use the duster to blow away dust from the system board components, and the keyboard. These are hardly necessary but feel good.

Don't mix thermal paste, old and new. The thermal paste that comes with retail processors are hard to remove completely. But those semi-fluid thermal paste are easy. You just need rubbing alcohol and they disappear completely. Then you reapply a drop or two of paste. These paste are usually contained in a tiny syringe, sufficient to be applied for a 100 years. But you are supposed to store them upright. I did keep the syringe upright after I was done installing my new system.

By the way, hot laptops cause low sperm counts, or something like that.

Tuesday, January 8, 2008

Second additional mobile line (VoIP)

The most straight forward is the Mobile Line 2 service. As the name says, you get another phone line (and number) on your existing mobile phone without affecting your carrier plans. All of these "virtual" phone services route calls via the Internet (VoIP) to be cost efficient. To use the service you need to download an application to your smart phone, which include many Java enabled phones. The cost is $9.99 per month plus less than $0.03 per minute. The cost is higher but comparable to a 2nd prepaid SIM card at low usage. There's no mention of International calls out of USA.

The better service seems to be TalkPlus. You can use smart phones including the iPhone, or dumb phones with just a browser. The cost is $9.99 per month with plenty of minutes included. International calls cost extra but cheap. You can get an international number too.

You can get a virtual phone number for free or very cheap. Incoming calls are easy. The problem is outgoing calls. There's no problem if your recipients take anonymous calls with blocked caller IDs, or you can call your recipients using any phones and ask them to call you back on your virtual number. For example, Skype out do not have outgoing caller IDs.

Google's GrandCentral is the exception. It's free for the moment but you have outgoing caller ID. The philosophy is to have a universal phone number to replace all your other numbers. But of course you can use this number as a 2nd mobile phone line. The added advantage is that you can use any phones when you have internet access. For mobile phones you just need a browser.

These mobile services all use your carrier's airtime for the duration of the call, and need a data plan for accessing the internet to setup the calls. For prepaid phones, the most expensive can be $0.25 per minute and a few cents per kilobytes. AT &T Cingular prepaid includes data plan, while Virgin phones typically weren't even internet capable. Typically a GrandCentral call uses less than $0.10 (prepaid) for data plus airtime.

Perhaps to limit free usage, you can only call somebody if you add it to the contact list first. This is a small deal but the funny thing is that you cannot add contacts at the mobile version of the site. Otherwise to call your contacts or return incoming calls via your mobile is simple, using one-click on the entry. My mobile phone works fine but one day I couldn't call anymore. I exchanged emails with Google support for a while but they couldn't solve the problem. My phone isn't too new or too smart or too old. It was on the compatible list of TalkPlus.

There is a little known service, or little thought of service that compliments any of the above services. You can call from any phone as if you are calling from your virtual number. You can setup calls using the internet, or via a toll free number. It's TalkPlus when you don't have or don't want to use your mobile phone. You can choose any phone number that you want your recipient to return your calls. It's GrandCentral when you can dial any number directly even with your cell phone.

It's the caller ID spoofing service such as Spooftel. It had been available for a couple of years now. You can just select your caller ID to your virtual number or any number you want. They don't have a mobile website so you may have to use the toll free access if you don't have a computer and internet. But you can always call somebody with a computer to connect the call for you. The cost is $0.10 per minute. Together with free GrandCentral, the combination is cheaper than the cheapest prepaid card. It's really pay as you go because the minutes do not expire.

The catch is, the bill to outlaw caller ID spoofing is at it's final stages, with the latest action last December. The bill is sort of agreed by all parties for a year now. Maybe there are as little as a few more months to go, or maybe a year. Maybe the cutoff date will be set further ahead to give some time for people to get ready.

ps I agree that carriers are trying to block the new VoIP services. When the mobile GrandCentral launched, it worked flawlessly. Then a couple of months ago I could access the mobile site but couldn't call. Now I can't even access the mobile site.

GC support didn't know what's the problem, and I haven't see any conspiracy theory yet. But I see good reason to block these services. When GC forward calls to your mobile, you can have the caller ID set to your GC number. If you add this number to your fav numbers, you have unlimited incoming calls for everybody calling your GC number.

Single cell phone multiple numbers (SIM method)

Two lines (two numbers) on one mobile phone is a popular demand. All non-ancient GSM phones support multiple lines, but it seems that no carrier in the world bother to support it. This is true a couple of years ago to last two years, not very true now, but the biggest and most popular carriers don't bother. Now still no US carrier bothers. Now the phones are so smart that you can do a lot of things to by pass the carriers, forcing some carriers to compete. The smaller carriers might just as well provide some fringe benefits to increase head count.

For GSM and 3G(UMTS) you can play around with the SIM cards. For other carriers, you can call via some calling card like services, or Internet services.

You can buy a super SIM card, together with a card reader and writer. You copy all your carrier SIM cards over to your own super SIM card. I heard that 3G SIM's are not possible to copy due to encryption. The original SIMs have to be compatible to your super SIM and to your phone, which makes this the most problematic method, though the most elegant.

The most common method is to get a dual-SIM adapter. I think Magicsim is the most common brand on eBay and I had one, long before they have a brand name and a website online. SIM's have some sort of standards, including V1, V2 and 3G. There are also different memory sizes, 32K, 64K to 128K (3G). Make sure that your phone is on the adapter compatible list. I don' t know if it's possible that some carrier SIM's can cause further compatibility problems. But I don't think it will be if your phone is a 3G or late GSM model.

There are two types of dual-SIM adapters. The simpler type looks like three SIM cards connected together. There are two holders for your carrier SIM cards. You insert the third card into the SIM compartment of your phone. This type requires that your battery compartment isn't too tight to contain the extra thickness of the SIM cards. You are OK if your phone is on the compatibility list. I would recommend this though I had the other type.

The second dual-SIM adapter requires you to cut out the central bit of your SIM cards, and put them into a SIM card that holds your two little cut out pieces. The adapter in the form of a SIM card is slightly thicker than an ordinary SIM card, so it might not fit if your SIM compartment is super thin. Or the contact may be loose so they provide you with sponge fillers for a tight fit.

The cut out type adapters sound dangerous and difficult. It's yes or no. SIM cards don't cost much if you know where to find, and if you have a plan your carrier may replace it for you. Unless you make very stupid cuts, even if the adapter doesn't work, they provide two holders for you to hold your cards for use as if they are not cut. I advise to get a SIM cutter, which I didn't. I just used a scissor. I intended to cut a little larger than the template, then gradually reduce the size to fit the adapter. But I ended up simply chopped off the excess with one simple cut per straight edge.

The two cut out SIM cards should look exactly like two miniature SIM cards, but not mine. After a little trimming they can go inside the adapter. But with some loose space one of the miniature card can move a little inside. It didn't work at first, or it didn't work reliably. But once I swapped the two miniature cards, they fit better and never gave me problems. Maybe after a year the SIM's are lose again. So I pull out and plug in the cards again and added the sponge filler to hold the cards tighter. It works fine now.

I brought a 64K SIM served by AT&T (previously Cingular). It was another eBay order without phone and plan. It was for the GoPhone, prepaid or with a monthly plan. It might be possible that the carrier may not activate some cards, they way they are sold or according to their serial numbers. My SIMs are OK but probably because I wanted to port my old phone number to the prepaid phone(!), I went through several operators. Virgin had better service and better deal, but they are not GSM, reselling Sprint airtime.

I had a carrier unlocked GSM phone for traveling. I don't think you need an unlock phone when you are using two SIMs from the same carrier. If you ask, a nice carrier may unlock the phone for you after 6 months. But most phones are trivial to unlock yourself. For Moto you only need to download some software to the PC and a standard mini USB cable. I don't know about the latest 3G phones but you always search unlock hacks specific for your phone. If you travel abroad those Blade Runner (the movie) type shops will unlock it for you free if you buy anything trivial.

Adapters cost little but you pay for those guys who buy it in bulk and resell on eBay. Same for SIM cards. US carriers don't sell SIM cards directly without anything to go with it. But somehow you can get it on eBay. Abroad, SIM cards with airtime are cheaper than refilling the airtime itself.

At any one time, only one SIM and one number is active. In the older adapters, you switch off the phone and then back on to switch SIM cards, hence your number. In the newer ones, you dial 001 and then hangup to use SIM card number one, and so on. With better compatibility, you can pick SIM1 or SIM2 on your phone menu. You can also rotate the cards at fixed intervals, x minutes for the 1st and y minutes for the 2nd. This way, you can receive all your voicemail and other alerts without having to manually switch the SIM cards. But I don't feel comfortable doing this. My adapter doesn't work in this mode anyway.

Normally you set your phone to forward on unavailable to the other number, so you will not miss any calls. But there are minor problems. You don't know if the call is forwarded or not. You just have the caller ID. So if you do not know the person, you don't know which number the caller called. And be very careful if your numbers aren't public. Your line 1 calls will be forwarded to line 2, and voice mail will be left on your line 2 account. The system default message is to announce your line 2 phone number, thought the caller called your line 1 number. The same problem occurs again if line 1 is supposed to be for John and line 2 for Peter. On the voice mail greetings you have to swap the greetings for John and Peter. But when you sometimes turned off the call forward for some reasons, you have to swap the greetings. So carrying two phones isn't a bad idea.

The cheapest way to keep an extra number this way is prepaid, roughly $100 a year or $25 for 3 months from various carriers, if you call very little. It's difficult to compare exactly because most have some refill bonus. Most carrier will allow you to go offline a few months while keeping your number. It's much cheaper if your usage patterns allow for that. AT&T (Cingular) has 3G, T-mobile still haven't make the announcement. And of course AT&T has the iPhone. With the constant cat and mouse unlock the iPhone game, no way AT&T is going to unlock your iPhone for your travels.

By the way, there are phones holding two SIM cards. But I bet they aren't too good as the demand is perhaps 1 in 1,000 or 100,000. And then there's a version of Blackberry from Verzion, which provides CDMA2000 technology, but also duals as a GSM phone for you to travel. Of course the GSM phone is unlocked for foreign carriers. And since you already picked Verizon, they are not afraid that you want to switch to GSM/3G carriers. But if money is no object, there are other more elegant ways to have a 2nd phone number with a smart phone.

The Internet or calling card like methods will be next.


Sunday, January 6, 2008

Desktop Tower Defence - top score video cure additiction

Finally I came across something that can cure the DTD addiction. It's video on how the top scores are made. You can learn a lot, but you may also give up altogether - as I said, the game isn't great after all. So if you want to play your own way and improve at your own pace, skip the videos.

Before the video's and the analysis of the top score strategies, I can disclose some tools that may help you to have more fun. In the challenge mode, there is the 3K Fixed game. Instead of 80 gold at the start of the Hard game mode, you have 3,000, but you can't add anything afterwards. It's a fast way to test out your maze, compare your weapons, and measure the unlisted properties of the weapons, such as how much the freeze towers slow creeps down. The weapons, if available, are the same across the games, but the health of the creeps are not all the same across games.

The other useful game is the 100K Gold in the fun mode. It's the same as 3K except that you can play as in the normal mode after spending the initial gold. Even better, there are 100 levels instead of 50 in the main game, everything else being equal. So you have more gold to spend on the first 50 levels and hence more flexibility to test things out.

Finally, there's The 100 in the challenge mode. It's the same as the hard mode but with 50 more levels. So it's exactly the 100K Gold but you have only 80 gold initially as in The 100 game. The 100 doesn't help you with anything but this is simply a superset of the hard mode with more levels. You may or may not want to start with this game rather than the main game. Because the high score strategies are different - that works for 50 levels doesn't work for another extra 50.

Other modes and games are deviations from the main game. For example, some guys hate juggling, the selling and buying of the towers. It became less of a strategy game than a shoot-them game. But then there's not as much challenge because of the limitations of the game.

I used a spread sheet (Open Office) that contains data of gold earned at each level, the health of creeps at each level, and all the measurable properties of weapons, like firing rate. So you can calculate to some degree how much fire power you need at each point and if you can afford them. I also use the Open Office drawing package to help with designing mazes and acting as blue prints during the games. But with modes such as 100K, the need for these outside tools are less. Also, if you see the videos, precise optimizations are either not necessary nor not possible at the end.

I think there's some sort of collective conspiracy in the DTD forum, which missed a lot of critical information, perhaps in order to keep new players interested in the game. Firstly, as I expected, many top scores are fake. They play some other modes and hack the submission forms to change the name of the game to get impossible high scores. Or they can just hack the flash code downloaded to everybody's computer during play. So the top players started to post their fast forward video on Youtube.

The first video I recommend is a classic strategy for the main game DTD 1.5 Hard, with no juggling, or even no selling at all.

Notice it's so easy using only one Swam (6) tower and all Squirt towers. I have done similar things before but I gave up because it wasn't likely to beat the high score. The strategy is easy. I have calculated that I need the equivalent of 4 swan 6 towers to kill the air bosses. When I saw this, I went back to my spread sheet and calculated if I reduce the sw6 to 2, then I need about 7 squirt 6 towers. So I need only two boost 5 towers and one sw6 to give the equivalent of 2 sw6 towers, cheaper that way. And since building extra sq 6 towers is more economical than adding boost towers, it's pretty easy to place the sq towers without worrying packing them together to touch the boost towers. There are more than enough fire power and enough money left for two frost 5 towers to slow down the air bosses to receive sufficient hits.

As for the maze, I said that the optimum pattern for sq towers is the cross, proportional in size to their firing range. But with two or more sq packed together, the cross doesn't make much sense any more. I used the drawing package to draw range circles on each sq. I think the optimum pattern is like peeling an apple - something like the maze in the video. It's not neat, but it doesn't matter because there are more than enough fire power.

With this setup, a new player and an old player differ only in how fast they hit the send-creeps early-button to add extra scores. Very soon you will hit near the high score of this strategy. Note that the no selling is a self imposed rule. The nearest game is the 3K fixed game if you want to fight for the top spot, but 3K is easier because some bosses are less powerful I think.

The next video is the top score of DTD 1.5 Hard:

Basically the guy almost managed to send the creeps altogether, and kill them gradually long after the last creeps came out into the maze. You need always to build enough sw towers to kill the air creeps, because you can't keep them in the maze. Sq towers aren't useful to air defense at all because they will always be distracted by the land creeps. So only bash towers are useful. Since you have very little money left for it, you don't worrying how to put more of them together with boost towers.

The maze isn't that important as long as you have two alternative paths, gold efficient at the beginning, and space efficient at the end. My staggered DNA pattern works rather well, with three DNA pattern on each path, and utilizing the remaining desktop space as maze. But since you have to share the pellet towers in the two paths to save gold and space, the DNA pattern aren't necessary.

The surprise is the splash towers. Not only that they fire at everybody in range, but they are completely frozen for a long time. I gave them up because of the seemingly weak power for the money. But the freezing allows the other weapons to be many times more effective. So killing the air bosses becomes very easy.

After I saw the true master at play, I decided that this isn't my game. It's all about timing, more of a shoot-them-all game than a war strategy game. Getting the timing right initially is hard but there's not much potential to optimize.

I could have completely cured of the addiction if I hadn't see the 10K fun:

The juggling strategy for the hard mode won't work anymore over 50 levels. But, you can't survive without a little bit of juggling. So it's a balanced game. But at the end, you have to use a lot of splash towers, and reserve a large central area for all the towers. So there aren't much variation to the maze and the use of the splash towers become more of a shoot-them-all game.