14 May 2007

Title says it all. Pictures of walls.

Man some of these are funny.

Great content, amusing presentation, and occasional irony. Nothing quite like the venting of profound, repressed, anonymous vandals.

Posted on Monday, May 14, 2007 by David Campey

No comments

08 May 2007

TeamPlain has a goto work-item search that opens up workitems, oddly enough. I wanted to use the Firefox search box to fire this off.

Using the guide: Creating OpenSearch plug-ins for Firefox, I started putting together an XML OpenSearch description in notepad.

Needing an icon, I Gimped out the logo from the TeamPlain site, took it past the data: URI kitchen and popped it in.


Okay, so it's fugly, but it doesn't look too bad on the search bar.

A glance at the OpenSearch Specification provided final tips when deciding what data should go where. Now I had an XML file and needed someway to consume it

I tried installing the OpenSearch plug-in. I used the Error Console in Firefox, running the command window.external.AddSearchProvider(engineURL); using a file:/// URI for the engineURL, but kept getting a URL formatting error.

Error: Invalid argument passed to 
Unsupported search engine
Source File: file:///C:/Program%20Files/Gran%20Paradiso
Line: 114

Initially I thought this was due to the URL in the XML definition file, so I hacked around with that for a bit, then when that yielded no fruit, I extended the error message in the mentioned .js to include the invalid URL. This was the URL to the XML doc, not the search URL inside the XML. Turns out the URL check in the .js that was throwing the exception was only regexing https?|ftp, so needed a |file appended.

Now that Firefox was playing nicely with the XML, it was happy to load it up and prompt me to install it.

And it worked!

Final code: (adjust search URL to your liking)

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
<ShortName>TeamPlain Item</ShortName>
<Description>Load items from local TeamPlain</Description>
<Image width="16"height="16">
<Url type="text/html" method="GET"
template="http://05rnb-dev02:8090/workitem.aspx?id={searchTerms}" />

Posted on Tuesday, May 08, 2007 by David Campey


03 May 2007

So my screen went on the blink; more like the scramble. It was very upsetting, and it carried on like this for a few weeks. I used an external monitor and sometimes the regular screen would work. It was very unpredictable and would break without any cause, which frustrated the hell out of me.

Eventually while sitting in a friend's loungue I decided I really just had to see my screen. So I grappled with her rather useless screwdrivers and took out the retaining screws for the keyboard. After this was done I flipped the keyboard open, gave the internal screen connector a poke and turned it on.

And it worked. Just like that. And it's been working ever since.

Posted on Thursday, May 03, 2007 by David Campey

No comments

So, I went to the 'My Coke Fest' in Joburg. It was pretty cool. Hoobastank rocked ;) their lead singer looked like he couldn't have been more than 20; turns out the whole band is over 30 -- there's hope for us yet.

The picture (left) is of Hoobastank, with their lead singer standing on his box -- he was so tiny. Apparently he's Incubus' brother, which is kinda cool. They played some Bon Jovi and AC-DC to warm the crowd up for their no. 1 track, "The Reason". It was unexpected to hear an international act covering, but they pulled it off with style. Definitely the high-point of the 12-hour concert for me.

Posted on Thursday, May 03, 2007 by David Campey

No comments

Not only is Rocket Commander a pretty cool looking (but rather boring) MDX game with publicly available source, it turns out they've done a series of 10 30-minute video tutorials on the making of the game. Sweet.

Posted on Thursday, May 03, 2007 by David Campey

No comments

02 May 2007

So, I wanted to add substance to my craft. This was quite easy. I rearranged the points in the VertexBuffer into a list describing a triangle fan and fiddled to get that to work.

pointList_VB = new VertexBuffer(typeof(CustomVertex.PositionColored),
12, device,
Usage.Dynamic | Usage.WriteOnly,

CustomVertex.PositionColored[] verts = new CustomVertex.PositionColored[12];

// Triangle #1

verts[0].Position = new Vector3(0.0f, 0.5f, 0.0f);
verts[0].Color = Color.Blue.ToArgb();

verts[1].Position = new Vector3(0.5f, -0.2f, 0.0f);
verts[1].Color = Color.Green.ToArgb();

verts[2].Position = new Vector3(0.0f, 0.0f, 0.2f);
verts[2].Color = Color.Orange.ToArgb();

verts[3].Position = new Vector3(-0.5f, -0.2f, 0.0f);
verts[3].Color = Color.Red.ToArgb();

verts[4].Position = new Vector3(0.0f, 0.0f, -0.2f);
verts[4].Color = Color.Yellow.ToArgb();

verts[5].Position = new Vector3(0.5f, -0.2f, 0.0f);
verts[5].Color = Color.Green.ToArgb();

Yawn. Then I appended some points to that list for a triangle list to close off the object.

verts[6].Position = new Vector3(-0.5f, -0.2f, 0.0f);
verts[6].Color = Color.Red.ToArgb();

verts[7].Position = new Vector3(0.5f, -0.2f, 0.0f);
verts[7].Color = Color.Green.ToArgb();

verts[8].Position = new Vector3(0.0f, 0.0f, -0.2f);
verts[8].Color = Color.Yellow.ToArgb();

verts[9].Position = new Vector3(-0.5f, -0.2f, 0.0f);
verts[9].Color = Color.Red.ToArgb();

verts[10].Position = new Vector3(0.5f, -0.2f, 0.0f);
verts[10].Color = Color.Green.ToArgb();

verts[11].Position = new Vector3(0.0f, 0.0f, 0.2f);
verts[11].Color = Color.Orange.ToArgb();

pointList_VB.SetData(verts, 0, LockFlags.None);

And then drawing it with indexed calls to my VB stream as follows.

d3dDevice.SetStreamSource(0, pointList_VB, 0);
d3dDevice.DrawPrimitives(PrimitiveType.PointList, 0, 7);
d3dDevice.Transform.World = Matrix.Multiply(
Matrix.RotationYawPitchRoll(Geometry.DegreeToRadian(p1.Rotation.X), Geometry.DegreeToRadian(p1.Rotation.Y), Geometry.DegreeToRadian(p1.Rotation.Z)),
Matrix.Translation(p1.Position.X, p1.Position.Y, 20.0f)
d3dDevice.DrawPrimitives(PrimitiveType.TriangleFan, 0, 5);
d3dDevice.DrawPrimitives(PrimitiveType.TriangleList, 6, 11);

Drawing it revealed to me that I'd got up & down confused on the y-rotation.. so after fixing that it was all solid.

And it looks something like this. (from a few viewpoints)

Really has to be seen in motion for full effect.

Posted on Wednesday, May 02, 2007 by David Campey

No comments

So, I had collected a lovely bunch of variables to track the position of the craft, looking something like this: (gotta love having your dev history in an SVN repo)
        private Vector3 p1rot;
private Vector3 p1rotInput;
private float p1rotForce;
public Vector3 Player1Rotation
get { return p1rot; }
set { p1rot = value; }
private Vector2 p1;
public Vector2 Player1Location
get { return p1; }
set { p1 = value; }
private Vector2 p1force;
private Vector2 p1spring;
private Vector2 p1grav;

And the time had come to move it out into an object. Which ended up looking like this:

class Player
private Vector2 _position;
private Vector2 _force;
private Vector3 _rotation;
private Vector3 _rotationInput;
private float _thrust;
private float _rotationForce;

public Vector2 Position
get { return _position; }
set { _position = value; }

.. blah blah properties. Thankfully we can use CTRL-R,E in Visual Studio to make a private variable into a public property; no mess, no fuss. There was also dome debate as to where to put the public properties w.r.t. their privates, I went with Turner and used the C++ style approach.

And I even gave the object its very own method to update it's internals. Lucky thing.

public void HandleInput(float dt)
{ ..blah.. }

This also meant that I can now make my property grid show only properties of Player p1.

Which is a lot more useful.

Also evident is the pretty point field I forgot to blog about; this is just a bunch of for loops adding the gravity vector at a point in the grid to the vector to that point.. the result is a point distorted by gravity.

Posted on Wednesday, May 02, 2007 by David Campey

No comments

01 May 2007

So, I demoed my game on battery power.. and it sucked. Interestingly whenever windows showed a tooltip, the game ran at full pelt.. something fishy there. But anyway, I introduced a Δt (delta t for the unicode (or greek) unaware) into my calculations. The first stumbling block was that I was using the tick counter, which sucks a bit. The thing is, even though it has damn good accuracy, it is only updated every now and then. Which is a bit odd. I managed to hack it into working by doing the following:

private void Physics()
    while (System.DateTime.Now.Ticks == Tick) { }
    //time interval
    long thisTick = System.DateTime.Now.Ticks;
    float dt = (Tick - thisTick) / 100000.0f;
    Tick = thisTick;
But that really feels dirty. All that hanging around waiting for the tick. - Spoon! So, anyways. After a bit of ferreting, I found the Coding4Fun: Beginning Game Development article I'd been reading, which contains a section "All about timers". In summary, I grabbed the dxmutmisc.cs file from the sample code (in DirectX SDK\Samples\Managed\Common), commented out everything but NativeMethods and FrameworkTimer, called FrameworkTimer.Start() before starting the Main loop, then did
private void Physics()
    dt = (float)(FrameworkTimer.GetElapsedTime()*1000);
to get the time interval since the last physics call. The *1000 is just to get the number into something I could count on my fingers-and-toes. And, with a little tweaking of cosmological constants, all was working again.

Posted on Tuesday, May 01, 2007 by David Campey

No comments