Wednesday, October 26, 2011

Rectangle.ReallyContains()

So I just wrote an extension method, Rectangle.ReallyContains(Point p).
Seems the XNA folks and I disagree on what Contains() really means. For example, let's say a rectangle has a left value of 0, a top value of 0, a right value of 5, and a bottom value of 5.
To me, the corners of this rectangle are as follows: (0,0), (0,5), (5,5), (5,0).
So then, rectangle.Contains(new Point(0,5)) should be true.
According to the XNA folks, this is not correct. From what I can tell, the bottom and right values are the numbers directly after the rectangle ends (so the rectangle goes from 0 to - but not including - 5).
I'm sure their way makes sense in a lot of scenarios. It doesn't make sense for mine, and I just spent a good 10 minutes figuring that out.
*rant finished*

Nate's Roguelike Game

So I recently rediscovered ADOM (http://www.adom.de/) and after playing it for a while (and dying many times) I've decided to create my own roguelike game.
The game is located here: http://natesroguelikegame.codeplex.com/.
There are no releases as yet - so far, the only thing working is random room generation.

Friday, September 30, 2011

Morgan wrote a program!

Thanks to Microsoft SmallBasic, I coached Morgan through writing her very first program today!
It was a lot of fun to show her a bit of the development world and explain a little bit about OOP.

AStar in Java.. and this WYSIWYG editor sucks

I'm on another game programming kick. This happens every several months or so, I play around with it for a while before getting lost in the enormity of it all and wandering away again.
This semester, I'm taking a programming class which uses Java. Not being at all familiar with Java, I was pleasantly surprised to discover that it is very similar to my main language, C#.
While investigating Java game programming I came across jMonkeyEngine (a Java 3d game engine), and while going through some tutorials on their site I came across an AStar tutorial.
I decided to gain some Java experience by implementing AStar in Java. I got a basic version working pretty quickly, but it wasn't taking the fastest route - it was taking 9 blocks to do what should only have taken 8.
I kept playing around with it and got it down to finding the fastest route, but it wasn't nearly as efficient as it could be (it kept searching blocks that it didn't need to). I fixed this by recording what iteration the algorithm was on when each block was discovered, then weighting my search to sort first by distance (asc), then by iteration (desc).
So, given the following blocks:

BlockDistance From TargetIteration
1101
3102
2201

the old version would pick either block 1 or block 3 when searching; the new version would always pick block 3. Anyways, the end result is that the path my program finds is identical to the one in the tutorial:

Not really a big accomplishment, but it's exciting for me, so I figured I'd post it.


On a side note, I just changed the font to Arial then went back to the HTML and ugh! It took my nice simple text and added a span on every line with inline styles all over the place. Blechh.


Download Sample (Open the HTML page)
Download Source Code (Netbeans project)

Thursday, December 24, 2009

My Fair Lady (Morgan's Song)

December '08

My fair lady looks at me
My breath is swept away
Lost in her eyes, drowning in them
I'm mesmerized by her gaze.

My fair lady smiles at me
Like the sun in the spring
I can't resist the curve of her lips
I smile back helplessly.

My fair lady sings to me
Her voice so sweet to hear
So soft, so pure, it rushes o'er me
And drives away all my cares.

My fair lady comes to me
And 'tis my joy to tell
With her in my arms and God by my side
I'll ne'er need anything else.

My fair lady loves me
And I love her, you see.
The queen of my heart, forevermore -
She's my fair lady.

Tuesday, December 8, 2009

Just a quickie..

Some good news, and some bad news.

The bad: my iPod went through the washer AND spent 7 minutes in the dryer in this past weekend.
The good: I pulled it out and stuffed it into a bowl of rice for a day, and it works fine.

The bad: My PC's 550 watt power supply is dying due to a swollen capacitor.
The good: I found a good 600 watt power supply on Newegg for only $49.99, with free 3 day shipping.

Thursday, September 24, 2009


I'll start things off with something good - the food I ate last night. I scrambled eggs in soy milk, and stuck 'em in a wrap with tomatoes, spinach, black olives, and cottage cheese. It was quite delicious.

I decided to try out soy milk as I feel that I currently have too much milk in my diet.. normally I have milk in at least two meals a day in order to get a good enough fat and protein.
I certainly don't plan on eliminating milk, as I enjoy the taste far too much, but cutting back seems like a good idea.

Tonight's meal was good as well, but nearly as delicious - I made cream of wheat with soy milk and added a little real milk once I was done cooking it. The soy milk made it sweeter so I didn't need to add honey, and then the bit of milk I added gave it the proper taste.

I spoke with my Principles of Management professor tonight about my test. I actually wrote down my student ID wrong (I put "592" in one spot instead of "152". I can't understand how I messed that up as I remember thinking it as "152" right before I filled out the scantron sheet. Anyways, I got a 19 out of 20 on the exam, plus 1 bonus point, so I would have had 20 out of 20, but I'm getting docked a point for messing up my ID number, so it's back to 19. *sigh*
The worst part was that I had to wait in line forever to see him. He's an extremely talkative old fellow (he spent 15 minutes before the exam telling us how to fill out the scantron - perhaps I can blame my mess-up on the fact that he bored me to death - or not..) and there were eight other people who also needed to see him.

Since they all had places to go afterward, and I didn't, I let them all go first. It should've been fairly quick (go into the office, see the grade, and leave) but the professor spent at least 10 minutes talking to each person, mostly lecturing them on studying, and I myself had to wait at least 5 minutes after he told me I was done because he was complaining about other students.

By the time I left it was dark, but I was in a mood to play so I practiced parkour at one of the entrances to the College of Business, then performed a Passe Muraille (vertical wall run) and got on top of the roof above my classroom. I was up there last week, it's kinda cool but not too exciting since there's no place to go from there but back down.

I went back and did some more parkour, mostly speed vaults and monkey vaults, with some lazy vaults, wall runs, and rolls mixed in. I had a couple of people stop and watch me when I was doing rolls (I was dropping about 4 feet and rolling, really no big deal) and one guy came up and asked me if I was practicing for skateboarding. I told him a little about parkour and emphasized that I was being careful, and then he stated that he wanted to make sure I wasn't going to be breaking any bones, and left.

When I got home I performed several kong vaults on the picnic tables shown in the video I posted on facebook a while back. It's gotten so much easier to do them than when I started; I think I can definitely thank my weight bench for that.

I'm also back working on computer game programming (2D right now, eventually hopefully 3D). It's hard to find time to work on it though.
I'm very glad I only went with two classes this semester. Between that, working full-time, excercising, and cooking my meals, I have very little personal time anymore.