Before you spend hundreds of dollars on online games like "FarmVille," pause to consider your reaction if your game of choice vanished into the ether.

When game publishers turn out the lights on virtual worlds, everything in them ceases to exist. But anyone who spends money on virtual goods, be they Xbox Live Arcade titles, credits in Facebook games or accoutrements for online avatars, should view the recent closure of Facebook game “Street Racing” as a cautionary tale.

On Monday, social gaming juggernaut Zynga shut down “Street Racing,” one of its less popular titles. According to social games blog Games.com, the Facebook application had about 400,000 active players. To those of us more familiar with console or traditional PC games, that sounds like a heck of a lot of people, but it pales in comparison next to the nearly 60 million who played Zynga’s “FarmVille” on Facebook last month.

The announcement of “Street Racing’s” impending doom, about two weeks before the game was taken offline, didn’t come early enough for some players who, if an online petition can be believed, invested significant amounts of real money in the game. One user, called Lovebear, wrote a typical response:

I have spent alot of time and money on this app and for you guys to just toss it and us aside for whatever reason is nothing short of ignorant.

Players also objected to the way in which the closure was announced, via a cartoony image that urged racers to migrate to Zynga’s “FrontierVille,” whose theme couldn’t be much different from one that involves buying, tuning and racing autos. (Puzzling redirections are a tactic Zynga’s used before, as players of the defunct “Roller Coaster Kingdom” were redirected to “Vampire Wars” back in late June.) To many players, two weeks didn’t seem like a heck of a lot of notice, either.

Zynga's tone-deaf suggestion that players of "Street Racing" migrate to the totally unrelated "FrontierVille" struck a nerve and was replaced with a more generic announcement.

Responding to the uproar, Zynga announced it would refund all purchases made in “Street Racing” within the final 90 days of the game’s existence, plus issue 100-credit bonuses.

Those refunds are probably all “Street Racing” vets can expect to get. As angry as players might be, a company like Zynga is bound to have iron-clad terms of service that spell out what players can expect if their favorite game goes kaput, and every player likely agreed to those terms when they first started playing.

But “Street Racing’s” closure should serve as a warning to anyone who buys virtual goods that nothing is forever, and that gamers should do their due diligence before making online purchases. It’s not a bad idea to extend that caution even to downloadable games, which can be locked to specific hardware or potentially rendered inoperable at a later date.

In short, you need to know what exactly it is you’re buying before you buy it. And it’s not a bad idea to think of money spent on downloadable games or virtual items as a sunk cost you’ll never get back. Such games as Zynga’s “FarmVille” and “Mafia Wars” are wildly popular right now, but they may not remain so forever.

That level of caution should extend to other online services. Though the issue has received some publicity as of late, many Wii owners are unaware that games downloaded from Nintendo’s Virtual Console and WiiWare stores are locked to a specific console. If your Wii ever gives up the ghost and you buy another, you have to hope Nintendo takes pity on you and offers to transfer your games from your old machine to your new one. Otherwise, you’re out the money.

Though purchases through Xbox Live, the PlayStation Network and PC game service Steam are tied to users instead of — or in addition to — serial numbers, you’ll want to weigh what you buy from those services, as well. Game publishers occasionally end online support for older, less popular titles. If a game is taken offline, add-ons geared toward online play are essentially worthless.

You’ll also, obviously, need to consider what your reaction would be if Xbox Live, the PlayStation Network, Steam or your Facebook game of choice were to close. These services are all going strong now, but they cost money to maintain and may not last forever. The introduction of new gaming consoles, as well as potential bankruptcies or mergers, could dramatically reshape the way we play games online.

That’s not to say it’s not worth the risk to buy online content, especially when it comes at a heavy discount. In short, I rarely pay for downloadable games or add-ons I’m unlikely to play in the next couple of months. That way, even if I do lose access to my digital content, I can at least say I received some enjoyment for my gaming dollar. On the rare occasions I do break my own rule, it’s to buy games that are so cheap I don’t mind considering the purchase a sunk cost. (I recently bought seven high-rated PC games from Steam for less than $50 total because I thought the price was too good to pass up.)