Monday, May 14, 2007

Minor Addition

Busy week at work and Mother's Day kept me away but I managed to get one form done.


Tell the AA guns to aim low and hit the torpedo bombers or tell the fighters to take them while the AA goes for the bombers. Or split the difference and hope they don't interfere with each other.

Next up: try to get an air fleet to attack a naval fleet.

Sunday, May 06, 2007

Scout Form: Not the Bare Minimum Edition

OK, now that I got some sleep, I updated the form. Now looks slightly better:




For implicity I decided to make the areas the scout can search match clock directions.

When you hover over a direction dot that ugle highlight with the temp art appears. When you click the dot, a text label tells you what direction it is, so you know you clicked it. As you can see, I clicked the dot at the 2 o'clock position.

Added some Save and Cancel buttons, too.

Bare Minimum Accomplished I Can Actually Show...

The beginnings of the form to tell scouts which way to go. Opened from the main form with a button labeled "Scout." I am not sure to send single planes or entire squadrons out. Probably an entire squadron at a time for now. No need to get fancy this early in the game.



As you can see I don't even have placeholders for the direction arrows. I am thinking about adding more directions around the middle (the fleet/carriers). The scouting units sent out are not armed with bombs or torpedos so they get launched right away. My plan is for arming taking time to happen.

It was suggested to me to make it so players want to use ground based planes for scouting as often as possible. I agreed. Ever see the movie Midway? There's a scene where they show an Allied map with a red 180 degree arc around Midway Island patrolled by flying boats.

Thursday, May 03, 2007

Alpha Strike

Colored in form, made the Cancel button work, and you can now add squads to your new airfleet for your big attack.

Soon I'll add a button called Alpha Strike that'll put all the squadrons into the attack airfleet list. Hey, that might even be a better name than Carrier Wave, too. Anyway, you can hold Ctrl or Shift to do multiple selections. Good old MultiExtended in the Listbox property does it automatically.




A simple click to move the squads to the right...



A small subtlety: see the below error I got when I first tried to add items to the right listbox and then remove them from the left listbox(listSquads). The error repeated three times in my errorlog file.

Thursday, May 03, 2007      9:34 PM
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Windows.Forms.ListBox.ItemArray.GetItem(Int32 virtualIndex, Int32 stateMask)
at System.Windows.Forms.ListBox.SelectedObjectCollection.get_Item(Int32 index)
at Carrier_Wave.frmCreateAirFleet.AddToAirFleet_Click(Object sender, EventArgs e)


Here was the Visual Basic.net code I had (shush, you C# fanatics):

For q = 0 to listSquads.SelectedItems.Count - 1
listAdded.Items.Add(listSquads.SelectedItems(q).ToString)
Next

'remove from
For q = 0 to listSquads.SelectedItems.Count - 1
listSquads.Items.Remove(listSquads.SelectedItems(q).ToString)
Next


I told it the last index (blah.Count-1) and then did a simple for...loop from 0 to the last index. Can you see the problem?

Scroll down a bit and you can see the fix was easy.

.
.
.
.
.
.
.
.
.
.

The removal of items from listSquads meant the last index was getting smaller and smaller. But the for loop kept going to the old, now too big, last index. So I did:

For q = listSquads.SelectedItems.Count - 1 To 0 Step -1
listAdded.Items.Add(listSquads.SelectedItems(q).ToString)
Next

'remove from
For q = listSquads.SelectedItems.Count - 1 To 0 Step -1
listSquads.Items.Remove(listSquads.SelectedItems(q).ToString)
Next


The last index causes the error unless you get rid of them first. Now we don't care if the number of items decreasing causes the last index to change. Basically, the bottom of the list is getting chopped off, but if we get the items at the bottom before that happens, then it doesn't matter.

Wednesday, May 02, 2007

Save the Donnas...

...and the Foolhardy, and the Hallowed. Save was implemented before but I'm more confident about it and Save regularly now. The game saves the new positions of the player and enemy fleets.

I moved the location variable from each individual ship and to the xmlFleet class. Updating each ship location was a pain when I tried to do it. Better to track fleets, which makes sense since there are few times where a player sends individual ships out and the game mechanic screams for abuse (play Russian roulette and split your fleet into 15 individual ships, then have the AI waste a bunch of attacks to find which are actually carriers!). I think I'll limit the fleet splitting to two or three and have any auxilary/transport fleets be separate and not count for the total.

Still working on Launch Air Strike:

Tuesday, May 01, 2007

Hard to Port! Teleport That Is...

Ships can do basic movement. Well, basic teleportations. The program calculates without the effects of speed and distance. I'll tackle later and hope the programming is dirt (distance is rate x time) simple...





As you can see in the pics, not too impressive, but it is progress. I added some code to increment the enemy Orange fleet's location and kept hitting the End Turn button until it went off the map.

I am trying not to get too excited, but I have so many ideas and keep coming up with new ones. From simple (save in xml so users can rename their own ships) to silly (make every form control configurable so the user can almost make their own UI) to complex (steal enemy tactics research by sending fighters to do hit and runs so they can observe enemy tactics and report back). There is a lot of work and struggling to do.

But I'm livin' the dream: making my own game.