Share

I’m working on my game, try to publish an Android build to see how it looks on the phone, and Eclipse throws this error. A quick Google search turns up the cause, and the fix. But then the implication of this error hits me. About an hour ago, I completed my first year of Android development. That called for a moment of silence and introspection. And a blog post, of course.

 
Share

I recently added some code to the Neil Rajah to set up levels that are biased towards combat (flatter regions, which would let the generator place more enemies, more health pickups), and others biased towards platforming (more ups and downs, more diamond pickups). The code was pretty simple, or so I thought:

    public Element generateLevel(int level) {
        rand.setSeed(level);

...

        // After level 10, levels are either biased towards platforming or combat
        if (level >= 10) {
            float f = rand.nextFloat();
            if (f <= 0.3f) {
                ChanceUp = 0.05;
                ChanceDown = 0.05;
                ChanceHealth = 0.3;
            } else if (f <= 0.6f) {
                ChanceCoin += .2;
                MaxTrapLength = 8;
            }
        }

Pretty straightforward. I seed the random number generator with the level number, so it always generates the same level every time. Then the second block of code picks a combat level (lower chance of height changes, higher chance of health), a platforming level, or a normal level, with about 30% probability each.

Well, this didn’t work. Some trace statements showed that rand.nextFloat() almost always generates something very close to 0.73, so all my levels were ending up as ‘normal’. This was a surprise to me. I had assumed that changing the seed would completely change the pattern of numbers generated, but it turns out that that’s not the case. So I wrote a little test program to see how this worked:

    private void testRand() {
        for (int i = 0; i < 10; i++) {
            Random rand = new Random();
            rand.setSeed(i);
            String str = "seed " + i + ": ";
            for (int j = 0; j < 50; j++) {
                str += Double.toString(rand.nextDouble()) + ",";
            }
            Gdx.app.log("", str);
        }
    }

And here’s the output, graphed in Excel:

It looks pretty random, except for the first generated number, which is almost identical across all the seed values. Maybe others knew this about random number generators, but it surprised me. Notice how the numbers converge at the 10th sample as well.

The solution turned out to be fairly simple. Since Random.setSeed() takes a long, I just multiplied the seed by 1 billion. That produced this output:

That’s more ‘random looking’, if you ask me. So I’ve put this back into my level generator – the seed is now the level number, multiplied by a billion. It feels like the game now has more variety in the levels, but my judgment on that is probably biased, since I know what I just changed.

So if you’re using random numbers like I am, where you’re seeding it with a fixed value to generate ‘reproducible random data’, you might want to keep this in mind. if your seed values are close to each other, the first generated number will be almost identical across all your runs. It doesn’t seem to matter what the seed value is – if they’re close together, the first generated number from nextFloat() or nextDouble() will almost always be 0.73xxx. Kinda weird, if you ask me. If someone has an explanation for why it does this, I would love to hear it.

 
Share

Here’s a quick video showing some of the work I’ve done in the last week. These changes are mostly to incorporate feedback I got from some play testing.

Main changes:

  • Jumps are now controlled by the user. Holding the button down makes you jump higher. Within limits, of course. The level generator has been tweaked for this – gaps are longer, platforms require a pretty long jump. Still need to work on tweaking this some more
  • Some vertical edges have spikes, to discourage the player from stopping to catch his breath or think. This was my lazy solution to a suggestion that the camera should keep moving if the player stops, and he should die if the left edge of the screen catches up with him. Which is a great idea, but I couldn’t figure out a way to fit it into the game / story. I’ve played games where you’re in a mine and a big rock is rolling towards you, but that fits in well with the context of the game
  • Started working on the menu screens. The level selection screen is an attempt at a ‘flick scroll’ screen, using my hacked version of someone’s modification of a libgdx class

Still needs work in many areas. Next up is probably tuning the collision boxes. And then animations for enemies that die, and maybe score bubbles.

 
Share

I don’t think this needs much explanation, the charts speak for themselves.

Here’s data from Flurry on all devices that Bus Jumper was played on, for the month of October:

And the same data for the month of January:

Note that the number of sessions on the Samsung Galaxy devices hasn’t really changed. But I added over 20k sessions on the Fire, which was almost 20% of the month’s total.

 
Share

Enemies are animated, and there’s some minimal enemy ‘AI’ to make them shoot. I hesitate to call it AI, because all it really boils down to is, if you’re on the screen, and enough time has passed since the last time you shot, you shoot again. Artemis and box2d made this pretty easy. Collision groups ensure that the icicles and eggs won’t collide with the birds and trolls. I already had damage and health components/systems set up, and those work just as well for doing damage to the player as they did for the enemies.

I’ve spent some more time tweaking the level generator to try and make the level difficulty increase smoothly. Obviously, you can’t see that in a single level. I think the generator still needs a little more work. Most of the levels seems pretty fun to play, but there are a couple of spots where I think the generator could be improved.

 

 
Share
This entry is part 12 of 12 in the series Android Income Stats

Ad Revenue

sCatterBus JumperDrippy the RaindropTotal per Month
Total per Game$47.82$744.66$62.82$854.95
ImpressionsClicksRevenueImpressionsClicksRevenueImpressionsClicksRevenue
April93516$0.18------$0.18
May7,915148$3.15277,1662,351$59.53---$62.68
June17,871366$4.55212,8974,081$63.02---$67.57
July17,708471$11.38309,3953,113$108.6017,819199$3.52 *$123.50
August12,441203$2.49259,4812,428$44.7015,590176$1.79$48.98
September7,464122$2.01155,0011,573$39.987,678174$1.93$43.92
October7,766101$2.57243,5781,735$58.1621,128277$3.93$64.66
November14,922284$6.63264,2783,429$72.9521,682456$7.34$86.92
December22,517325$7.59432,8637,447$169.2142,1231,368$29.79$206.59
January19,176328$7.27461,1968,670$128.1652,5141,013$14.52$149.95

Continue reading »

 
Share
This entry is part 6 of 6 in the series Alternative Market Stats

Here’s the data for January 2012. These numbers are for the free version of Bus Jumper, sorted by downloads in the last month. I’ll post Mobclix revenue numbers in a few days.

MarketDownloads (November)Downloads (December)Downloads (January)Downloads (Total)
Amazon153195548597482
Google37835917483159328
SlideME27973221707438
GetJar704201021553715
AppChina778116714226434
Appia13859146014222
AndroidPIT2083343881997
Mobango151018861974890
AppsLib2425011662752

Continue reading »

 
Share

I have to admit, I’ve been pleasantly surprised at watching Bus Jumper take off on the Amazon appstore. As I’ve mentioned earlier, the release of the Kindle Fire provided a big boost in my Amazon downloads over Christmas. I was half expecting things to die down to earlier levels after some time. Well, it’s been a month, and while the initial spike is gone, things seem to have settled down to a pretty decent state.

Continue reading »

© 2011 Ziggy's Games Suffusion theme by Sayontan Sinha