Thursday, November 29, 2007

Battleships Forever

Now this ( http://www.wyrdysm.com/games.php ) looks like a really, really kick ass game.

One of the designers had it running on their computers today when I came back from the gym this afternoon.

This is the kind of game that makes me realize that working on Independent games is really the right way to go.

Sunday, August 26, 2007

A Rather Interesting Read

So, reading The Scientific Ninja, there is an article on why not to use singletons.

It's an interesting read about about why singletons are bad. Of course it goes overboard (Singletons are bad, will eat babies, etc, etc) but there are a couple of interesting points. I'm currently working with a codebase that is next to impossible to isolate into it's own module. For instance, one thing I wanted to do, as a test, was isolate the math codebase as it's own library. Doing this has proven to be a next to impossible task due to interdependencies that in my opinion shouldn't be there.

But in my opinion, there *are* a couple of systems in which a singleton *does* make sense. One that comes to mind immediately is a Resource manager.

A Resource Manager: To me, this is a prime candidate for the singleton pattern. Simply because, in a *game* there are enough subsystems that having global access to a well-referenced (and by well referenced I mean reference counted) system system for accessing assets, being able to hotload them and en does make sense.

I do have to say that the article has made me think a little harder about the use of a singleton. I have never liked the inability to definitely control it's lifetime (you can use some hacks to *mostly* clean up your singleton, but by definition there is always something left kicking around) but it's never stopped me from using it if I saw a system that would be of benefit from it. It does remind us that as programmers we still tend to go for the 'when all you have is a hammer, everything looks like a nail' idiom.







Powered by ScribeFire.

Saturday, July 28, 2007

Well now

Completely non-programming related.

Interesting little news blurb. Apparently there is going to be a 'rebirth' of the TV series 'Reboot'. This could be kinda interesting as I was a fan of the original series (even with it's crappy CG). Zeros 2 Heros has the info on it here.

No timeline yet, but I'm waiting for it, like I'm waiting for new episodes of Futurama.

Wednesday, May 30, 2007

Some Corporate news

Every once in a while, it's nice to see your company in the news.  Gamasutra just did an article on us and it's quite good. Check it out here.

Wednesday, March 28, 2007

More non-programming related

If you're like me, you use an electronic calendar of some sorts. As well, if you're like me, you hate outlook with a passion. Well, I've found an alternative. It's called Sunbird. It's from mozilla (firefox). And it works really nicely with my other calendar application of choice, Google Calendar. Install Sunbird, then follow these instructions. And you'll see what I mean. -- edit -- As an update to that, there's also lightning, which adds sunbird functionality directly into Thunderbird. That's what I'm talking about!

Thursday, March 22, 2007

Perforce integration in Dev Studio sucks

I just wanted to say that. Because it does. I have never had a decent Dev Studio set up where perforce integrated nicely and did what I wanted it to do. I mean, all that I want to do is check out a file. That's it. I don't need any reporting in Dev Studio. The perforce client does that for me, and quite nicely too. And getting revision history? I use the perforce client for that as well. So, I wrote a little macro that checks out files for me.
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics

Public Module Perforce
    Public Sub p4CheckoutCurrentFile()
        Dim Command = "p4 edit " + DTE.ActiveDocument.FullName

        Shell(Command, AppWinStyle.NormalFocus)
    End Sub
End Module
That's all that there is to it. You can set up Dev Studio to not allow you to edit read-only files, and you're golden. I bind this macro to Ctrl+Alt+P. When I'm ready to check stuff in, I switch over to the Perforce Client, review my changes and bam, fire it off. I did actually download the P4 sdk, so at some point in time, I may make this an actual plugin.

Friday, March 02, 2007

Not really a technical post this time ...

If you read this, and you know me even a little, I'm pretty passionate about games and how they relate and affect kids. Having three of my own does that. So, there's a new study out that is of interest to me. It's from the American Sociological Association. It's here (with the body of the document here) and absolutely worth the read, regardless as to weather you agree with the conclusions or not. So, go forth and take a gander. Tell me what you think.

Sunday, February 25, 2007

C Sharp, Unmanaged DLLs and Python Avoidance

First off, let me say that I'm not anti-python. Far from it. I think Python is a very interesting language and has a great deal of use in game development.

However, trying to build visual tools for it sucks. There are some decent alternatives out there for GUI builders for python, like boa, but none of them have the level of ease of use as Dev Studio. And I've never been sold on QT, especially the licensing agreement that they've created for us windows users (it's honestly like they're purposefully making it hard for us because we're windows users).

So I've been playing around with CSharp, for tool development. And I've got to say, I like it a lot. I'm still getting the language intrinsics down, but so far, it's been a nice, easy move.

However, a lot of our internal tools at HotHead are done using unmanaged DLLs and Swig bindings to Python. Again, this isn't bad. It's just different.

What I want to do is use the existing DLLs that our asset pipeline uses via Python bindings, but with CSharp. And it's relatively painless. So I thought I would share my experience here.

Please note, there isn't any work related code in this example. This was all done at home, on my own time, yadda yadda legal mumbo jumbo.

First off, I needed to create a DLL that I would use as my test bed. Using Dev Studio 2005, creating a DLL project automatically injects the appropriate Managed code bindings. I don't want that, so I had to prune them out. What I was left with was the following source file:

// This is a simple DLL that can be invoked from any language
// supporting standard DLL exports
#pragma warning(disable: 4996)

static char *buffer;

char* __stdcall DecorateString(unsigned int level, char* srcString)
{
   switch( level )
   {
      case 0:
         sprintf(buffer, "{Warn} %s\n", srcString);
         break;
      case 1:
         sprintf(buffer, "{Error} %s\n", srcString );
         break;
      default:
         sprintf(buffer, "{Undefined} %s\n", srcString );
         break;
   }
   return;
}

BOOL __stdcall DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID resvd)
{
   switch(dwReason)
   {
      case DLL_PROCESS_ATTACH:
         buffer = new char[1000];
         memset(buffer,0,1000);
         printf("CPPDLL loaded\n");
         return TRUE;
      case DLL_PROCESS_DETACH:
         delete [] buffer;
         printf("CPPDLL unloaded\n");
         return TRUE;
      default:
         return FALSE;
   }
}

It's nothing more than a DLL function that allows me to decorate a string with either a '{Warn}' or '{Error}' string, depending on the value passed in on the first argument. This could have done other fancy things, like colour coded the output, but you get the idea.

Additionally, I'm going to need a module definition file for this project, defining the exported functions. It looks like this:

LIBRARY "CPPDLL"
EXPORTS
   DecorateString @1
   DllMain @2

Finally, I need a CSharp application that uses this. I'm essentially going to create a default CSharp project and add some small bits of code to it. I won't go into the details of creating the form, since all I did was run the default project wizard. The code that actually allows me to do the binding to the dll file looks like this:

using System;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Windows.Forms;

namespace cppdlluser
{
   static class Program
   {
      [DllImport("cppdll.dll")]
      [return:MarshalAs(UnmanagedType.LPStr)]

      public static extern String DecorateString(int level, String msg);

      ///  The main entry point for the application.
      ///  [STAThread]
      static void Main()
      {
         Console.WriteLine(DecorateString(0, "This is a warning."));
         Console.WriteLine(DecorateString(1, "This is an error"));
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         Application.Run(new Form1());
      }
   }
}

The form that is created doesn't do anything, but the output spew in the debug console shows the following:

   The thread 0x8c4 has exited with code 0 (0x0).
   The thread 0xe64 has exited with code 0 (0x0).
   The thread 0xb70 has exited with code 0 (0x0).
   'cppdlluser.vshost.exe' (Managed): Loaded 'D:\development\CSharp\CPPDLLFromCSharp\cppdlluser\bin\Debug\cppdlluser.exe',     Symbols loaded.
   {Warn} This is a warning.
   {Error} This is an error
   CPPDLL loaded
   CPPDLL unloaded
   The thread 0xae8 has exited with code 0 (0x0).
   The thread 0xb54 has exited with code 0 (0x0).
   The thread 0x150 has exited with code 0 (0x0).

That's pretty much all there is to accessing functions from CSharp. I'm now off to try this using some of our production tool dlls. More on that later.

Tuesday, January 30, 2007

Python and OpenGL

So, I've just spent a good piece of today trying to get Python and OpenGL to work (stuff I'm trying to do in order to prep myself for the new job). I'll blame it on my lack of experience in Python, but man oh man, it wasn't an easy deal.



1. So, I grab what I think is the right download and follow the instructions given on the site. I then run the test apps. No dice.

2. I think "OK, it must be me, missing something", so I go digging around trying to find any information on what it might be. No dice there either.



I finally find the 'easy install' utility from PEAK and eventually I find that there is a difference between the OpenGL bindings and the pyOpenGL util (that I've been using). The difference being is that the OpenGL version WORKS.



However, on the plus side, I also managed to get wxPython installed and working as well.



*-----------edit-------------------------*

So, after a bit of digging, I figured out what it was. Both versions of the OpenGL bindings use GLUT. This isn't a bad thing (well, it could be considered a bad thing, but I digress) if you install the glut32.dll file into your python's DLL folder, it doesn't work. It must reside in the system32 folder. Not sure who to blame on that one ... I'd like to blame Python for it, but I'm not sure I could realistically do that.



Tuesday, January 23, 2007

Personal Update

I'm now in-between jobs. Today was my last day at Radical Entertainment.



I feel good about this. I have a fairly good feeling about where I'm going next.



I'll post more as the situation progresses.

Wednesday, January 10, 2007

More Free Stuff

I like vi. And vim, too. But somedays, I like my editor to be a little more ... friendly. But I still like it to be context sensitive, colour coded and all the jazzy neat stuff that all the other programmers rant and rave about in their editors. So, I was quite happy to find Notepad++, a sourceforge project. It's quite nice, does everything I want it to do and it's free. So it's good for all my lua editing work. Edit: And it's also based on the Scite text editor engine. I'm a fan of Scite, but Notepad++ adds a nice polish on top of it. It's fairly lightweight, so go on and give it a try: Notepad++