Thursday, February 19, 2015

Deity - "Multiplayer Populous"

My latest Android project is ready to announce: Deity.  If you remember Populous, then you'll be right at home here.  This is a multi-player turn-based strategy game.

You play a God who begins the game with a small group of followers and not much power (or "Mana" as professional Gods call it). 


As a God you can move your followers about, and ask them to either pray (giving you more Mana), grow crops (which are needed for your followers to survive) or build a house (which will generate more followers).

Once you have some Mana, the real fun begins.  You can create god-like effects to try and destroy your enemy God's followers, like floods, earthquakes and volcanos.  See the lava in the above screenshot!

This game is still in alpha, and I'll be the first to say that the graphics are a bit ropey, but I wanted to get it out there as quickly as possible as it's ready to play now, completely free, and has no adverts or IAPs.  What have you got to lose.

Monday, February 09, 2015

Seeing into the Future

The Linux "locate" command has a "-e" option which "Print only entries that refer to files existing at the time locate is run.". 

Does this mean that if you leave this out, it will find files that don't exist yet?  I'm running "$> locate half-life3" now...

Thursday, July 03, 2014

Hey!

Hey!  Do you breath air?  And do you like messaging?  If the answer to either of those questions is true, then you need Hey!, the new way to stay in contact with friends for free.

Hey! is a free Android app for sending and receiving message from other Hey! users quickly and easily.  It costs nothing, and there's no adverts!

So join Hey! today!

Monday, June 23, 2014

Think Anagrams Are Easy?

So did I until I wrote my new education app 'Alien Anagrams'.  It's a sort-of shoot'em-up, except you shoot bullets by correctly guessing anagrams.


Take the anagram in the screenshot above: "lseo".  it took me a good few minutes to guess it, when I would have assumed a 4-letter anagram would take about 4 seconds.  How many combinations can there be?  But for some reason my brain keeps thinking of words like "leo's" or "selo"[tape].  Still, that's why I like playing this game; if you lose it's your own fault, and when the computer shows you the word, it suddenly becomes obvious what the answer was.

Give it a go (the first few levels are free, and they are challenging enough) and see how well you do.

Friday, June 13, 2014

System-Wide Mutex

It's been a long long time since I actually posted anything directly to do with Java programming, so here I am to make up for that.

In one of my projects I needed to create a system-wide mutex (a "mutex" being an object or "flag" to say that something is locked, e.g. a method or bit of code, so no other process can call it).  I needed it to be system-wide since I had multiple programs running on the same computer that needed to be in sync, so I couldn't use the synchronized keyword.

So I created a new class which I've called  FileSystemMutex.  It's very simple, and works by creating a temporary file to indicate that the lock is enabled and the file is deleted when the lock is released.  Because it uses the filesystem, it is "global" across everything that uses that filesystem.

Here is the code:-


import java.io.File;
import java.io.IOException;

public class FileSystemMutex {
   
    private File file;
    private long max_duration;
   
    public FileSystemMutex(String _filename, long _max_duration) {
        super();
       
        file = new File(_filename);
        max_duration = _max_duration;
    }
   
   
    public void waitForLock() throws IOException {
        while (isLocked()) {

            // This is my own function.
            // Surely everyone's written their own "Thread.sleep()" 
            // wrapper by now?
            Functions.delay(100); // Wait for a sec 
        }
        lock();   
    }
   
   
   
private boolean isLocked() {
        boolean exists = file.exists();
        if (exists) {

            // It might exist but is it too old?
            long age = file.lastModified();
            if (age + max_duration < System.currentTimeMillis()) {
                // Too old!
                release(); // Delete the file
                return false;
            } else {
                return true;
            }
        } else {
            return false;
        }
    }
   
   
    private void lock() throws IOException {
        file.createNewFile();
    }
   
   
    public void release() {
        file.delete();
    }

}



One thing to always remember with locks it to ensure that under no circumstances should the lock get left on, usually by a program ending prematurely.  This is why I've included the failsafe "maximum duration" parameter, so if the process that created the lock "crashes", the lock will still be released, eventually.

You would use it like this:-

    private static FileSystemMutex fsmutex = 
        new FileSystemMutex("my_lock", 1000*60); // Might as well make it static

 
    public void MyFunction() {
        fsmutex.waitForLock();
        try {
            [ do something that requires locking this bit of the code]

        } finally {
            fsmutex.release();

        }
    }


'Tis all.

Thursday, June 12, 2014

Intelligent Traffic Alerts

One of the biggest problems with traffic alert apps is actually finding the relevant traffic alerts.  Most apps give you lists of roads or maps, and you have to spend the time either going through all the roads you might be travelling on, or examining maps to see which road the alert is actually on, and whether it's even on the section of that road you will be using.

That's why I wrote Intelligent Traffic Alerts, which takes all the work out of finding relevant traffic alerts.  Simply turn it on, ensure your GPS is active, and listen.  It will constantly scan for new traffic alerts, and if there are any in your vicinity, speak them out to you.

The other major advantage to this is that you don't have to take your eyes off the road.  Even SatNavs can be dangerous as you try and translate the image on the SatNav map to the real world you are on.  With this new app, you get told about the traffic alerts while you drive, which has to be the safest way.  The onlydrawback is that there are no interesting screenshots because there's not a lot to show!

Monday, May 12, 2014

Math Monsters

I've just released my latest app, called Math Monsters!

Math Monsters is a game designed to help and encourage kids to get better at maths. By making maths fun, they will become better at it without even realising, and have fun along the way!

The game is very simple to play. The player must get to the end of each level; they will automatically walk forwards until the monsters that appear get too close. The player can shoot at the monsters by entering the answer to a sum. If they get it right, the weapon linked to the question they answered will be fired. Different weapons are available, but the better the weapon, the harder the sum! If the player gets to the end of the level, they will go onto the next level, which has harder sums and more monsters. If any monsters manage to reach the player, it is game over!

If you download it, please let me know what you think.  As usual, all my apps come with a full money-back guarantee forever at any time.

Friday, December 20, 2013

Mystery Screenshot!


My latest Android project: At the moment it's just a 3D test.  I've not really thought about what game to make yet. 

Wednesday, July 17, 2013

Compiling Firmware for an ADSL Router Modem

I've been Googling on and off for about a week, and I've come to the conclusion that no-one has ever managed to successfully compile firmware from source and install it onto a ADSL router.  There's plenty for a "normal" router, but not an ADSL router, i.e. one that allows you to connect to your ISP.

I've tried it myself, downloading the ASUS source.  Because of GPL, they're obliged to provide it, but they make it as difficult (well, impossible I suppose) to actually compile it due to all the extra libraries, specific toolchains and config files that are required.  And then there's the problem of the hardware being pinickity about allowing custom firmware.

There's OpenWRT and DD-WRT.  OpenWRT doesn't have anything for an ADSL router, and DD-WRT only seems to have it for one model, but that doesn't seem to compile and there seems to be a question of whether it is open source any more.

Part of the problem seems to stem from all the different chipset and hardware configurations, but surely someone somewhere has managed it?

Thursday, June 20, 2013

Is Oracle trying to kill Java?

I'm a big Java fan, but it seems that Oracle, and before them, Sun, are doing everything in their power to put people off using it.

I've just run one of my applets that I run every day.  Today Java came up with a new window saying my version of Java was insecure and "would I like to update it?".  I clicked on OK, and it took me to the download page.

"While it's downloading", I thought, "I'll go back to my applet.  I don't really have time to install the update today."  I didn't bargain for the fact that Oracle had other ideas.  Now, every time I go to the page with the applet, it is automatically redirected back to the Java download page.  Until I update my Java, Oracle won't let me view any web pages that have an applet.  What?  Who owns my computer, me or Oracle?  This is also Linux I'm running on, so installing isn't just a case of running "install.exe".  So goodbye to whatever I thought my job was, Oracle has decide that the only thing I can do now is update my Java.

If that doesn't put people off using Java I don't know what will.  I like Java (the language) and use it for almost all my programming, but I wouldn't use it for applets unless you held a gun to my head.

tl;dr - Don't use Java for applets unless you want to lose control of your own computer.


Friday, May 24, 2013

Android Football!

Allow me to announce my latest Android game: Android Football!


I've always wanted to create a football game, and with touchscreen controls it gets round the problem that old-style football games have in deciding which football player is under control.

But before kick off, the first thing to do is choose your teams formation.  One aspect I'm quite please with is the AI of the players.  They always seem to be in the right place at the right time.



Once the game has kicked off, you control the players by dragging a line from the player to where you want them to go.


The players will automatically kick the ball when they hit it.  The direction is determined by the angle the touch the ball at, in the same way as a game of air-hockey (though this game is thankfully not quite as frenetic!).


The free version only has friendly games, but gives you all the features of the actual match so you decide if you like the game.  In the full version you can also play in a league, and choose the number of other teams.  If it proves a success, I'll be adding a Knockout Tournament option to.

Thursday, May 09, 2013

I've had a great idea!

I know, I'll add the Google+ API to my game Stellar Forces!  That way, new players will be able to sign up quickly and easily!

[3 hours later, after jumping through lots of Google-shaped hoops...]

What a waste of time.  I think I'll keep it the way it was.

Friday, April 26, 2013

When is Normal not Normal?

Say you've got a vector that you want to normalize:-

Vector v = new Vector([a number], [another number]);
v.normalize();

What would you expect to happen if both your numbers (maybe the movement vector of your space invader) were 0?

I would hope it would return a vector of (0, 0), so that when you added this vector to your sprite's co-ords, it didn't move.  Which, with a vector of 0, 0, would be correct.

Unfortunately, in Android Java (and maybe normal Java as well), it returns (NaN, NaN), which is no use to anyone.  I'd prefer an error at least (failfast?) so that I knew something unexpected was happening.  With NaN, all your sums suddenly go awry, and until you know the above piece of information, you'll spend ages trying to work out just how your vector is turning into garbage and why your sprite has decided to move to infinity on both axis.

Wednesday, March 06, 2013

Was making money harder then or now? [Android]

I'm at that common stage of Android development where I'm wondering what my next project should be.  I'm tempted to do something in 3D, but it always turns into a maths nightmare.  Note to self: Don't do it!

I've recently finished my last app, a platformer called "Ninja!".  It's pretty good, and I might use the engine for something a little more complex - I'm thinking a Bladerunner-y / Judge Dredd.  However, I am put off by the sheer number of other platform games available on Android (not that the platform genre is any more saturated than any other genre on Android).  Who would even notice my game?  I guess that's why marketing is so important on Android now, probably more so than the programming.

But then I look back to the golden age of gaming (in Thatcher's Britain anyway): the mid-80's, when it was predominatly the Spectrum that everyone played on (and maybe the C64 if desperate).  How do conditions now compare to then?  There may be thousands of platform games available for Android, but there are also millions of users playing them.  What was it like in the 80's?  According to Wikipedia, 5 million Spectrums were sold and 24,000 programs were released.  According to some random website I found after Googling, there are 295 million Android phones and 460,000 Android apps.  Despite the fact that these numbers are untrustworthy and vague, lets work out the average:-

Spectrum:-
5,000,000 devices and 24,000 programs = 208 customers per program.

Android
295,000,000 devices and 460,000 apps = 641 customers per app.

So it seems that despite the competition, we've got it over 3 times better than they did in the 80's.  Still, it doesn't seem like it.  Maybe I should stop programming and do marketing for the time being.

Monday, February 11, 2013

New Android Game: Ninja!


It's a platformer.  Avoid the enemy ninjas (or throw shurikens at them) and negotiate the fiendish levels.

One of the great things about creating a "platformer engine" is that once it's created, it's simply a case of having fun designing levels.  Going through historically classic platformers and implementing your own version of their ideas, and being able to play it straight away, makes all the hard work worthwhile.

I've also written the code for moving platforms, but I'm still trying to work out how to include them in the map data; the map data only handles a block type in each "cell", whereas moving platforms require data on the direction to move in, and the distance.  More on that in a future post.

Anyway, find Ninja! here!


Tuesday, February 05, 2013

Eclipse Hangs or Freezes on Startup

Try this:-

  1. cd .metadata/.plugins
  2. mv org.eclipse.core.resources org.eclipse.core.resources.bak
  3. Start eclipse. (It should show an error message or an empty workspace because no project is found.)
  4. Close all open editors tabs.
  5. Exit eclipse.
  6. rm -rf org.eclipse.core.resources (Delete the newly created directory.)
  7. mv org.eclipse.core.resources.bak/ org.eclipse.core.resources (Restore the original directory.)
  8. Start eclipse and start working
 (Thanks to Olaf)

Monday, November 12, 2012

Installing Java for Applets

I've blogged before about the fact that Sun (and now Oracle) like to make it as difficult as possible to get Java working, especially for applets.  You can spend hours trawling the new for soutions, but often they don't work due to differing versions of your OS, of Java and your browser.

However, for future reference I've found this page which seems to wort and is incredibly simple:-

http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html


Wednesday, November 07, 2012

Julian Gollop Announces New Chaos

If you're a fan of Chaos then you probably already know this, but Julian Gollop, famed developer of strategy games, has announced he's working on a new version of Chaos.

Chaos is indeed a brilliant game; that's just one reason why I copied it so faithfully for my own Sorcerers for Android.  I hope Julian won't mind if I treat this as a bit of competition between us as to who can create the best game.  I'm bound to lose, but it's the kind of impetus I need to keep working on a game.  And there can be no losers!

Friday, November 02, 2012

Speed Warning

Here's a new app which will hopefully save me money from those annoying speed cameras.

Without wanting to get too political on this blog, what really gets me about being caught for speeding is that it's too easy to creep over the speed limit.  Staying on the right side of the law shouldn't be a test of skill, and the more time you spend looking at your speed dial, the less time you spend looking out the window to check you're not going to crash, which can't be right.

Anyhoo, either way, my new Speed Warning app for Android should help and save people from the usual speeding fines.  It sits on your dashboard and will show you your current speed, in either Miles per Hour or Kilometres per Hour, depending on what your country uses. 

The main feature however, is to give you a visual and audible warning should your speed creep over the limit you have set, which can be easily adjusted with the '+' or "-" icons.  So now you can keep your eyes on the road at all times without worrying if you're breaking the law.