Monday, April 18, 2011

GameLog 189 - 195

Wow, 6 weeks since a GameLog.

Shogun: total war 2 (95h) - Played througha couple of campaigns to get the feel of it, and have just about finished a legendary campaign for the Shimazu. I'm afraid that the Tokugawa are only a couple of turns away from winning though. Plays really well, and feels like a well polished version of the original.

Grepolis 2 (15h) - High Notes alerted me to a new version of Grepolis, but I missed the start due to teaching. I'm 4 days behind, but keeping pce with the leaders. Currently 400th on server. Virus seems fresh and active, so I think that'll make the game stay in rotation for a while.

League of Legends (10h) - Off and on again relationship with LoL. Pretty much only play with brothers or at LANs now. Versus AI has been a nice change and I'm surprised they are offering IP for it.

Hoard (9h) - Been following this for the 360, and it's finally made a debut on steam. A little bit buggy, but an excellent LAN game.

Dragon Age Legends (3h) - Facebook game from Soren Johnson. Plays Ok, but still is a little light on for me to take it seriously.

Minecraft (3h) - Little bit of LAN filler. New versions are coming out a lot more regularly now, so it's good that it's getting more assets and ideas. Feels more and more like Dwarf Fortress ...

Feels like I'm missing a few, but that'll do for now ...

Tuesday, April 12, 2011

Factor Friends v0.2

Ok, main look and feel all done. If you select any of the cards in your hand it is highlighted in gold, and all possible places where you can put the card on the board are also highlighted. The check to see if one is a factor or not (one of the key parts of the card-based game for year8 maths) is probably going to be the shortest function in the whole program.

Next up, moving the selection to the board if it's a valid choice, then swap the players. All the back end is done for player hand rotation, all I need to do is flip a turn counter and refresh the hand area.

Might even be able to get a quick end-game check in there and have a fully functioning game for next revision (albeit with pre-determined cards).

Factor Friends v0.1

After a couple of days of solid game playing, I feel back to normal. The last couple of weeks have been so crazy marking and preparing for classes that I've hardly played a thing (I guess I should get back into GameLogs too).

I woke up this morning with a hankering to code. Might have been some of the TopCoder vids I found on youTube, or just something in my mind wanting to relax in a different way. Anyways, I've found myself happily coding away for the past 3 hours (with a splash of Grepolis).

One of the students at school is working on developing Factor Friends for the iPhone (or Mac at least), but I thought I'd give it a go too using some stock VB stuff. The aim would be how much of the game I can get done in a day.

Well, so far so good. I have the basic game board laid out using buttons and another set of buttons for the player's hand. The pic to the left shows some test data overlaid onto the buttons (showing the coordinate system used for the underlying array) as well as a sample starting hand.

There are 6 arrays so far that store the data for the game: BoardValue, BoardValueOwner, HandValue and HandStatus for each player. With these in place and the refresh subroutines built, I can now simply call RefreshBoard or RefreshHand to display whatever the game logic dictates.

Biggest hurdle so far has been attempting to use pointers. I wanted to store a similar sized array of pointers to the buttons so that I could refactor the refresh code into a simple loop rather than having many repeated lines of code for each array position matching up to the correct button. Wasn't a big deal at the start, but once there started to be 7 or so lines per button, the code looked pretty unmaintainable. Searched around for a bit, but nothing seemed to allow me to reference the buttons using a stored pointer or the like. I eventually came up with a new subroutine that accepts a button, and the current staus and value to set it to. Worked a treat and much neater.

With the board in place, the next thing to do is to get the player interaction working.

Looks like I can bind multiple buttons actions to the dame subroutine, and I can also reference the sender to the event handler as the button clicked. That will make the hand and board UI pretty easy.

I'm also hoping to have the clicked card eventually track to the clicked board position (if legitimate, need to get a validation routine working too), then disappear from the player's "hand". Should be pretty easy using a timer and some slide-in, slide-out animations. Not sure what happens to the button when it's in transition though, can I lock the whole UI down until the animation is finished?