Wednesday, September 20, 2006

Goofing around with the XNA Framework

I had to send my laptop into Dell again for repairs since they screwed up the initial repair so I spent some mess around time on non-beatbox, non-holdem related stuff.

So I downloaded XNA framework and so far I'm really happy with how things are setup. The API is really solid and easy to use. I had everything downloaded, installed and a spinning cube with 360 controller support in about 3 hours. Some things I like a lot and are worth mentioning:

  • 360 controller support is awesome, no remapping wierd DINPUT Z-trigger or hats to in game actions. The game pad state that you read has members like Triggers.Left which is a floating point value. You can easily do things like Buttons.A == ButtonState.Pressed.
  • The Matrix object is very easy to use and has a bunch of very helpful static methods for getting various types of matrices.
  • C# is pretty fun to write game code in.
  • The framework is nice and lean and does things 'The Right Way', they don't eat all your CPU when you're running a basic idle loop or in the background.
  • All the heavy lifting is done in shaders via .fx files. This is very handy and works well with the VertexBuffer classes.


    I couldn't get stuff to work initially on WinXP 64bit edition until I found this post

I'll probably post some screenshots before I go back to regular stuff. I don't know how far down the XNA path I'm willing to go just yet.

Friday, September 15, 2006

Jeff Minter gets his llama print undies in a bunch

So it's been picked up on the indie gaming sites and beyond that Jeff Minter is working on a new game. I thought this was interesting in as much as the guy is an interesting character and I respect his seniority and work in the industry. Also, talking with some some other programmers around the office I heard some strange rumors when he was submitting early builds of neon to our group.

Rumor #1: There were some llamas that popped up and we made him take them out.
Rumor #2: There are still llama shapped buffers/backplanes used in the visualizer.

So tonight I followed a jump to his blog where he posted some test particle screenshots. These shots came out before the vids that clearly show he's doing a very tempest-like game. Now if you go and read the comments a fellow going by the name alanc5 asks him if he's just doing another tempest clone and Jeff flies off the handle. Alan has posted some retorts on his blog. I feel that Minter could have handled this much better than he did. Luckily nobody knows or cares about any of the stuff I'm working on so I will likely not have to prove that out ;)

Jeff is doing another tempest-y type thing which is boring but fine really yet he never did admit the guy called him out on it before he even showed off the game play. Alan might apparently have a history of goating Minter but at least he doesn't back down even when the whole yakyak forums come crashing down on him. I feel kinda bad for the guy.

Thursday, September 14, 2006

Holdem: UI bug fixes

Fixed a bunch of nagging UI bugs tonight. I'm still not totally happy with the fonts and some of the color blending. When you're a non-green background and you alpha blend a green menu it's a bit jarring. Even green on green is not very appealing.

At least on a green background it looks semi-decent. It looked better in 32bit color. I think that dithering to 12bit makes the colors harder to pick out. I 'skinnied' (if that's even a word) up the action menu which sacrificed the 'best hand' display and the bet ammount. That should make it more consistent with the other phone UI elements. The left action button is bound to the menu.



Career mode got some love. I fixed a bunch of character select bugs. But I think I'll the last glyph in the font should be swapped with a RUB button. Probably just a back arrow would be fine. The hiphen glyph is serving this purpose now.



I also fixed the career continue mode a bit. All menu animations have been cleaned up and are sliding in and out nice and smooth.

Wednesday, September 13, 2006

Funny quotes from IRC

There are a bunch of great IRC quotes on this bash.org. This one had me in stiches:

#349567 +(9050)- [X]

Rabidplaybunny87: Okay, so my neighbors officially hate me
GarbageStan23: why?
Rabidplaybunny87: Well, me, david and andrew were having a bonfire in the backyard, and we were making s'mores and all... and suddenly we here sirens, and see a firetruck turn into the street in front of us.
Rabidplaybunny87: So we all went running to see what was up, and our neigbor's house was on fire!
GarbageStan23: oh shit!
Rabidplaybunny87: Yeah, and when we got there, the wife was crying into her husbands arms, and we were just kinda standing there, and then she saw us, and then like for 10 seconds, gave us the dirtiest look ever
Rabidplaybunny87: Turns out, we were still holding our sticks with marshmallows on it, watching the fire....
Rabidplaybunny87: talk about bad timing...

Tuesday, September 12, 2006

Holdem: bugs, bugs, bugs

I've gotten a lot of bugs fixed in holdem in a short ammount of time. I have to rework the in-game overlay UI as it covers up important information right now. I'm considering cutting the in game AI chatter. I am reluctant to do it though because I think it breaths a lot of life into the game. One thing I was considering is still having an AI chat system but making it more event based. When an AI character has something important to say or a key event is triggered in career mode.

Sunday, September 10, 2006

Holdem: Nokia 6682 photo

This picture is of a pretty low quality. I'll just blame the camera.. the display on the phone is nice and makes the game look pretty sharp. I think I need to scale the fonts up a bit though as they seem a little on the small side.

Massimo says:
so what are you up to now? working on getting the animation running? Cuz I know what you're not doing :) you're not posting pictures of Hold'em running on your phone :)


Well somebody has to keep me honest.

Holdem is finally running, woot!

And it looks amazing! For the record Dragonfly by Lemon D was the song that was playing when the app actually started up and ran and the time is 3am. I have been pursuing this goal of having this game engine run on a symbian smart phone for some time now. I finally tracked down the finaly serious problem pretty much by accident.

The line that was crashing first was:

if(path.compare(rec->name, rec->namelen))

This looks totally innocent.. I'll just say right away that it wasn't any of the usual suspects. Keep in mind that this ran fine on other hardware architectures. The problem was actually memory alignment.

The records that are being referenced here are part of a block of index records stored in the resource file. I have a tool that transforms and packs files into a single file and creates one block of memory to be used as a searchable index. The structure in memory used to look like this:

struct RecordRef
{
uint32 offset;
uint16 nextrec;
uint16 namelen;
// char name[namelen + 1]
};

If I tried to access offset or nextrec and the field didn't lay on a 4 or 2 byte boundary respectively my application would crash. This kind of problems are pretty hard to track down without a debugger. I used loglines traced to a text file on the phones internal memory through multiple builds to track this down.

The new structure looks like this:

struct RecordRef
{
uint32 offset;
uint16 nextrec;
uint16 namelen;
uint16 padding;
uint16 reserved;
// char name[namelen + 1]
};

I calculate the padding when the records are built in memory and before they are stored into the resource file. When they load from the file they are all nicely aligned and the code that searches the index just has to take into account padding when doing any pointer/index math.

Seeing the title screen on my phone makes me very happy!

Saturday, September 09, 2006

Holdem: More progress

So the game is running on my phone and I'm getting closer to tracking down what is stopping the game from starting.

..\..\..\..\..\DEV\ZTEAM\HOLDEM\S60\SRC\Series60.cpp(220): Starting window session
..\..\..\..\..\DEV\ZTEAM\HOLDEM\S60\SRC\Series60.cpp(232): Setting up direct screen access
..\..\..\..\..\DEV\ZTEAM\HOLDEM\S60\SRC\Series60.cpp(236): Creating double buffered drawable
..\..\..\..\..\DEV\ZTEAM\HOLDEM\S60\SRC\Series60.cpp(270): Initializating game engine with data path: E:\System\Apps\Holdem\data
..\..\..\..\..\DEV\ZTEAM\CORE\SRC\Gameengine.cpp(56): GameEngine::initialize(): game engine data path: E:\System\Apps\Holdem\data
..\..\..\..\..\DEV\ZTEAM\CORE\SRC\Gamearchive.cpp(68): GRPIndex::_reserve(): reserving: 1409 bytes, buffer: 0x00000000
..\..\..\..\..\DEV\ZTEAM\CORE\SRC\Gamearchive.cpp(95): GRPIndex::_reserve(): finished, buffer: 0x004121c4
..\..\..\..\..\DEV\ZTEAM\CORE\SRC\Gamearchive.cpp(734): GRPFileSystem: loading file: default.ini, packfile: E:\System\Apps\Holdem\data.grp


Could be a few things right now but pretty promising that game engine startup has gotten this far. Now if I can get that config file to load it will be on like donkey kong.

Thursday, September 07, 2006

Beatbox: Sound is back

I got sound hooked up again, fixed texture binding/uploading and got the combo meter and song position indicator working again. Yeah it's still rough but it's coming along. There are some pretty big things to do still and I think I'm going to change gears back onto texas holdem to nail down my framebuffer initialization problems.

Since music and sound is at the core of the game I'm considering building a specialized sound library/sequencer for the game. It would use an existing format and tracker for the editor probably screamtracker3 since I'm most comfortable writing tracks in that. Right now I'm using fmod which actually allows you to get event callbacks from the sequence. I'll probably just play with that for now.

I wrote a really nice scene graph when I was on vacation in mexico so that eventually needs to make it into the gfxlib but it's a pretty big change at this point so I may put that off too..

Oh well, lots of stuff to put off per-the-usual. I really am trying to keep the tasks smaller and more achievable but at some point I know I need to make bigger bets to make sure the stuff can be finished, polished and pushed out the door.

Globals are still considered harmful to your health

Sometimes there are well defined technical reasons for this. Some people detest them because they have been told they are bad. Other more thoughtful people understand some of the serious problems that globals have. Many times in rapid prototyping (ala beatbox) or in general game dev people get a bit too global-happy and it can be a serious problem... I'll list a few of my main reasons for really not liking them:

  • Globals can hide bugs, if you don't name them intelligently they can be overriden by locally scoped variables.
  • Globals don't have well defined access patterns, anything in any thread can access them. This can make porting a single-threaded app to multi-core a super fun hairpulling exercise.
  • Globals enable sloppy coding and can ruin layering.
  • Globally defined classes don't have deterministic initialization order, you better not count on one class being ready before another one. Go for two-phase construction if you need a global class.

It's not all bad though:

  • Having your root system(s) as objects at global scope simplifies your life.
  • Pre/Static allocation is your friend. Many applications can be designed to require vary little dynamic allocation and this can really improve speed.
  • Sometimes when you're maintaining code it is less intrusive to add a global or static method then touch every method on down the call stack.

They're there for a reason. What's yours?

Tuesday, September 05, 2006

It's coming along



Well there is more or less something there now. It is actually playable, although not being able to see scores and combos is a bit of a drag. Also the thing is completely full of bugs. It has gotten a lot funner to work on now though. Much less doing the boring plumbing that runs the show and more doing the AI and gameplay that I enjoy.

Monday, September 04, 2006

Beatbox: A story



Okay well this isn't the sky falling but screenshots are so much fun, especially really dumb ones during development. What was at one point actually a fairly fun playable little game is currently a shadow of itself living on top of all new (actually rehashed I get to that in a minute) stuff.



Now I'll provide a little story about beatbox, mostly for my own benefit. About a year ago I was having a lot of trouble getting any coding done after our second kid came along. I still had time but I just couldn't really get myself motivated to do anything good. Discouragement mostly came from the fact that I didn't figure that I had time to really write anything of any good quality.

So I got this idea to just hack, not worry much about proper design or object orientation or really doing anything right at all. I wanted to get back to the root of what I loved, the thing that made me write reams of code in Jr and Sr High School. Just get something up and going no matter how sloppy or lame it was and have fun doing it. So I put some 3d graphics to music using glut, and it was a blast.

After awhile just doing different 3d scenes at different sample points in the song became a bit mundane for my own personal enjoyment so I decided to make the blocks fall down and controllable. And that's more or less how beatbox was born. I wanted to have poyupoyu style gameplay with my own individual twists because that was really what I wanted to play and I didn't have a poyupoyu game on hand to enjoy.

This whole time I was still hacking. The entire game logic was in poyu.cpp and the rendering was in render.cpp. It was a pretty mess. I copy-pasted chunks of code that I dragged in from all kinds of personal projects from as far back as 2002, yeah a glorius mess. At some point I just dropped the binaries in a folder and called it good. I realized this was a dead end and I was re-inventing and ruining all kinds of work I had already done for the past few years as well as writing some code that would never again be useful. So I made a big choice. I was going to take 5 years of code and make it into a set of consistent usable libraries and make all my games compile off of that. I knew this was a huge project but I decided that it would be fun and good for me.

So I've come to a summit of that work. I actually have the original beatbox code retrofit into the new set of libraries with a new resource system thrown in for good measure. It feels good but all I have to show for it is a white triangle on a grey background. At least I'm happy.

Beatbox: Was it.. nope

I thought I saw a triangle on the screen but it was just some wierd food stuff stuck to my laptop LCD. It really looked promising for a second or two. I'll post screenshots when there's blocks falling from the sky again. I had a really neat visual idea for the combo system the other night as I was falling asleep. We'll see how it pans out... but for now back to getting a triangle back onto the screen.

Sunday, September 03, 2006

Some things are running again


The UI widget test app is up and running again. This time using the final resource system from the game library. I took a screenshot to prove how unimpressive this actually is ;) This is some of that TDD stuff that I posted about earlier. There is a unit test framework (built using a command line system that is part of the game engine) for testing object models and what not but this is a simple test graphics app. It doesn't do anything besides create a view, add some UI components, test strings and setup the layout. This makes it really easy to get up and running fast and find a variety of little bugs.

Tuesday, August 29, 2006

Ich Pwne Newbs

Blogging is so advanced now it's going back to the future. Ol' E never sounded so good.

Monday, August 28, 2006

This is Hardcore

I was listening to pandora and it chose a very appropriate song. I had to look over my shoulder just to make sure.





PULP LYRICS

"This Is Hardcore"

You are hardcore, you make me hard.
You name the drama and I'll play the part.
It seems I saw you in some teenage wet dream.
I like your get up if you know what I mean.
I want it bad. I want it now.
Oh can't you see I'm ready now.
I've seen all the pictures,
I've studied them forever.
I wanna make a movie so let's star in it
together.
Don't make a move 'til I say, "Action."
Oh, here comes the Hardcore life.
Put your money where your mouth is tonight.
Leave your make-up on & I'll leave on the light.
Come over here babe & talk in the mic. Oh yeah I hear you now.
It's gonna be one hell of a night.
You can't be a spectator. Oh no.
You got to take these dreams & make them whole.
Oh this is Hardcore -
there is no way back for you.
Oh this is Hardcore -
this is me on top of you &
I can't believe that it took me this long. That it took me this long.

This is the eye of the storm.
It's what men in stained raincoats pay for but in here it is pure.
Yeah. This is the end of the line.
I've seen the storyline played out so many times before.
Oh that goes in there.
Then that goes in there.
Then that goes in there.
Then that goes in there. & then it's over. Oh, what a hell of a show
but what I want to know:
what exactly do you do for an encore? 'Cos this is Hardcore.

Beatbox: Track names

Mass and I had some good lunch game design conversation today. Made a stop by gamestop and bought 'Trauma Center: Under the Knife' for Nintendo DS. It's one of those titles you don't see that often although the counter guy said they got a restock of 2 copies so that may indicate that Atlus is responding to the demand. Speaking of hard to find (at least for me) DS titles that I got recently:

Bomberman DS
Pheonix Wright: Ace Attorney

The general lesson seems to be: if you hear a DS game is good and you see it, swoop it yo.

Oh back to the topic, so we're talking about beatbox which is my music based puzzle game I sent out to a few people and the tracks so far which are named:

I Was a Teenage Mecha (MkII)
Luxury Carpet Comparison (bitwise)
Siding is Exciting

I'm going for a bit of an abstract techno feel with these tracks but the names are inspired by local Seattle band Minus the Bear who have great song names such as:

Hey! Is that a Ninja up There?
Monkey!!!Knife!!!Fight!!!
Thanks for the Killer Game of Crisco® Twister
I Lost All My Money at the Cock Fights -

I mistakenly said one of their songs was 'Monkey Monkey!!!Knife!!!Knife!!!Knife!!!' and for that I'm sorry because I really think that is a much funnier title anyways ;)

And while I'm at it I might as well thank Ryan Blinsky for introducing Minus the Bear to me.. As well as tons of other awesome music.

On Hobby Coding: Test driven development

I always had a focus towards testing. Every major commercial project that I've worked I have been pretty good about writing some kind of developer facing test suite not always before the meat of the code was written. What has really solidified the testing mentality for me was the last 2 or so years up until about a couple months ago I was an engineer completely focused on writing functional test code and stress simulations.

I took this job intentionally, not just because everyone I interviewed with completely impressed me technically but because I really wanted to stretch myself in this role. It has taught me a lot of new things about design and every day coding and it has really evolved my hobby coding as well. I don't write exclusively test oriented code any more but I'm even more sold than ever on the benefit of approaching things from a testability angle.

Wikipedia has a good definition of TDD. Your milage may very. Personally, I usually write the 'client' functionality test and then implement either a no-op interface for it at first or something very basic. If I'm working on something new and complicated I spend some time mulling it over and drawing pictures first. If it's adding some small functionality to existing I'll do the simplest implemention.

During the time I'm implementing I'm always looking for ways to collapse functionality (ie. refactor) or simplify things. A lot of times you find issues before hand as you're writing the test, things you didn't think of when designing. Here's some warning signs you'll likely see:
  • This code is totally not testable..
  • If I could only get at that lower level thing, this would go way faster
  • If I shared that dohicky than I only need to write n/2 lines of test code
  • This is going to take some serious time.. do I don't really need this?

These are all really net-positive things to discover early on. Most importantly.. these things are discovered before you write 2k lines of dense game library code. There are some real challenges to be solved here that are going to make you a better designer and coder:

  • Proper layering of your code, decoupling and exposing multiple layers so they can be tested individually. This is a non-trivial design challenge to do correctly but done right is really great.
  • Cutting down uneccessary feature-creep when you really actually don't need something. When there is nothing left to remove you have the perfect product ;)

And at the end of the day, if you did a half-decent job you have a properly designed testable system that you can easily make changes to because you have a proper test framework for it. There's more here but I'll save it for other posts. Less theory more practice.

On Hobby Coding: Prelude

Occassionally I have something I want to blog about coding-wise but to explore the topic would require a big post. Usually I can't find the time to write something of this length at any one time. As a result I have a few unposted articles that I figured I would work on in pieces and post as a big article. Of course this never happens. The articles become big enough that just editing them becomes a time sink. I'm more into coding or gaming than writing usually.

So this started again. I've been doing some hobby coding since I finished saint's row and dead rising (not the good ending yet though) and wanted to get some ideas out about my recent methods.

I sat down to start writing about TDD (test driven development) and decided I needed a new approach. So here it is. This is a blog after all so I'll try to post little snippets on the topic under an umbrella subject and see if that motivates me better to get the ideas into writing.

It could work.

Tuesday, August 15, 2006

Interesting hoax

This got through the gmail spam filter:

James Ransome
More options Aug 8



The Heritage Trust Group,
8,Caledonia Place,
St Helier,
Jersey JE4 9YL
Channel Islands.
Warm greetings!
I am James Ransome, Senior Credit Officer, Heritage Trust Group. I am writing
following an opportunity in my office that will be of immense benefit to both
of us.
In my department we discovered the sum of £12.5 Million British Pounds
Sterling (Twelve Million Five Hundred Thousand British Pounds Sterling) in a
Trust Account that belongs to one of our foreign customers Late Mr. Morris
Thompson, an American who unfortunately lost his life in the plane crash of
Alaska Airlines Flight 261 which crashed on January 31 2000, including his
wife and only daughter. Please check the following website for further
reference:
http://www.cnn.com/2000/US/02/01/alaska.airlines.list/
Since his death, we have been expecting his next of kin or relation to come
over and claim his money because the Bank cannot release the funds unless
somebody applies for it as next of kin or relation to the deceased as
indicated in our financial guidelines.
Unfortunately we learnt that his supposed next of kin being his only daughter
died along with him in the plane crash leaving nobody with the knowledge of
these funds behind for the claim. It is therefore upon this discovery that two
other officials in this department and I decided to do business with you and
release the money to you as the next of kin or beneficiary of the funds for
safe keeping and subsequent disbursement since nobody is coming for it and we
do not want this money to go back into Government treasury as unclaimed bill.
We agreed that 20% of the funds would be for you as foreign partner, 10% would
be given to charity while the balance will be for my colleagues and I. We will
visit your country upon conclusion for the disbursement according to the
percentages indicated above once the funds are safely deposited in your
account. Please be honest with us as trust is our watchword in this
transaction.
As soon as you receive this email you should contact me by return email
whether or not you are willing to enter into this deal. In the event you are
not interested, I sincerely ask that you disregard this email and tell no one
about it. I hope you can be trusted in this regard.
Please, note that all necessary arrangements for the smooth release of these
funds to you have been finalized. We will discuss much in details when I do
receive your response via any of the contacts as given above.
Please in your response include your telephone and fax numbers for a better
communication between us to my email address : jamesransome@uk2.net
Yours truly,

James Ransome