Thursday, July 22, 2010

The P*ssed Off Blog - Munin

I now update this blog rarely, and the only time I will probably write here is when I'm COMPLETELY P*SSED OFF with some software or other. And today it's Munin, a program to profile server, like network and CPU usage etc...

It seems like a great program, and worked great on my local VM which is running an old-ish version of Ubuntu (Hardy Heron, 8.04) and version 1.2.5 of Munin in Synaptic. I had it up and running in minutes thanks to this article.

Of course, you might have an idea what's coming; it's what happens with most great software programs: the programmers don't know when to STOP F*CKING AROUND WITH IT and start adding/removing features and generally making something that "just worked" into a friggin' nightmare to use.

After I installed Munin (1.4.4) on the latest version of Ubuntu (Lynx, 10), I ran into problems trying to run it. Unhelpfully, when trying to run Munin as root, it comes up with the message "this program will break if you run it as 'root'...". Jesus, I'm not some n00b. Anybody who wants to run something like Munin is not a casual computer user, and knows the problems associated with running everything as root. But no, the programmers of Munin obviously think they know better and want to protect us from ourselves (and getting any work done).

The older version of Munin has a switch (--force-root) to over-ride this. But that was too helpful so THEY'VE TAKEN IT OUT. Thanks a lot. The message does come with some help: "run it as user 'munin'". Erm, ANY CLUE AS TO WHAT THE PASSWORD MIGHT BE? No? Thanks for nothing. I've tried "munin" and blank, but no joy and Google doesn't seem to be able to help me either. I'm not even sure that would work anyway, as the file referred to in the "permission denied" error I get is owned by root. So do I have to chmod loads of seemingly random files to allow user 'munin' to edit them? Surely that's no way to have a secure system?

So to sum up, I got the older version working in about 5 minutes, but so far I've spent a couple of hours on the new version and got nowhere. Thanks, munin programmers, for taking Munin backwards. I won't be using Munin again, but that's more because I COULDN'T IF I WANTED TO than due to any principles and animosity.

Thursday, April 01, 2010

Eclipse and Subversion [SOLVED]

This is mainly a note for future reference for myself, since I always seem to have an ABSOLUTE F*CKING NIGHTMARE trying to get Subclipse working on any new install of Eclipse. Thankfully it seems to have got better in the last few months now that Eclipse automatically finds dependencies, and you don't have to realise that Subclipse requires Buckminster, Buckminster requires ECF, and ECF requires Equinox until YOUR HEAD EXPLODES.

Anyway, now all it seems you have to do is select the Tigris update site as per here and select all the Subclipse components.

Then finally, for the magic step that makes it all work that took me about 3 hours searching the internet for, you have to right-click on your project and select Team -> Share.

(Why it couldn't realise that a project is already in subversion by seeing if there were any .svn directories is something I can't answer. There may be good reasons for this).

Friday, January 08, 2010

Developing a Community

One thing I always aim to achieve with my games is developing a community around them. This has pretty much eluded me (at least to my standards) until now, as there there is a small community playing Stellar Forces.

However, I'm confused. I've just looked at the main page of a new game called Mule, which is an online remake of an old C64 game (which I've never played, BTW as I'm an old Speccy user and it would be against my religion to do so). As far as I can tell, it's only been going since December last year, and it already has over 8,000 registered users! There other stats are impressive to - 1,600 forum posts, 2,800 games played etc...

So my question is "What are they doing to get that many users?" It's obviously a far more polished affair than my own effort - is that it?

Monday, January 04, 2010

Use of Overriding Methods Considered Harmful

I've come to the conclusion that overriding methods is a bad idea.

You know the situation; you've subclassed another class, which has a method in it that's not quite perfect, so in your subclass you write another method (giving it the same parameters) that does something slightly different.

Cue several months later, and you innocently edit the method in the parent class, changing the method parameters. Suddenly bugs appear left right and centre. "But how?" you ask yourself.

Well, it's because the method in the subclass is now never called since the method signature is different to the parents signature. But how were you supposed to know? Exactly!!

Tuesday, December 15, 2009

Making Money from Open Source

After discussing the above on the Freegamer forums, I thought I'd start a brief list of ways to make money from Open Source, if only for my own reference:-

  • Put adverts onto your website
  • Ask for donations
  • Offer to implement features
  • Create virtual merchandise
  • Sell "acheivements" and "player upgrades"
  • Unlock features
  • Sell merchandise
  • Sell your community
  • Provide an offline version of the game (for free) but require a small payment for anything other than token access (e.g. unrated friendlies) on a PvP server.

Some of these are similar and are along the lines of "allow players to pay for more features".

The main obstacle to all of these is having a game popular enough so that people will actually pay money. Suggestions for solving this problem on a postcard please...

Friday, November 27, 2009

New Stellar Forces Client and new Forums

A new version of the Stellar Forces client has been uploaded (0.35), and I can also announce that we have some new forums, linked into the Stellar Forces website (so users don't need to log into a seperate website to be able to chat).

See the Stellar Forces blog for more details.

Monday, November 16, 2009

New Stellar Forces Blog

Since I'm hoping that Stellar Forces is going to become my raison d'etre, I've created a whole new seperate blog for it. I've got loads of ideas and thoughts to discuss about it, and people who may be interested in it may not want to have to wade through all the other random blog entries that I produce.

Thursday, November 12, 2009

Stellar Forces Released


I've just released the first alpha version of Stellar Forces, my 3D squad-level multi-player turn-based strategy game. You control units in the traditional turn-based way, and take turns with your opponent. There is also a website that acts as the control panel for games.

It is alpha, so although I've tested it there are bound to be bugs and the game balance may not be perfect. I would just like a few playtesters to start using it and provide me with constructive feedback about what can be changed and improved.

In "hallway testing" style, I'm keeping my details brief so that if there are any confusing or unexplained aspects to the game, people will let me know and I'll add more details to the instructions.

http://stellarforces.no-ip.org

Anyway, let me know what you think!

Tuesday, November 10, 2009

Stellar Forces: Almost ready!

I've been a bit busy lately, what with having a new baby son, but have somehow still found time between bottle feeds to write the final bits of code to Stellar Forces.

I've just got a bit more testing to make sure it's robust, and then I'll announce it formally and let people loose on it. I'm hoping that these beta-testers will be able to help me tweak the balance of the game. With a game as complex as this (it's like multiplayer stand-alone missions from X-Com) there are so many variables (unit stats, weapon stats, mission objectives, map layouts) that it will take several games to get it right.

The game also has it's own website which stores a history of everyone's games, so there will be league tables, stats pages, and I'll maybe even do proper competitions sometime. The options are endless.

Monday, November 09, 2009

Java: Forgetting to override .equals()

This one always catches me out. I have a bunch of icons in my program, all extending the Rectangle class (seems like common sense to me). However, I don't actually fill in the dimensions until I've got the full list of icons (stored in an ArrayList()) so they are all zero-sized rectangles.

Before I add each icon to this list, I check whether it's already there:-

public void addIcon(Icon icon) {
if (iconlist.contains(icon) == false) {
iconlist.add(icon);
}
}

Have you spotted the problem? Since the dimensions for the icons are all zero, and the contains() function uses the equals() method of the icon class, then once one icon is added to the list no others will be. This is because the Icon/Rectangle class' equals() method compares the dimensions, and thus all my icons are actually equal, so it thinks that the icon list already contains the said icon. (That all seems very verbose for what is quite a simple problem).

Note to self: Always override the equals() method.

Thursday, October 22, 2009

Links About Game Design That I Fully Intend To Read But Don't Currently Have The Time

http://critical-gaming.squarespace.com/blog/2009/7/7/for-the-scale-of-balance-pt4.html

http://www.sirlin.net/articles/slippery-slope-and-perpetual-comeback.html

http://blog.wolfire.com/2009/01/game-theory-applied-to-game-design/

Monday, October 19, 2009

The Spectrum Got There First!

Did it? Well yes actually, it did. You name the genre and you're pretty much guaranteed that the first game of that genre was available on the Spectrum (or maybe ZX81). And here's a few examples to prove my point.

Let's start with the biggy, probably the greatest breakthrough in gaming this century (or maybe the end of the last one). I'm talking about GTA3 of course, what everyone thought was revolutionary.



That is, apart from me. I thought I was having a bout of terminal deja-vu when I saw it, and was nostalghically transported back to the mid 80's, when I was playing the classic Turbo Esprit:-



Next, Wolfenstein is held up as the start of the FPS genre. Frankly, I was hoping it was the end as I was already bored of FPS'ing.



The start for me was 3D Monster Maze, almost 15 years (count'em!) earlier:-

Detractors will say "It didn't have any shooting in it!". I reply "Well, that's pretty revolutionary in itself!".

Just like Wolfenstein, Dune II is held up as the first of the RTS genres. (I've no idea what happened to Dune I).



But RTS's had been around for years already - if you owned a Spectrum (and probably most of the other popular 8-bit machines). However, Stonkers came out on the Spectrum first, and for that reason we can gloat.


And before you ask, yes, it does have resource collecting!

Last but not least is genre that never quite goes away, it's the top-down dungeon crawling game. I could have included a picture of Diablo here, but let's be fair and show Gauntlet, what many people claim to be the first (apart from those who claim it was The Dandy).



Of course, both of those people are wrong. The first game was Maziacs, and it came out on the Spectrum first (as if you needed to ask).



So if you're a games programmer working for a large megacorporation with a massive marketing budget but precious few original ideas, why not plunder a few from the Speccy back-catologue and claim them as your own?

If you can think of any more, please let me know and I'll do a "part 2" or something.

Tuesday, October 06, 2009

Pushing the bounds of technology

Like all people, I wonder what will happen when I die. And being a programmer, I came to the obvious conclusion: store my consciousness in a program that will live on in cyberspace in perpetuity!

So, after literally minutes of messing about, may I present the "Me" applet:-



Now you will able to communicate with me forever through the power of Java. Now if I can just hook it up to Blogger, I can keep writing blog entries long after they stop being funny!

Monday, October 05, 2009

Tips on maintaining your own interest in your own project (#1 in a series)

If you are sure that the game will be a good, entertaining game, then try to complete as much of the programming as possible before actually playing the game*.

(* This entirely contradicts my previous advice of "get the game up and running as soon as possible so you have something to play". I've decided that once you have something to play, the remaining programming tasks consist of the boring tidying-up programming, which has very little reward since you already have a game to play. My new advice is to keep programming all the little bits and pieces first. In addition, doing it this way will mean your original vision will remain in your head, and not be replaced by interest-sapping the catastrophe with temporary-and-crap graphics that you have programmed**.)

(** I hope this makes sense.)

Thursday, October 01, 2009

3D is hard!

During moments of niavity (sp?), I sometimes think that 3D should be easy and I'm just going about it the wrong way. Surely it's just like 2D, except you have to adjust for depth as well?

Unfortunately, it's nothing like as easy. For a start, with 2D, all your co-ordinates have a common origin, usually the bottom left, and you can tell whereabouts a sprite is in relation to the origin. With 3D, the origin could be anywhere, and usually each model seems to have it's own. In addition, working out where the origin is can be difficult, since it depends on where your camera is and what direction it is looking in.

You might have two 3D models, each facing zero degress (or radians, assuming you haven't got them mixed up again). But one is facing one way and one another. And their direction might change depending on the frame of animation they are in.

And why can't I see anything? Is the camera outside the scene looking outwards again? Or is it looking directly down, which seems to cause problems and make everything disappear? Or are the objects slightly too far away to see? Or maybe I need to add lighting to the scene. And why is one model approximatly 3 million times bigger than the other? Time to scale the models down a bit and then wteak their height so they are standing on the floor and not in it.

And why does my model move whenever I move the camera? Oh, I've forgotten that when I have a unit with a position of Vector vec, and I then do camera.setLocation(vec), it is using the same actual object (vec) for both the unit's location and the camera's location, so when one changes, so does the other. Grrr!

Monday, September 28, 2009

Potentially Useful Functions (#1 in a series)

The original aim of this blog was for me to impart my knowledge of programming, or for people to point out bugs and problems with my code. Either way, it was supposed to be about programming rather than subliminal advertising for my games.

This post aims to correct that, so to get things started here's two nice small graphics function that someone somewhere may find useful:-

This one rotates an image:-


public static Image rotateImage(Image inputImage, float ang_deg, ImageObserver ob) {
BufferedImage sourceBI = new BufferedImage(inputImage.getWidth(ob), inputImage.getHeight(ob), BufferedImage.TYPE_INT_ARGB);

Graphics2D g = (Graphics2D) sourceBI.getGraphics();
g.drawImage(inputImage, 0, 0, null);

AffineTransform at = new AffineTransform();

// rotate 45 degrees around image center
at.rotate(ang_deg * Math.PI / 180.0, sourceBI.getWidth()/2, sourceBI.getHeight()/2);

// instantiate and apply affine transformation filter
BufferedImageOp bio;
bio = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);

BufferedImage destinationBI = bio.filter(sourceBI, null);

return destinationBI;
}


And this one scales an image

public static Image scaleImage(Image inputImage, int w, int h, ImageObserver ob) {
BufferedImage sourceBI = new BufferedImage(inputImage.getWidth(ob), inputImage.getHeight(ob), BufferedImage.TYPE_INT_ARGB);

Graphics2D g = (Graphics2D) sourceBI.getGraphics();
g.drawImage(inputImage, 0, 0, null);

AffineTransform at = new AffineTransform();

// scale image
float sx = (float)w / (float)inputImage.getWidth(ob);
float sy = (float)h / (float)inputImage.getHeight(ob);
//at.scale(w / inputImage.getWidth(ob), h / inputImage.getHeight(ob));
at.scale(sx, sy);

//at.rotate(45 * Math.PI / 180.0, sourceBI.getWidth()/2, sourceBI.getHeight()/2);

// instantiate and apply affine transformation filter
BufferedImageOp bio;
bio = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);

BufferedImage destinationBI = bio.filter(sourceBI, null);

return destinationBI;
}



Needless to say, if anyone knows a better way to do this, or just tweaks to the above code, please let me know.

Thursday, September 24, 2009

A great idea, or maybe not

"Woah!", I hear you say. "Slow down young Steve. With all this blogging, you're going to burst one of the tubes!". However, I thought I'd mention a great idea I thought I had. See if you can spot the flaw.

I didn't watch Derren Brown pretend to predict the lottery, but his suggestion of using the Wisdom of the Crowds gave me an idea - why not create a website where people can enter their prediction for the numbers. The website will then show the average of everyone's numbers, and people can use those numbers for their actual choices!

Any mathematicians out there may spot the flaw sooner that the rest of us. So let's save me lots of time and programming and all just choose the numbers 24, 24, 24, 24, 24 and 24.

Changed my mind

Instead of Interstellar Forces, I'm going to call it Stellar Forces. Don't you go registering the domain you rascals!

Here's a picture of the website to celebrate the change of name:

Wednesday, September 23, 2009

Announcing: Interstellar Forces

I've finally though of a title! "Interstellar Forces" - mark its name my friend as you will (hopefully) hear a lot more about it in the future.

I've now nailed down the HUD, with its Terminator (as in Schwarzenegger) style text, and the Terminators (as in WH40k) for the models. I might replace these from some of those in UFO:AI though, as I think the licence allows this.

One thing that crossed my mind now that I've got to the stage of a 3D applet is all the other possibilities that have opened up for this code; I could turn it into a 3D RTS like Starcraft III, or write a Diablo clone, or anything my evil mind might think up.