Stargate Domination: updates

Written on March 5, 2010

I've finally found the time to review my Stargate Domination game. Last update said August 12, 2008. So it had been a while. This article will describe the most important changes, from a developer's perspective. I've also made a small flash movie to demonstrate a few features.

Update: August 12, 2008

In this previous update, I've made some major architectural changes that were never published. The reason for these interventions was simple. I started this game in the second year of my bachelor Informatics when learning Java Swing, but my programming skills were quite basic nor I had any understanding about architectural decisions. As a result, model-view-controller (MVC) characteristics were not strictly separated.

The redesigned architecture consists of 2 major packages:

Another significant improvement was a central IconManager. Consider for instance the following code.

new ImageIcon(SomeClass.class.getResource("/sgdom/images/SomeImage.png"))
        .paintIcon(this, g, 0, 0);

First a new ImageIcon is created from a particular resource. Afterwards this ImageIcon is painted on the panel. But panels can become non-visible depending on the type of information they need to show. When a panel becomes visible again, a new ImageIcon was created instead of reusing the existing one. Not to mention that when changing the location or the filename, all occurrences in Java classes need to be updated.

A central and static IconManager solves this problem by preloading all images at startup, instead of always recreating them. Other Java classes can simply call this IconManager for a specific image.

IconManager.getIcon("SomeKey").paintIcon(this, g, 0, 0);

A key is used to retrieve the image as denoted by the above code.

Update: February 7, 2010

Last month I wanted to give this project another try. But after more than a year and countless other projects in many application areas later, I failed understanding my own code. It took me about a day to figure out how all pieces fitted together.

First I decided to create an Eclipse project, because auto-completion is quite useful when a project is growing. It makes you implement certain classes with a much higher efficiency. Before now I used Notepad++ on Windows and Vim on Linux. So pressing a dot and watching a list emerging with all possibilities is quite an improvement over the regular text editors.

Next I conducted a thorough review of all classes. The result was a more cleaner and understandable program. Lots of methods were renamed or reorganized, and I also introduced a Constants interface that contains all the necessary information in this project (IDs for internal use, names of races and actions, descriptions,...). So when something needs to be changed, only one class has to be adapted.

I also implemented 5 basic actions that all races will share in common.

I'd like to note that I only implemented the logic and animations behind these 5 actions. Of course, more will be possible. Even these 5 actions are far from finished. A planet might for instance have defenses to return fire at a vessel. Consider the Tollan ion cannon that protects their world Tollana.

Flash movie

To conclude this article I did a bit of an experiment. I created a small flash movie to illustrate these new features. In the upper left corner you'll notice I'm playing with the Goa'uld.

Because this movie might be too small or low quality, I've also uploaded the original movie. It's about 8 MB in size and you can download it by clicking this link.

I have absolutely no idea when I'll be back with another update. Right now I'm in the middle of my final semester and I should graduate in June of this year. So I'm focussing on my master dissertation about bytecode transformations to secure Java applications.