Tuesday, January 23, 2007

Cheddar Roads

I was doing some einfall programming today but I got massively massively side tracked. I need to get some hosting for my portfolio, so I did that and since then I've been tinkering ever since. You can check it out at http://www.godpatterns.com/, though there's nothing much there at the moment.

I'm going to have cv as a subdomain but for some reason it's not working at the moment. I'll probably be moving this blog over. But it's not going to happen all at once. I mean I think I've been thinking of getting hosting for about a year now :D

Friday, January 19, 2007

Methods and dynamic casting in C#

I remember a month ago I was trying to do something similar with C++ and it doesn't work (suprise suprise :> ). I thought I'd see if it'd work in C# - and suprisingly it does. Ok, so what I am I babbling about?

Imagine you have an object Item and another object
StackableItem : Item
, that inherits from Item. Now imagine I have an array of Items. I can put Stackable items in here and I can put items in here, no problem. But when I come to use the array I don't know which are items and which are stackable items. To find out which are which I might use a dynamic cast, or in C# you can use method overloading and the program will do the dynamic cast for you (I assume it does that anyway).

public void AddItem(Item item)


    Console.WriteLine("Not so clever");



/// <summary>

/// Is C# clever enough to go to the correct one?

/// </summary>

/// <param name="item"></param>

public void AddItem(StackableItem item)


    Console.WriteLine("Very clever");


So in the above if I have:

Item i = new StackableItem();

The second function will be called. Neat right? Yes, yes it is.

Thursday, January 18, 2007

More news as it happens

Now you can open the chest and there are coins inside! Yay! Then when you open the chest again, they've gone. (You've taken them.)

The code's quite nice but still needs generalizing. (Currently there's no way for stackable items, such as coins to be combined).

The "you've found coins" message actually appears in the center of the screen, in the screenshot it looks a little lop sided. At some point I want to upload a demo, as this was my modest goal. Open and chest get money. The character animation's still missing but I'm quite happy with it.

The inventory system is not going to be so crude for ever, I'd quite like to make it a little more Ultima like. The next stage is cleaning up the code and dealing with little problems. Then I want to make everything that's currently hard coded to be controlled by Lua scripts and setup text files. Then I think I'll pull in a load more of the Einfall stuff. A lot of the map code could do with being pulled over and perhaps the title screens and stuff.

Today though I really should get back to preparing for my exams.

Oh also I want to give the chest a key, because at that point it's basically a very very poor game. But at least it's a game :D

Wednesday, January 17, 2007

Why is it so easy to work on my projects when I should be revising.

Now when you open the chest, the game tells you that you've received 29 gold coins. This is a lie, it will also tell you this if you close the chest the open it again.

To me though, it feels like progress!

I rejigged my mouse user interface, so it uses a state system (covered in one of the programming for monkeys tutorials). There's a message state that currently displays a label. At some point I'm hoping to upgrade this to a text box.

Also I'm hoping to actual give the player something, move some bytes around. No matter what the message might say, you're never actually given any gold coins :(. I also want to empty the chest. And perhaps even fade out the message. Yay me.

Tuesday, January 16, 2007

The mojito is a descendant of the Draquecito, named after Sir Francis Drake and said to be his favorite drink before pirate battles

My chest is opening and shutting, and I want to give the character *prizes!*. First in a crude, text box manner. You've found blah, blah in a text box.

To do that I need to know how big text is. Will the text fit in the box, how big should the box be, what are my options for decorating the box and so on.

This leads to a bit of problem (a problem I vaguely remember having before), that is that using DirectX3D.Font, there's no way to tell how big the fonts going to be. . .

. . . not in early versions of DirectX anyway. I'm sure I was quite current, but I downloaded the December 2006 SDK, and suddenly Font aquired a measure string property. It's a reasonably strange (stupid?) function.

font.MeasureString(null, text, Microsoft.DirectX.Direct3D.DrawTextFormat.None, Colour.White);

That's right, you have to give a colour! Because we all know how a colour can change the size of a given text string. Also the first argument is a sprite, which is also not needed.

This is my very crappy label. At the moment it's a little hard coded. My batcher doesn't do non-textured quads. So hmmmmmmm. I might make a colour quad. I think batching the GUI would be pretty awkard too, but we'll see.

Monday, January 15, 2007

Irritated like the tail of a horse

Maybe one day, I assume it will be in the far distance, I'll stop writing pieces of timing code because all my timing woes will be completed once and for all. Until that day:

class TimeEvent


    double waitTime;

    double timeCount;

    bool set = false;


    public TimeEvent(double waitTime)


        this.waitTime = waitTime;



    public double WaitTime




            return waitTime;





            waitTime = value;




    public void Set(double elapsedTime)


        set = true;

        timeCount = 0;



    public void Process(double elapsedTime)




            timeCount += elapsedTime;


            if(timeCount > waitTime)


                set = false;





    public bool CheckTimeUp()


        return !set;



Anyway I had a problem with performing actions in the game - you could do them two fast. You could open and shut the chest many many times, when you just wanted to open it. So in the mouse user interface I've a delay time event of 1ms, so there's 1ms wait before you perform another event. This works rather nicely.

...of course I should really be revising, but that suddenly make my game projects seem far far more enticing.

(Updated so less illogical!)

Tuesday, January 09, 2007

The most uncommon of uncommon vernaculars

This http://tlundmark.blogspot.com/2006/11/identities-of-industry.html is a really cool list of all the key game's industry key players with pictures and quotes. It's very a pleasant way to spend a few minutes. It's a little disturbing how unhealthy most of them appear.

Einfall will probably fall once again to the back burner as University work starts to appear thick and fast.

Saturday, January 06, 2007

The true meaning of Christmas

It's been some time since the last update, I've been taking things nice and easy over Christmas and playing a few games. I'm going back to University tomorrow. There I'll be working, at some point I may find myself free to work on my coursework again. Once the camera works correctly and I'm happy - it's something I'd quite like to make avaliable for download.

Dirge of Cerebus

I completed this game for the Playstation 2 over the break, and I enjoyed it a lot. The reviews seemed to have been on the whole quite harsh, though I'm not sure why. I hated Golden Eye on N64 I really didn't get it, Doom, Quake, Ulitma Underworld where all far far better (in my opinion). I hated aiming with the little N64 thumb stick and it didn't really grip me. Same for Halo, either one, they're just FPS games, same old same old. So it suprised me to find that I really enjoyed this game which is basically an FPS. The graphics are excellent as is the engine they sit upon, very smooth and I felt far more in control that in any previous console FPS games. Usually I hate the control schemes of any 3d game, it's too much for me but this just clicked. Basically you progress through the game being bad ass and sharp shooting the various bad guys that coming running at you.

It's not all good. While the story is the usual semi-coherent nonsense that we all know and love there's a few grammar and spelling mistakes. For instance you can pick up "Poitons" and at some point a character says "I could care less" instead of "I couldn't care less" and various other minor irks. I'd like more bad guys that run at me in big waves so I can pick them off with the gun. The cutscene-gameplay ratio is a little heavy on the cutscenes. The AI can be quite stupid and sit there doing nothing. This doesn't bother me too much because I tend to assume I've been super steathly and can now pick them off at my pleasure. Despite these flaws I found the game a great deal of fun.

The Dreamcast

I mentioned to my brother I fancied one of these and on Christmas I got one which was very nice. They where a very cool machine more powerful than the Playstation but somewhat behind the Playstation 2. Recently I've been playing Rez, a panzer dragon like shooter but where all the event's are linked to music and the graphics are quite vector based and surreal.

The other game that I've only briefly had a look at is Shenmue, which seems very interesting. I've always been curious about this game because it seemed to be a little similar to Ultima 7, both of the game worlds where realized in great detail.

Game Development

Just before Christmas I had a mouse controlled character walking over a number of maps. There's still no animation. My modest goal is to have a chest, you can open the chest, get some reward then the game ends. I've got items kind of working, as you can see there's a chest in the screen shot. If you pass the mouse across it, the words "Mysterious Chest" appear next to the mouse cursor. Currently you can walk under the chest, which I intend to fix today.

Despite the goal being quite modest there's a lot that needs doing. I've started a new Gui library because my previous one is a godawful mess. It's the first Gui stuff I'd ever written and it doesn't handle texture resources very well. I only wrote enough code to get labels working.

After that goal is reached, I'll have something a little like a game. Then I'll neaten up the code where required. Then make all the details dependant on scripts. At this point it's ready to take on a lot of the code from my main Einfall project. It's also at a good point to create other tile based games.