Monday, June 06, 2005

Check out the other qualifiers

check out http://railsday.com/svn/qualifiers for a list of the other qualifiers - doing some really interesting things

Sunday, June 05, 2005

Back in the land of the living

I've had a good 3 hours sleep now, lying on Alasdairs couch with various Australians being so quite that I slept through their booking of airplane flights and so on. I am about to tidy everything up and do the dishes, but first I thought I'd write a bit of a bit of a postmortem.
Doing a quick review of my posts, I do notice that the first post and the last post (before this one) are both at 10:26PM in some strange country - but I guess that means that it was 24hours :)

Overview
So Alasdair and I thought, what project can we attempt that
  • can be kept small
  • is of interest to us both
  • has the potential for some fun UI stuff (esp AJAX)

We ended up going for a space exploration game similar to VGA Planets, Stars, Reach For the Stars and so on.
The only difference with other X4 games being that, rather than having some kind of hyper-light speed engines, the space ships moved from one star system to another via fixed wormholes. These wormholes were completely random, and would always take one movement point to traverse, no matter how far away the destination was.
Of course we started simple with; one resource (people), two ship types (colonists and fighters), two orders for ships (move, colonise) and that's about it.

As this was part of Rails Day, we implemented the website in Ruby On Rails.
I have read a lot about both Ruby and Rails development, and own the Beta Book from the Pragmatic Programmers about RoR (as well as PickAxe). I haven't seriously coded anything in the language or anything though, and have only done two RoR tutorials (thank god at least that!
Alasdair had never even seen Ruby before Wednesday, and didn't really have time to swot up on (study) Ruby or RoR.
We both come from hardcore Java Website backgrounds, but wanted to have something to add to our CVs. I was interested in assessing both Dave Thomas and David Hansson's assertion that Ruby, and especially RoR, are so great and productive. Being from the Typed school, both Alasdair and myself were 'reserved' in our judgement.

What Went Right
Hmmm. Not a lot.
Buying the Dave Thomas Beta Book was up there without the excellent tutorial for the first 180 pages I would have done nothing. If only I'd made it through the last chapter, Testing, the project would have been even better...
Setting up Subversion. While I don't think we set up our directories exactly correctly, we did set them up as recommended by, again, the pragmatic programmers. Svn was up and running very quickly.
We also made fairly regular commits, trying to keep things in iterations. Eventually we made 29 commits, of which 20 or so where major changes. Maybe we could have made more, but I felt good about how we progressed here.
Two hours before our time was up I wrote a very simple user login/registration/create game series of pages. These took me less than 1/2 hour and I felt very productive; maybe I did learn something this weekend!
We did plan in small iterations, which was good. We both got on very well, not getting angry or frustrated at all.
I can't speak for Alasdair, who was using a PC, but I have to say I truly enjoyed developing Ruby on a Mac. The only painful thing (that really goads me) is switching between windows within the one app - how can I do this more easily?

What Went Wrong
Our biggest disadvantage was our complete lack of experience with RoR. Not so much Ruby itself, as the coding for RoR is so minimal that there isn't that much to learn, but RoR itself is phenomenal! But since familiarisation was our number one goal this weekend, I guess we can't complain about this.
Our second biggest time waster was frigging around with absolute positioned divs and stretched images. This was used to draw the star map, with stars and wormholes, relative to the currently selected star system. Alasdair had so much trouble, I was concentrating on my stuff so deeply, and we considered it such a high priority that we only noticed the time when it had taken 14 hours and still wasn't working. If we'd cut our loses earlier we might have got a 'finished' product out the door.
We didn't write tests. This is a biggy, especially as Alasdair and I are the only people at work who 'test first'. But like the cowboys we felt we ended up replicating, we didn't write any test code at all. Which is why I wish i'd got to the Testing chapter in the Dave Thomas Beta Book! Very disappointing.
A minor annoyance was that we were developing in a lounge room, and for a good 5 hours had people watching TV. This is extremely distracting, but it's their house too, so we couldn't say anything. And only getting to bed 5 hours before the competition started wasn't a very good idea either.

What We Learnt
A lot about Ruby, and a little about RoR
HTML coding sucks (but we already new that)
Did we decide that RoR was 10 times as productive? If I had been allowed to develop the same app with the same functionality in a framework/language I now intimately, I think it would take me a little less time to do the same amount of work. But we didn't know Ruby or RoR. So for complete noobs to get as far as we did shows that RoR must have something going for it.
Did we decide if we like DuckTyping and RoR and so on? Still, at this stage, on the fence. I made a number of errors Typing would have fixed before I got there, and command completion in IDEs is great, but unit tests would have picked up the Type errors and familiarity with the libraries would have reduced the command completion blues.
I can see how skillful developers could knock up a website very quickly (even me!). But if I was in a company and we had any 'average' programmers around, I wouldn't like to let them loose on it. I think you'd end up with the sprawling, spaghetti mess I created last night. I also don't know how to scale the website up to a very large number of pages/controllers, though I guess there are defaults you can override with directory structure and so on. (Though not namespacing?)
One little RoR thing - Sometimes I have the id of the object on the end of the url, and sometimes as a parameter. Never really worked out when I was supposed to do one and when the other. Things like that seemed to happen a bit. The philosophy I'm sure is sound, I just don't know what it is.

Notes on the competition itself
I understand that these things are hard to organise, and I'm sure that Lucas was very busy the whole time - certainly would have been up more hours than most of us! But a little more information would have been useful, a few more emails, and considering the confusion about starting times, putting a count down somewhere (even in an email) would have been really useful.
As it was, we ended up thinking we had another hour when we didn't, and so didn't get the star map (which took 14 hours to produce) integrated into the main page properly. This was very disappointing for us.
So my suggestions would be
  • email more often, especially on the pertinent milestones (4 hours before, start, every four hours, last hour, half hour and finish
  • Have a count down on the webpage, and every email has an 'hours until' line in it.


What we ended up with
...was nothing that the judges are going to like.
There is no documentation telling them how to get started, so they won't and can't (I had just finished the index page when the svn connection was turned off). There is no explanation of how the code worked, what the objects were etc.
There is not testing.
All base functionality was implemented except: adding planets to systems in the game initialisation phase (this was done, but didn't make it into SVN), integration between the star map and the main page (again, done but not SVNed)
I think if we'd got those last two things in, as well as the index page and the one page of docs I wrote, we would have had something worth showing. Ah well, such is life.
We had planets with populations that grew, spaceships that moved and fought and colonised, and players that controlled it all. I'm going to give it a go tonight and see how it goes :)

Saturday, June 04, 2005

What the

we were promised one more hour, and suddenly it's gone! Oh well, I guess we didn't understand the email.
It would have been nice to get in one more commit, as we had just tied together the two of our stuff, and started to populate planets. Also I could have included the documentation that I had been writing so people know what to do.

Thems the breaks

Oh, and I got the battles working

Oh Mr Hart, What a Mess!

That's an Aussie add reference BTW
Yes our code is a mess. It's interesting that both Alisdair and I have had similar problems with the iterators blocks, initialising things wrongly so we end up with accumulted stuff instead of a fresh copy each time.
And Alasdair found out that if you aren't careful about how and where you define your classes, WebBrick won't drop them... So you end up with really weird errors until you restart WeBrick

Jackie Chan is on TV

I know this cos I am in the living room with my computer and one of the flatmates here is watching - it's damn distracting after I've been 'coding' for 18 hours.
I have to remember to ring my sister tomorrow morning.
I just finished the attack stuff, worked first time, so maybe I'm working out ruby a bit more...

Must sleep!

We are slowing even further, if that is possible, as we start to get tired. I have colonising and planet growth going, Alasdairs about to integrate the map, so I just have to get the fighting and moving going and we've almost got a game...

Alasdair is feeling a little wooly

'what is the r for in that equation' he asks.
well that would be radius, Alasdair, seeing as we're drawing a circle.
I guess my sense of humour is also getting tired...

OK, we've just both said 'I'm finally starting to get the hang of this'

Must be something hey?
I have the ship orders/split/join working, and about to do EOT
Mr Alasdair is starting to work with absolute positioned divs... to layout the map

Well we have a simple map

Not so much a map as a hierarchy with nodes appearing multiple times... thanks Alasdair!
And I've pretty much got fleet orders going (move and colonise)
Next I'll do EOT and Alasdair will do a nicer version of the map

Not a lot happening

Alasdair is starting to get the hang of things. He has the systems being created (no planets yet) and is starting to work on the hardest UI bit - displaying the map of the stars.
I've just been trying to start on the main display page and the orders

Wish I was faster

I now have the session stuff going (and realised that I don't really need it...) so that when you look at fleets/planets you only see the ones for your game.
I am going to start on the main screen now. Anyone want to draw a crappy star for me?

learning all the time

OK we've got the scaffolding going for the 5 major models - and Alasdair has just added a 6th so maybe we'll have to get that going before proceeding...
Anyway, so far the linking between tables has been very painless, just using collection_selects for everything.

Friday, June 03, 2005

woohoo first database definition done!

Well, maybe we should be coding by now, but just setting stuff up takes a while. Anyway, we have the first, rudimentary db done, with systems, planets, wormholes, players and fleets

First Post!

Well, it's 6:26 in the morning here and team Noobs has managed to set up SVN, kind of.
We are about to sit down and work on the DB schema, and then I can show Alasdair the wonder of rails model creation!