Archive for August, 2010

XNA for the EveryDay Developer

I attended my first NYC Dot Net User Group last night. Nick Landry of Infusion development gave an intro talk on XNA with windows phone.

It was quite amusing to listen to the organizers talk about attendee behavior because it reminded me very much of the experiences I had running the Orlando .NET user group. I guess people don’t really change, regardless of geographic location :-)

Even though I’ve been living and breathing XNA for the last few years … I was reminded last night of how alien a concept game development is to many very competent developers. The concepts which seemed to need the most explaining were the mathematical aspects, and state management.

>In a world of pre-packaged controls, and silverlight behaviors for animation, it seemed that a lot of people had trouble grasping the concept of storing the state, which occurs separately from update, which occurs separately from the drawing. So I started thinking about how one might explain these concepts to your average day to day business application or systems developer.

MVC!

Yep, I said it … I think Model View Controller is a valid analogy that can be used to explain the way a real time game application works. Think about it:

  • Model: In XNA demos, the “model” data usually goes into private class level fields of the Game class. This data is usually textures, 3d models, effects, audio, and position data (Matrices, Vectors). The next step that most game developers take is to abstract all that stuff out into sprite, actor, or entity classes.
  • Controller: The Update method acts as the controller. It takes user input, or in-game “events” such as collision and facilitates the calculation of the new state based on that information. This is classic “controller” responsibility.
  • View: The Draw method is clearly a “view” upon the current state of the model. In a well factored game, there are no calculations in the view. If you’re drawing 2d, you iterate over your models, request their texture and position information, and draw it with the SpriteBatch. If 3d, iterate over the models (in the MVC sense), ask them for their Models and draw that.

Although the exact expression of “MVC” is not often used in the games industry, in the strictest sense, it is still a variation on the pattern. The concept could be very helpful to speakers and trainers who are teaching XNA to the uninitiated. If they can get the crowd over that initial impedance mismatch, then they can move on to more advanced topics faster, which would surely please the group.

Comments

Back in the Saddle

It’s been a heck of a whirlwind over the last month or so. I’ve moved to New Jersey, began working in MidTown Manhattan, and have so far managed to *not* drop dead.
Now that I’m starting to get into a daily groove, I’m finally able to start focusing on other interests and projects. Brought my laptop on the train (40 minute train ride in the mornings) and just started to clean house of old files and programs that I don’t really use any more. I’m a bit flabbergasted at how many applications use “My Documents” as a dumping ground. As it stands, I have the following folders that I did not create myself
  • Battlefield Heroes
  • Digsby Logs
  • Fiddler2
  • Integration Services Script Component
  • Integration Services Script Task
  • My Meetings
  • My Stationery
  • OneNote Notebooks
  • SQL Server Management Studio
  • Visual Studio 2008
  • Visual Studio 2010
What ever happened to using the AppData directory to store application level data? I mean, I guess I can maybe understand the OneNote Notebooks as it just stores notebooks that I create myself. But some of the others, like Digsby logs, or Visual Studio 2008 simply should not be there. It’s braindead simple too to get the path to the application data folder:
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData))
Although I know many (all?) of these apps aren’t written in .net, I know the APIs are available.
P.S. As I sit on the njtransit train writing this, I’m overhearing some lady who is *utterly appalled* and complaining at length to some colleagues about women who wear *flats* in a professional environment. Wow, the level of pomp and over-entitlement in this lady is just insane.

Comments (1)