Posted 4 months ago

Annoying 76 or 80 Column Guideline/Indicator Removal

I found out there’s a nasty feature that can be accidentally turned on in Visual Studio:

Good god, no. Just… No. How do I turn this off? Nothing obvious anywhere. After some research, I found out that there is a secret registry key here:

Getting rid of that didn’t help me though. So after some head-scratching and gnashing of teeth, I realized I had recently installed Visual Assist X— so I promptly disabled it and it went away. Digging in, I found this nasty little bit:

BEGONE, FOUL BEAST! Hope this helps some of you out there.

Posted 4 months ago

Much wailing about the death of XNA for naught

The article here, found circulating Twitter, talks about how XNA is effectively dead now. It continues to wail about how because Silverlight and WPF are “gone,” nobody should trust Microsoft enough to bother learning Windows 8’s new SDKs (IE pack it in, we’re sticking to Windows 7 or leaving for “greener” pastures).

First point of contention here: the Xbox aspects of XNA are alive and well on Win8 as MoLIVE, and C# is still available for app development. MoLIVE allows you to avoid GfWL (great, it was terrible) and use the language of your choice (C#, JS, or C++). Alternatively, if you refuse to change your codebase for XNA you can port it to MonoGame and get it to run on even more platforms than Win7/Win8Metro with a tiny bit of work (iOS, Android, Bastion was ported this way from XBLA). That said, if you bother to learn Windows Runtime (the API/SDK for Windows 8) then you will be able to easily port your app to run on ARM devices for Windows 8 RT, or on phones running Windows Mobile 8 (it’s not hard to surmise the strategy here of unifying the underlying dev experience).

The second point here then is that while “Silverlight” and “WPF” are gone, their underlying tech of XAML is very much alive in Windows Runtime. Unlike Silverlight or WPF though, you can opt out of XAML and do your own thing with another library, like Scaleform. You’ll lose out on some of the benefits of XAML for UI, but this may allow you to more easily port from other platforms (such as the Xbox).

Those points aside, game developers should take a hard look at whether they are being stupid by not using middleware that can isolate them from this sort of thing. I would think that something like Unity that allows development of gameplay code in C#- or JS-like syntax cross-platform, that has tons of plug-ins and assets available for purchase or for customizing, would be seen as yet another route to take to lower the burden on indies.

Posted 8 months ago

Considering MongoDB? Be careful!

Even after hearing about MongoDB for the first time in an MSDN magazine article about five years ago it wasn’t until recently that I had heard of anyone trying to use it professionally. While it had piqued my own curiosity of what a non-relational database would be like, there was little opportunity in my own day job to try to make it do Real-Life Things. Later, I was speaking to an engineer at EA who had the opportunity to try out several different NoSQL products to try and use them for telemetry storage and reporting for a very large franchise (which will remain nameless here). His report at the time was that MongoDB wasn’t even beta quality software, and that not only did the documentation purport future features as current fact, but that the primary author was incredibly dismissive and rude about just about everything. Not having tried to use it myself and only hearing about this anecdotally, one naturally takes it with a grain of salt. The engineer’s take was that they would pursue other solutions like Cassandra, due to Facebook developing it and that it had a much bigger support community existing (oddly enough later on, they would ditch it themselves in favor of HBase). That was two years ago, and I continued to hear things via my favorite sources on Twitter (which is an amazing resource of interesting links for a software developer, if you aren’t on there following folks then you are probably missing out on what’s new).

Two links for today on the subject again then. The first is a link talking about how the documentation doesn’t really stress the dangers inherent in its design, and that using it like ACID software like a traditional RDBMS is dangerous: “I’ll Give MongoDB Another Try… In Ten Years”. The second, is a more blow-by-blow account of the downsides of using the software in a real-world environment: “Goodbye MongoDB”.

Posted 11 months ago

Engineering versus Craftsmanship

From a comment on the Dice blog: “The production of code is not engineering. It is craftwork. The job of an engineer is to apply scientific knowledge to the production of something. Knowledge of a particular field of science is essential. Although craft is an ingredient to any job, it is not an essential ingredient for an engineer. A materials engineer who has a thorough mastery of tensile strength constants but zero “craft” aptitude will trump, every time, someone whose whole being is engaged in the Zen of craftwork but who is not thoroughly familiar with the relevant scientific constants.

In sharp contrast, it is widely perceived that liberal arts majors produce the best code. The production of good code is not about science; it is about attention to detail. It is about total intellectual engagement. It is about caring. It is about ethics and trust. In short, it is craft.

The only reason that what we do is called “engineering” is that “craft” is a lower status word in the United States. No one wants their occupation to be equated with basket weaving.”

Posted 1 year ago
Posted 2 years ago

MySQL (InnoDB) is ACID... really! (not really)

I used to naively think that ACID meant that if I create a transaction and then roll it back if something fails then it should be a clean slate (the A, for “Atomicity”). Then I read this about InnoDB:

For example, if you use CREATE TEMPORARY TABLE and then roll back the transaction, the table remains in existence.

Oh, well, I guess the A part doesn’t really work.

Posted 2 years ago

Essential Fallout New Vegas PC Mods

  • Fallout Mod Manager - essential if you want to start managing your mods without your head exploding from dealing with weird quirks from Bethesda’s game engine
  • New Vegas Script Extender - required by some mods, such as grenade hotkey and optionally for FOOK. It works quietly behind the scenes with Steam, so no worries!
  • Community Bugfix Compilation Pack - also has modules for DLC
  • FOOK New Vegas - mega-mod of fixes and additions, such as making quests work properly, fixing up bad textures and models, adding Fallout 1-3 weapons and armor, etc.
  • Free Wild Wasteland Trait - why blow one of your two slots on it? This used to be a standard part of the game for Fallout 1/2 folks.
  • Power-Armor Self-Taught - this addresses the weirdness of not being able to figure out how to get into a suit of armor but being able to construct a flaming sword out of spare parts and potent drugs that make you see in the dark
  • Unified HUD - works with various other HUD modifications out there (too many to list, pick what you like— I personally use Primary Needs and Grenade Hotkey)
  • MTUI - Use all that PC screen space more effectively
  • Pip-boy Readius - Not everyone comes from a vault, and not everyone thinks a huge manacle on their arm is fashionable — here’s a PDA instead
  • AG Supplementary Uniques - add more unique items to the game to round things out
  • Female Power Armor - makes things more fitted for the ladies so you can tell them apart from males
  • Improved Companions - pick up more companions based on your charisma
  • Freeplay after MQ - why does the game end?
  • Mid-western Power Armor - from Fallout Tactics
  • Out of VATS - certain perks for VATS use made more useful outside of it
  • Fade that Faction Armor - scratch and fade off those logos from useful armor so you won’t be shot on sight by rival factions
  • Salvageable Cars - any cars not completely wrecked can be looted for spare parts
  • Legal Crap to Missing Slides - get rid of all those immersion breaking copyright information start-up slides with some amusing test slides
  • SPECIAL Stats Overhaul - makes some stats more useful and inspired by older Fallout games
  • Manual Reload - hear a “click” when it’s empty and know to switch guns instead of waiting for a forced automatic reload, just hit R to reload, and hold R to put the gun away
  • Lock Bombing - blow that Vault door or gun cabinet wide open with a shaped charge (you may lose some items!)
  • Craft Overhaul - many many recipies that are great
  • Alternate Title Screen - tired of staring at the NCR Desert Ranger? how about some concept art?
  • Realistic Repair - use clutter items for minor repairs, similar items, etc

Posted 2 years ago

Visual Studio Async CTP for C#

Has anyone tried to use the Visual Studio Async CTP for C#?  I am interested in feedback from anyone who has.  Here is the MSDN page: http://msdn.microsoft.com/en-us/vstudio/async.aspx

The whitepaper looks amazing in reduction of complex code and sounds very promising for creating responsive user interfaces in WPF.  Currently I have a client application for my web service which, in some cases, chops up calls to the service and iteratively calls and updates the UI.  This seems to be an ideal use-case scenario for this extension to C#, as it is very similar to the examples in the whitepaper.

private async void sumButton_Click(object sender, RoutedEventArgs e) {
    sumButton.IsEnabled = false;
    await SumPageSizesAsync(GetUrls()));
    sumButton.IsEnabled = true;
}

Another interesting thing is being able to declare event handlers anonymously using lambda expressions, which can get rid of those small two or three line delegate functions and place the relevant code closer to its (code) context:

sumButton.Click += async (sender, e) => {
    sumButton.IsEnabled = false;
    await SumPageSizesAsync(GetUrls());
    sumButton.IsEnabled = true;
};

Then besides those there is also the Task-based Asynchronous Pattern (TAP) which is their suggestion that async programming in C# should move to using the .NET 4 Task methodology.  I haven’t read the paper on this quite yet (I think it’s only accessible within the CTP download installation) but I could see it making sense if you were already structuring your code for this library.

Posted 2 years ago

LINQ is the devil in disguise

You better make your bargain with it very carefully, or you may not get what you expected! What do I mean? Am I being dramatic? Yes, I am, but I’m seriously annoyed at a bug I just dealt with!

LINQ is a newer tool in your .NET box that gives you a powerful way to create and manipulate sequences data in objects using either a SQL-like syntax or methods, either of which can be strung together. Another way that this is devilish is that it doesn’t run anything until the last moment possible, using a new behavior that can underly the IEnumerable interface (look up the new yield operator). This lazy evaluation (or more technically, “deferred execution”) seems great at first glance — you can throw a few different clauses together, like Where, Distinct, etc to narrow your data down to what you need and then let LINQ worry about how to (hopefully optimally) create your result set at the last second.

Here’s where things get tricksy, though: using IEnumerable isn’t exactly like a List, or an Array, or any other collection (that people are typically used to dealing with) — when you force the execution using functions like Count, run it through a foreach loop, or finish using an enumerator that you created with a GetEnumerator call, the next time you need to have it execute it has to start from square one. Yes. All over again.

Think about this for a minute.

If I run Count(), to get a number and then run a foreach loop on the same enumeration, it has to fully execute that list once for Count and then fully again for the loop (unless you use control-flow logic to break early).

“Okay, but so what? Why does this matter?” you ask. Yeah, what’s the problem? Why are you complaining about LINQ, Matt?

It’s a problem of unintended side-effects. If someone passes me an IEnumerable across a method or class interface, I have no idea what underlying code implements that and therefore can’t predict what consequences my own code will have.  If I decide to start modifying the objects in the enumeration, there is a chance that the next time I run a loop over it my precious new values will be lost, and to add insult to injury, the application will now also be dealing with a potentially huge separate old IEnumerable that the garbage collector has to go clean up when it feels like it. (Well, unless you want to force your application to grind to a halt and collect the garbage because you know better.)

I’m hoping at this point you have a horrified look on your face, because the underlying code could be using LINQ to SQL and re-running a query to a database, or it could be using Select or SelectMany to transform data from another List or Array, or any number of other variants. 

The devil is truly in the details— ones you can’t always know. Deferred execution is powerful, and I won’t argue with anyone that sees value in LINQ (the syntax can quite elegantly express very complex data manipulation). But much like firearms, you have to know how to use them so you don’t shoot yourself in the crotch, or take a rifle-butt to the chest and break a rib.

So now that we know, what can we do about it?

  1. Don’t use IEnumerable across method boundaries or interfaces unless you have a good reason. (Yes, I know that this contradicts the traditional “use the lowest interface” best-practice advice.)
  2. Force IEnumerable to a List (or other appropriate collection) to circumvent unforseen multiple evaluation issues, if you don’t need to worry about the memory.
Posted 2 years ago

Continuous Integration Server Showdown

Going to take a while to digest this one but I am using CruiseControl.NET at work and was trying to figure out if we were using the best open-source product out there. It seemed like the various annoyances with CCNet (such as no baked-in support for NTLM authentication, tedious configuration file setup, and non-integrated Perforce ticket refreshing) meant that we may want to modify CCNet (open-source license issues not withstanding) or look elsewhere. I had heard that TeamCity is good, but I would rather look at all the options like this gem of a link. (Thanks go to anyone who contributes to great shared info like this page).