ajh1138

Archive for July, 2008

What I Learned Today – 30july2008

In Programming, What I Learned Today on July 30, 2008 at 7:27 pm
  • A LinkButton in ASP.Net has both an OnClick event and an OnCommand event.  The OnClick event expects your typical EventArgs, while the OnCommand event can receive CommandEventArgs.  I was about to go nuts trying to figure out how to convince my app to use CommandEventArgs in a regular OnClick event!  I was like “If I can use CommandName and CommandArgument in my LinkButton tag, HOW THE HELL am I supposed to get them fed into the click event!!?!?!”  Well, now I know.
  • If you’re using a GridView to display a list of items, you can use Container.DataItem.Index to display the items’ index in the collection.  It probably works with other things like DataGrid, etc.  You can also use it as an argument, thus: <asp:LinkButton … CommandArgument=’<%# Container.DataItem.Index %>’ />  – remember that it’ll come across as a string or object in the argument, though.  Just do an int.Parse() or whatever.

My nine-year-old outproduces me.

In Uncategorized on July 29, 2008 at 3:48 pm

My boy Max has posted his Flash version of the Spore Creature Creator for people who can’t run the real thing.  It’s really, really cute and I’m amazed as his technical prowess.

http://www.carrotandkaret.com-a.googlepages.com/max%27sblog


A Change in Direction

In Uncategorized on July 14, 2008 at 3:57 am

I’m really damned bored with the game as it is right now.  I’m not going to finish it just to finish it.  In its current state, it would be an exercise in programming tedium.  It’s time to bring in the creative big guns: my kids.

I was thinking about making it the same sort of game, but more action-focused, and with the boys (9 and 7 year-olds) doing the art work.  Max came up with a great name – “Space Drawn”.  We might put it on a notebook paper background (but that’s been done before…we’ll see).

I also want to come up with some unique angles on the game play.  The mechanics of the thing needs to be new and different.

Stop with the Silverlight 1.0, already!

In Uncategorized on July 14, 2008 at 3:10 am

I have an RSS feed from Silverlight.net that supposedly lets me in on the latest news, etc. about Silverlight.  A couple of days ago, this gem popped up: “lynda.com Silverlight 1.0 Essential Training”.  (Am I going to link to it?  No.)

Why?  Oh, why do we have Silverlight 1.0 tutorials making the news?  Why are people posting new ones?  Why are people posting old 1.0 tutorials they’ve just found?  Silverlight 1.0 wasn’t even a commercially viable product!  Silverlight 1.0 skills will never be sought after!  Well, barring self-fulfilling prophecy, anyway.  I mean, if the net keeps getting cluttered with 1.0 crap, guess what everybody’s going to know?

I think in the interest of getting Silverlight (1.0, or 2.0 beta 2, or 3.7 rc2, or what the hell ever) off the ground, Microsoft should PURGE its websites of SL 1.0 material.  I realize that some of it is pertainent, namely the XAML stuff…but the rest of it is going to do nothing but confuse the hell out of people just getting into it.  It’s not to late to nip the 1.0 in the bud before it pollutes everything.

I realize that there have been oodles of tutorials, videos, blah blah made about Silverlight 1.0.  I’m sorry, but it needs to go.  Much like we let go of phrenology as barking up the wrong tree, so must we do away with SL 1.0.

Now if you’ll excuse me, I need to figure out why my SL 2b2 project has people thinking is SL 2b1…

“New Tab” Syndrome

In Uncategorized on July 11, 2008 at 8:36 pm

When I’m browsing, I open almost everything in a new tab.  I used to open stuff in a new window, but now with the incredible advancements made in the areas of Multiple Document Interface as Applied to a Web Browser (after only 10 years or so of web browsers not having the capability), I end up having about 7-10 tabs open at any given time.  I just seem to never want to close the originating page until I’m absolutely done with it.

This, of course, can lead to memory issues – and I’m not talking just about RAM.  But RAM is an important consideration when multi-tabbin’ it.  One of the primary reasons I use FlashBlock is because during any given browsing session I would have so much Flash going on that it would crash my browser.

MaxiVista: Streamlining the viewer laptop

In Uncategorized on July 11, 2008 at 8:14 pm

MaxiVista has turned out to be one of the most useful programs I’ve ever installed.  It can turn an old laptop into a much-needed extra monitor for your main computer, and it’ll let you remotely control a computer as well – you can just mouse right over to the other machine’s screen as if it were part of your desktop.  It shares the clipboard with the other machine, too.  Sweet.

I scrounged an old, clunky Toshiba Satellite Pro at work and put it to use as a 3rd monitor there (along with my 19″ LCD I brought from home).  What has bugged me for a while was that the hard drive would tick every few seconds.  So I did a little investigating using FileMon and such and found some old apps hanging around.  Deleted.

I’d like to nuke’n'pave it and put a lean install of XP on it.  Right now it has Windows Server 2003, and even though I’ve disabled just about everything I can, I can’t help but think that there are still miscellaneous server-y type processes lurking in the background.  I even took out the CD-ROM drive since it showed up in the “safely remove hardware” list.

I’m going to do a little investigating this weekend to see which operating system (XP or Server 2003) can run the leanest.  Unfortunately, Win9x variants are out of the question.  Vista, I’m thinking, can’t even be considered since it’s notoriously resource-hoggish.  I’m not going to look at Win2k, either, since XP and 2003 are refinements.  So it’s not going to be completely scientific or all-inclusive (i can’t use any *nix variants, for example).

Ships

In Uncategorized on July 9, 2008 at 6:25 am

I’ve added ships to the game.  They don’t do much yet, but they appear in-world and on radar.  I changed the player’s ship to something I whipped up quick to look like a small shuttle; a starter ship.

I need to flesh out the Ship class so it has all the necessary properties and behaviors I’ll need…type, image used, armament, cargo, faction/alignment, “hostile” flag, hit points, shields, speed, velocity, etc.

Locations and Radar

In Uncategorized on July 2, 2008 at 6:01 am

I added the locations (planets, moons, space stations, etc.) to the screen, and I’m about half done with the radar.  The max velocity has been cut from 20 to 10 px per frame.  It’s a bit easier to control.

I’m freekin’ thrilled about the radar.  I’ve been thinking about how that’s done in video games forever.  What I’m doing is scaling down the game world by a factor of 75…and that’s adjustable, of course.  I’ll have zoom in/out buttons on there pretty soon.  I stayed up a bit late to get the radar working, and it paid off.  It was the fulfillment of a lifelong dream when I pointed the ship toward a distant planet on the radar and saw it come into view on the main screen.

I need to learn how to use clipping in Silverlight to hide the radar blips that are outside the intended visible area.  I could turn them off manually, but that’s one more if statement to slow things down.  The way I’m doing the radar probably isn’t the most efficient anyway, but I’ll refactor it later.

The locations are stored in an XML file that has their coordinates, name of the corresponding image, and a brief description.  The same file contains the commodities I’ll use later in the game.

The consensus with amongst my work buds is that the steer-by-mouse needs to go, in favor of key controls.  I’m inclined to agree.

Latest version (a3) here.

Next steps:
- come up with a name
- make some graphics
- get the radar clipping done
- add some enemies to dispatch

Inertia fixed

In Uncategorized on July 1, 2008 at 5:24 am

Check out the latest version here.

After much thought and messing around, I realized that I needed to control the total velocity of the ship instead of trying to control the X and Y amounts separately.  So now I’m checking the velocity using Pythagoras’ handy theorem (a squared x b squared = c squared) and then scaling back the vector when it goes over the limit.

i still have some polishing to do, but here’s the code real quick…

double thrust = .27;

double velX = _playerVel.X;
double velY = _playerVel.Y;

double newX;
double newY;

double curRot = GetRotation();
pnl0.Text = “rot: ” + curRot;

Utils.CalculateMovement((int)curRot, thrust, out newX, out newY);

velX += newX;
velY += newY;

_playerVel = new Vector2D(velX, velY);

double veloc = Math.Sqrt(Math.Pow(_playerVel.X, 2) + Math.Pow(_playerVel.Y, 2));
pnl3.Text = “vel: ” + veloc;

double testVel = 20;

if (veloc > testVel)
{
double scale = testVel / veloc;
_playerVel.X = _playerVel.X * scale;
_playerVel.Y = _playerVel.Y * scale;
}

Now, fly around the galaxy yelling “Git some!  Git some!”  I’ll have something for you to shoot at pretty soon.