Posts from November 2007
NetHack + DS -> New Project!
When I first got my DS backup device, it didn’t take me long to track down, and quickly eliminate as impractical, the first, and to my knowledge, only attempt to make a DS NetHack Port. It’s a “port”, in the sense that it really just takes NetHack, shrinks it down, displays the virtually unreadable game on the upper screen, and a graphical keyboard on the bottom screen. Does it work? Sure. But only just barely.
So quite a while back, I decided I wanted to create a port of my own. Much initial hackery was begun, followed by the usual subsequent boredom, followed by the devastating loss of my DS and backup device in an unfortunate incident involving my crappy memory and an airplane seat pocket. The result was a project that languished in my subversion repository until, a few weeks back, my new R4 arrived in the mail which, when pared with the new DS my brother kindly bought me for my birthday, resulted in renewed homebrewing efforts!.
Since then, I’ve made enormous progress. The game is essentially playable right now, and sports:
- A top screen displaying a minimap, status and message display, and input prompt.
- A bottom screen showing the game map in unscaled, scrolling, tile-y glory.
- Support for movement using the joypad, as well as the stylus.
- A popup command list, toggled with the L-button, from which the user may select commands with the stylus.
- Full support for menus, again using the stylus for item selection.
- String input using a virtual keyboard.
- Save/Restore support.
Of course, if it were all roses, I’d release the thing right now. But there are bugs, and a few things on the TODO list, as well:
- Currently wide text is clipped… I’m not sure how to solve this, though.
- The menus should be pageable with the joypad.
- Quitting and saving should return the user to the flash cart menu, or possibly power off the DS.
- It desperately needs a left-handed mode.
- Keys need to be configurable.
And, of course, I need to test test test! I’m primarily worried about memory usage… I think I have most of the issues worked out, and I spent a fair bit of time teleporting around the game in wizard mode, causing general mayhem, and didn’t run across any issues. But I’d like more time with it to make sure the obvious bugs are ironed out.
And even with those problems fixed, I will fully admit that:
- It’s kinda fugly. But it’s fugly the way text-mode nethack is fugly, so it’s kinda charming that way, and
- The text rendering code, particularly for menus, is slow.
But, in short order, I’ll hopefully have a release out. Meanwhile, stay tuned for screenshots… assuming I can get desmume up and running and working with my port. :)
Oh, and BTW, if anyone has thoughts for a name (NethackDS is taken, so I was thinking something like “Nethack Touched!”, or possibly something even more lame, would work), please let me know! Plus, then I’d know if anyone’s bothering to read this thing, anymore. ;)
More on the US Dollar
Yeah, I’m beating this horse to death. Hey, it’s fascinating to me, alright? Besides, I’m finally starting to catch at least a glimpse of how this whole economics thing works, and given that economics underpins how our entire world works, it seems worth exploring.
Anyway, occasionally I’ve heard comments regarding oil and how it’s traded in US dollars. Further, I’ve heard the idea parroted that, if the world were to switch to a different currency for trading oil (like, say, the Euro), the US dollar would experience a significant decline in it’s exchange rate. But I never really understood why that would be. Until yesterday, anyway.
As I mentioned in my previous post, the foreign exchange market is where the exchange rate for currency is determined, and that value is based on supply and demand. If the demand for a currency is high (say, because people want to invest in that country’s economy, or purchase it’s exported goods), then the exchange rate will be high.
Now consider that oil is currently traded exclusively in US dollars. That means any nation wishing to purchase oil on the open market must first convert their currency to US dollars in order to participate in the market. Voila, all of a sudden demand for the US dollar is maintained at an artificially high level, thus propping up the US exchange rate. Now imagine everyone switched over to the Euro. Suddenly a major source of demand for US currency evaporates, and the result would be a massive drop in the US exchange rate, which would cause, among other things, sudden domestic inflation as the price for imported goods shot through the ceiling. Hello recession!
On Economies
So, during an online discussion that my wife participates in, some questions of economics came up. Now, I’m absolutely no expert in economics. In fact, while I find the topic quite interesting, my knowledge of the subject is fueled primarily by the few online resources I can find, chiefest among them Wikipedia. So, take the following for what it is: an attempt by a layman to enunciate a bit of what he understands of economics and money markets. In other words, very little.
The Value of Money
When I first started reading about this stuff, I must admit, my first question was a very basic one: what, exactly, does it mean for money to be worth a certain amount? What does it really mean for $1 CAD to be worth $1.09 USD?
Well, as far as I can tell, it all starts off in the foreign exchange market. In these markets, people trade currency. They trade it the same way one would trade any other goods, basically offering to trade \(X\) units of one currency for \(Y\) units of some other currency. It’s a slightly strange idea, but it’s a natural one when you think about it. For example, when an individual decides they want to visit a foreign country, it’s necessary for them to trade their currency for currency of the country they wish to visit. At that time, that person is, in fact, participating in the foreign exchange market, albeit at the very lowest levels.
As for the players, there are many who participate in the forex. Primarily, it’s central banks and other large financial institutions. Lower down the chain, you have importer/exporter outfits and so forth, and at the bottom rung, there’s you and I. Though, unlike you and I, the really big players (Deutsch Bank, HSBC, and a few others) have far more purchasing power, and can negotiate rates, unlike we plebs.
Now, like any other market, the forex functions on supply and demand. Thus, the value of a currency is based on it’s demand. If lots of people want a given currency, people will be willing to trade more to get it. And why would one want a given currency? Well, there are a few reasons:
- International lending and money markets. HSBC, Deutsch bank, and plenty of others, issue loans to businesses and financial institutions the world over. In order to operate in a given country, one needs currency for that nation.
- Trade. If you want to buy, say, Chinese products, you need Yuan to do it.
- Foreign investment. Any investment firm wishing to involve itself in foreign markets will need currency in that market.
So markets which are considered strong and stable will have a high relative currency valuation, as participants will want to be involved in that economy, either by investing in business, providing loans, or purchasing exported goods. Meanwhile, weak markets will see demand in their currency decline, which will be reflected in the exchange rate of that currency.
On Fractional Reserve Banking
Sounds fancy, doesn’t it? Fractional Reserve Banking. Oooh. But what does it really mean? It’s pretty simple, really: Modern banks lend out more money than they have in reserve. Where a bank’s “reserve” is the amount of liquid funds it has on hand.
What that really means is that a bank may, for example, give out a loan for $80 while only actually having $20 on-hand. Sound strange? Well, it gets stranger.
Consider what happens when you acquire a mortgage for a house. The bank gives you a loan for, say, $300,000 dollars, and let’s assume that only %20 of that loan is backed by real liquid assets. This means that $240,000 of that loan is essentially created on the spot. This money is then given to the seller of the house, and ultimately makes it’s way into circulation. So, at this point, the bank has literally manufactured, out of thin air, 240,000 new dollars.
Okay, that’s not strictly true. When the bank issues that loan, they do so knowing that the house itself backs that loan. So, in essence, what has happened here is that the market value of the house has been transformed into liquid assets, and those assets have been injected into the market. Now things are starting to get weird.
So, money is created by banks. Banks create money by issuing loans, and so the new money is generally backed by other assets. Of course, this means money is being created all the time, and the rate the money supply increases or decreases is a direct function of the economy. A hot economy will see an increase in the rate of money creation. A cool economy could see the precise opposite happen1). As it happens, if the money supply increases rapidly, that generally leads to inflation (yet another topic), which is why inflation is such a problem in a strong economy such as Canada’s.
Now, these banks don’t operate in a vacuum. In most nations, there are regulations in place which limit the percentage of loans which must be backed by reserves. Furthermore, the central banks, such as the Federal Reserve and the Bank of Canada, are primarily responsible for issuing reserve funds to banks (how those funds are backed is yet another topic I won’t bother with, since I understand it even less than this stuff :). As a consequence, a central bank can influence inflation by limiting the amount of reserve funds they issue, thus indirectly ratcheting down the rate new money is created. They can also affect the economy by adjusting interest rates. Remember, high interest rates discourage new loans from being acquired, which also decreases the rate at which new money is created (it also increases saving and decreases spending, also affecting inflation).
But there are some nations where banks need not hold any reserves to back their loans. The US is one such nation (though this wasn’t always the case). Specifically, neither commercial nor consumer loans need be backed by reserve holdings in the United States. This may seem surprising, but there is some theory to back this approach that Wikipedia can provide, if you’re so interested.
Inflation?
Yeah, it’s a vague concept, and a strange one. In general, inflation is the decrease in purchasing power of a unit of currency. Or, put another way, it’s seen by we folk as a general increase in prices.
But what causes it?
Well, there’s a few things that can cause a general increase in prices:
- Demand-Pull inflation - An increase in demand caused by increased spending, both public and private. People want stuff, so they’re willing to spend more.
- Cost-Push inflation - This is mainly caused by supply shocks. A sudden decreases in the supply of oil would result in an increase in oil prices, which would then be reflected in a whole range of goods.
- Built-in inflation - People want to see their salaries increased. This increases the cost of doing business for the employer. The employer then passes this cost off to the consumer. Vicious cycles ensue.
Incidentally, Demand-Pull inflation is a direct consequence of a strong market. As the demand for goods increases (take the housing market as an example), prices increase.
So is it good?
It’s generally accepted that inflation, in the small, is a good thing. Why? Well, first off, remember, inflation effectively means that the purchasing power of a given unit of currency decreases with time. So, if you were to take $1,000 and tuck it under your matress, in ten years time, that money would actually be worth less, in the sense that you wouldn’t be able to buy as much with it. As a consequence, you are more likely to take that money and invest it, such that your gains will offset inflation. Thus, inflation spurs investment.
Secondly, because the price of goods gradually increases over time, inflation provides an incentive to spend in the short term, rather than waiting. Thus, inflation also spurs spending.
Of course, high inflation is definitely a bad thing, as it decreases overall purchasing power, and as such, must be controlled. Again, the Canadian government (and Alberta, in particular), is struggling with this very issue.
A Bit About Trade Deficits
Well, everyone has heard of trade deficits from time to time, particularly in the context of the United States. When you think about trade, consider every country imports, and every country also exports. It’s a balance. When the amount a country exports is greater than the amount it imports, we have a trade surplus. When the reverse is true, we have a trade deficit.
Now, by most, long-running trade deficits are considered a bad thing. Fundamentally, they represent wealth that is exiting the country, and while that wealth typically returns in the form of foreign investment and so forth, it does mean that domestic spending can only be fueled by further increases in debt (if wealth is leaving, it must be coming from somewhere… and that source is usually debt). And this debt can lead to a drag on the economy, a drag which can actually have a multi-generational effect, as that debt is passed on.
Do I Have A Point, Here?
Ah, I knew you’d ask that question. In fact, I just asked it myself the very same thing. But it turns out I am, in fact, driving at something! I, too, am surprised.
Specifically, I wanted to learn a bit about what’s going on in the US housing market, and the effect it (and other things) have had on the US economy. What we had was the following:
- Banks issuing loans with extremely low up-front interest rates to those without the ability to back the loan. Behaviour encouraged by the decision to remove reserve ratio limits on consumer loans.
- A resultant housing bubble, causing a massive inflation in prices, due to an increase in demand fueled by a glut of funds.
- Debt holders defaulting as interest rates suddenly increased, leaving them with homes they couldn’t afford.
- A sudden rush of homes hitting the market, resulting in a collapse in house prices.
- Banks left with bad loans, some to the point of insolvency.
- Meanwhile, we have a massive trade deficit, putting US dollars in the hands of foreign investors who no longer want them.
So, what do we have here? First, we have banks issuing debt, and thus creating money, based on shaky loans and an unsustainable housing bubble. Of course, this fueled a strong period of economic growth in the US, as money supply continually increased with the issuance of new loans. But, as usually happens with economic bubbles, eventually it burst, and the housing market collapsed. Prices fell through the floor, and the banks were left with masses of bad debt, which also erased large amounts of money from the US market, as that money was no longer backed by loans or assets. This also takes large amounts of cash out of the hands of consumers, which used home financing to support other purchases.
Meanwhile, thanks to a huge trade deficit, we have large numbers of US dollars exiting the country, being moved into the hands of foreign businesses. Now, in the past, these businesses would simply reinvest in the US, attracted by a strong economy and high interest rates, and so the overall effect of the deficit was essentially neutral (while foreign investors gained the interest benefit, the overall loss of wealth was still somewhat mitigated). But now, in the wake of a slowing US economy, which was already causing a decline in the dollar, we suddenly see strong evidence of poor monetary policy, which increases the apparent risk of US debt. Suddenly, buying that debt looks like a risky proposition indeed, and with the economy slowing, investment also seems like a poor idea. So what do they do with all these US dollars? They exchange them for some other currency. And since no one wants them, they can’t get as much for them as they could in the past, thus pushing down the US exchange rate.
Lovely, eh? Of course, the decline in the US dollar must end eventually. The market is sound, for the most part (although consumer, corporate, and government debt is still a significant concern). And, ironically, as the US dollar continues to fall, while US citizens will see an increase in inflation (thanks to a general increase in prices), we should see the trade deficit begin to shift, as the purchasing power of US consumers continues to decline, discouraging purchases of import goods, while the price of US exports falls. Though, that’s little consolation to those already on the fringes who rely on a strong US dollar and cheap foreign products in order to maintain their quality of life.
By the way, I fully acknowledge that I’ve likely massively simplified the above, to the point of absurdity. I’m sure I also have all my terminology wrong. And the concepts. And my conclusions, as well. But hey, I’m a layman, leave me alone! :)
-
Let’s say you begin paying off your house because you’re looking for a stable, long-term investment. By doing this, you take money out of the economy, and hand it back to the bank, thus erasing a small portion of your loan. In doing so, you effectively take money out of the economy, and lock it back into you house. The result is an effective decrease in money supply. ↩