Monday, November 08, 2010

Sims 3, Late Night, and Transfiguration of Metals

Ok, I know, this is a bit off my usual beaten path, but I don't care. I've played the Sims since 2000, and I freely admit to wasting a lot of time on it.

In the Sims 3, since World Adventures, there has been a pair of objects (the Carter XL Display Cases) that can be filled up with objects and "irreversibly transfiguricated" (more commonly known as transfigurated) into other objects. What object one gets as a result of a transfiguration depends on what objects one puts into it, along with some random factors. Various people who know how to look at the scripting language that the Sims uses internally have done so and posted descriptions of the relevant algorithms. I spent quite some time exploring this for the special case of transfigurating metals, and have a simulator now that can predict the result of transfiguration for any particular combination of metals for a game with the World Adventures and Ambitions expansion packs installed (WA+A). I could do the same for just WA if I wanted to set up an install that had just WA loaded, but I've been too lazy to do this yet.

Part of the algorithm for metals works by XORing together the internal OIDs of the metals involved, and then using that as a index into the list of metals (modulo the number of metals) to generate a random metal. The index is then pushed through a PRNG (pseudorandom number generator), and repeated until metals totaling more than a certain value are created. This worked fine and good in prior versions, with the longest string being about 8 or 9 metals in WA+A, where there were 14 metals. However, while in WA alone (which had 13 metals) it was possible (with some care) to create any metal using this process, in WA+A five of the metals (silver, palladium, copper, titanium, and mercury) could not be produced at all, and two more (supernovium and woohooium) were very hard to produce. This is, no doubt, because the low bit of the XOR result is always 0 (because all the OIDs have a low byte of 0), and the modulus 14 of an even number is always even, and so that effectively excluded half of the metals (the ones with odd indices in the metals table) from being the "first result". Add to that a relatively "inaggressive" PRNG and you get a relatively sparse result set, which is what I had noticed with WA+A.

Late Night (LN) added two more metals; as a result, in WA+A+LN, there are 16 metals. Those of you with some experience with generating hash codes will immediately understand where this all goes belgium, but I'll explain it for the rest of you. A modulus of 16 results in only 4 bits of the source value contributing to the resulting index. And all of the OIDs in use have a 0 in the low byte (for whatever reason). As a result, the random value generated by this process is always 0, which corresponds to iron, the cheapest of the metals. To make matters worse, the PRNG EA uses apparently isn't that "random": it appears to map all values that have a low nibble of 0 to values that also have a low nibble of 0. As a result, every metal after the first is also iron. So, instead of getting a "random" (but predictable with much effort) result of various metals (which makes the process both interesting and potentially useful within the context of game play), the result of every transmogrification in Sims 3 with WA+A+LN is a huge stack of iron bars, which is neither interesting nor valuable within the context of game play; furthermore, the resulting stacks are often so large (in some cases, one hundred or more, although the game doesn't show it) that it corrupts the player's inventory, rendering that game effectively unplayable and forcing a retreat to the last save point. Here's hoping you had one.

This wouldn't have shown up in testing with just the base game plus LN, or with A+LN, because in those games there is no transmogrifier (it's a WA expansion item), nor in testing with just WA+LN because in that game there are 15 metals and with 15 metals the randomness of the distribution will be nearly as good as it was in WA alone (with 13), possibly even better.

I had a lot of fun figuring out the matrix for WA+A, and was really looking forward to doing in in WA+A+LN. A shame it had to be completely broken instead. We can only hope that EA will fix this in a forthcoming patch; however, any patch is going to mean a new algorithm (or at least a different PRNG), which means all the work I (and others) did for the preceding algorithm will probably be wasted.

Sunday, November 07, 2010

Kik, Diwali, and Lil Wayne: Hot topics for November 7, 2010

There are three new rising items today: something called "Kik", Diwali, and Lil Wayne.

Kik appears to be the Kik Instant Messenger, which is a substitute IM service for smartphones, available for Blackberries, Android, and the iPhone.  The appeal is, supposedly, that you can send instant messages without paying for them, by using your data connection instead of a carrier SMS.  The downside is that your recipient has to be using Kik as well.  I don't see what this offers ahead of Google Talk, which has been available for all three platforms for far longer, and has a far larger user base as well.  Perhaps I'm missing something here.

Diwali is, of course, the annual Hindu festival of lights, which started Friday, November 5th.

The third rising item for today is more celebrity gossip, as rapper Lil Wayne seems to be flaunting his probation by posing for a photograph with a glass of cognac.  Not quite sure what it is about rappers that forces them to flagrantly and stupidly break the law, but there you have it.

Daylight saving time ended this morning, so don't forget to adjust any old-fashioned clocks you have that don't automatically adjust.  And it's still not too late to change the batteries in your smoke detectors.

Saturday, November 06, 2010

Tony Parker: Hot topic for November 19, 2010

Today's only new item is Tony Parker, a basketball player who is in the spotlight apparently because he was caught sending sexually explicit text messages ("sexting") to the wife of another player (someone by the name of Erin Barry, apparently).  This seems to have come out in the context of his divorce, which is, of course, totally unsurprising.

I'm sure this sort of thing goes on all the time, and this is only making the news now because it involves both a basketball player (Parker) of some repute and also a television celebrity: his soon-to-be ex-wife is Eva Longoria, who is apparently somehow involved in Desparate Housewives, which I understand is a TV show of some fame.  Ok, whatever: two people who are famous for things I don't generally pay attention to.

Oh well, I suppose the masses need their opiates.

Friday, November 05, 2010

Andy Irons, Demi Lovato, and legal pot: Hot topics for November 5, 2010

The big item for today appears to be Andy Irons, a pro surfer who died of unknown causes, but possibly dengue fever, on November 2.  Dengue fever, now that's a disease you don't hear about much, although it's actually relatively common in less-developed parts of the world.  I suppose it's not entirely unreasonable that a surfer might catch it.

The other up-and-coming item has to do with a Disney exploitee by the name of Demi Lovato, who apparently beat up another performer recently.  If there's anything that I pay less attention to than celebrity gossip, it's celebrity gossip involving those insipidly disgusting child "performers" being exploited by America's most odious cultural hegemon.  Perhaps we could arrange for them to all catch dengue fever.  Or, better yet, for their corporate managers to do so.

Searches for election results are, unsurprisingly, rising, with an apparent special focus on those in California and especially Proposition 19, the California ballot initiative to legalize pot there, which failed, gaining only 44% of the vote.  I guess the rest of their supporters were too stoned to figure out how to find the polling place.  In any case, even if it the proposition had passed there would still have been the federal prohibition on marijuana to overcome.  Still going to be a while before you can toke up anywhere you want. 

Football player Randy Moss, who I mentioned yesterday, is holding at number 5; I haven't looked to see if there's anything new about him, as I really don't care.  The upcoming change back to standard time this weekend fills out the remainder of the top ten for today.  Don't forget to change the batteries in your smoke detector.

Thursday, November 04, 2010

Capri Anderson, Randy Moss, and Jon Stewart: Hot topics for November 4, 2010

Apparently the hot story from the past few days has something to do with actor Charlie Sheen, a porn actress called Capri Anderson, and a trashed hotel room.  I can't be bothered to make sense out of the social gossip reporting, so if you really care Google's over that way.

Normally I care about as much about sports as I do about celebrity gossip (which is why I am mainly happy that the World Series is over, and so I won't be hearing much about it even if it is still trending up at the moment).  However, I must admit that I am slightly amused by the situation surrounding Randy Moss' low opinion of Tinucci's Restaurant, which apparently provides catering services to the team Moss used to play for before recently being traded.  In response to his verbal tirade about the quality of their food, the restaurant is offering a free lunch to the first 50 people who show up and agree to trade in their Randy Moss fanwear.  Still, I'd be far more interested in Maurice Moss than in Randy Moss any day.

Please note that daylight stupidity time (sorry, daylight savings time) ends this weekend.  Of course, having grown up in Indiana daylight savings time seems strange to me.  Plus, with the recent changes we're now on daylight saving time from early March until early October, or about two thirds of the year.  Frankly I don't see why we don't just leap forward next March and not bother leaping back ever again.  It's not like solar noon is anywhere near clock noon in most of the country anyway.  But then again, if we did this, how would we remember to check the batteries in our smoke detectors?

Jon Stewart continues to trend high, probably because of the combination of his recent interview with Barack Obama and the Rally to Restore Freedom (and/or Fear) that Comedy Central recently held in Washington.  Stewart has, perhaps improbably, emerged as one of the most prominent voices of this generation.  I haven't watched any of this week's shows yet—they're on the TiVo—so it's also quite likely that he's had some interesting, or at least amusing, comments on the election results as well.

Limewire continues to trend up even as it disintegrates under the force of the court's adverse ruling in its battle against the RIAA.  Hard to imagine what is left for them.  This was pretty much inevitable; what surprises me is how long it took and how long Limewire held out.

Searches for "Black Friday", the traditional name for the Friday-after-Thanksgiving shopaganza, are starting to trend up, presumably as people start to plan for their annual shopping fix.  There's even an "official" Black Friday 2010 website.  Just the other day I heard a radio commentator (WBBM in Chicago) suggest that Black Friday is starting early this year, with pre-Christmas sales starting even before Halloween. 

The tenth rising search at the moment is for "Black Ops", which seems strange at first until one realizes it's for the next installment of the Call of Duty franchise, due out in about a week.  I don't personally care for first-person (or third-person) shooters, so I won't comment further.