WikiGolf Source Code

Get Right to the point

As I mentioned in my previous blog post, I’m posting the source code for the WikiGolf game that I submitted for my Software Engineering Project II module. My team was called “The Channel 4 News Team” and we spend about 5 weeks doing this. I outlined the concept for the game in my previous post, but heres a quick rundown. Its a WikiGolf Graph Traversal Game:

  • WikiGolf – You start off on a random page on wikipedia, and try to get to a specific page in the fewest number of clicks. You can only use links that are on the current page.
  • Graph Traversal – We had to take a text file off all the pages on wikipedia, with information on which pages those pages linked to. And convert that into a Digraph which we could then traverse.
  • Game – It needed to be fun to play.

    Initially we split the game up into 3 separate components. We used a modified MVC style pattern, which is generally used in Web Development, but which we found quite useful.

    • The Model contained the File I/O, the logging class and generally had the function of transferring data stored on the computer into active memory where it could be manipulated.
    • The View was essentially the GUI. Anything that the user saw or interacted with was contained in the view.
    • The Controller held the game logic, and the game state. Such as the current Course, Hole and the shots that you had taken so far.

    This breakdown allowed us to work on the individual components of the game separately, and then bring them together. The way it worked out, I managed to get the Model and View almost completely done over the course of a few days during my Mid-Term break. Which meant that the team could focus on the GUI, which we identified as the most difficult part of the game. Especially considering none of us has done any GUI programming before.

    I really embraced the OOP way of programming for this project and I learned quite a lot from it. Everything that I got my hands on was turned into a fully Object Orientated Class. For instance, there’s a User Class, but there’s also a Course Class, which has a Hole Subclass, as well as a HighScore Class, which has an Entry Subclass. I also commented everything as much as I could. So anything that I wrote, unless the code is completely self explanatory, is fully commented. For my commenting I followed the JavaDoc Specification, so you can generate a JavaDoc quite easily.

    Despite my preference for coding everything by hand, the team went with a Graphical GUI builder. I wasn’t going to be doing the GUI considering I’d done pretty much the entire backend, so I didn’t have much of a say :P . After trying some tools like Cloud Garden’s Jigloo, they eventually settled on NetBeans for GUI development. Having watched them use it, and using it a little myself, I think it was the right choice.

    So by the end we managed to have a fully fledged working game with pretty much all the features we were asked to produce. It had a working back-end (with no glitches that we spotted), and a fully functioning GUI that allows you to access all the features of the game.

    You can play a pre-made course, generate a new course, and play or save it. You can save your high scores and it even plays music!

    Get the Files

    So without further ado, here it is. I’ve posted the source code to salij.org
    In that zip folder is the:

    • NetBeans project – If you want to have a look at the code the easiest way would probably be to open it as a NetBeans project. However if you want to look some other way, its all in the src folder.
    • The Jar file – If you want to run the game directly, just run the GameNet.jar file in the _Dist_ folder.
    • The Media – All the media, like images, music and the graph file are all in the _Files_ folder.

    There you have it. If you have any issues just post a comment and I’ll see what I can do.