Splorr! (Opening and Closing Doors)

July 14, 2012

Splorr! Now has the ability to open and close doors!

And I think I’m doing to stick with the tap-fest that is my UI.

At first, I was thinking that I wanted to be able to have the player accomplish tasks with a low number of taps, ideally 1 tap for each action.

Then I realized that I don’t, actually. Let the player tap seven times to perform an action. It’ll make him feel like he’s accomplished something.

For example, I’ll take you through a typical action sequence upon entering a room.

In the following image, I’ve just entered a room:

At the moment, I’m facing a wall, the door I just opened and went through is behind me, and there is a passageway to the right.

I don’t want to go back to the room I was just in, so I decide to turn right and go through the passageway.

First, I tap the “Move/Turn” button.

Now I tap turn right to get the following:

Now that I am facing the right way, I move forward in two taps, first by tapping “Move/Turn”:

And then by tapping “Move Forward”, whereupon I will see the following status:

And now there is a closed door in front of me.  To open it, I need three taps.  First, I tap “Room”

Then I tap “Doors/Walls”

And finally tap “Open Door”.

And so, the game becomes a bit of a micro-managing tapfest, but I think that’s what I want.

 

Stock Market Game Released

July 6, 2012

Today I finally got Stock Market published.

You can find the support page here.  It has a the googl play badge.

While still a long way from being highly engaging, these games are getting more complex as they get more “sophisticated”.

However, I’m still not done with the “show some text and push buttons” genre.

I am, however, rather sick of the games where the outcome of the game is totally random.

I might as well be making a slot machine game (which is actually on the list, btw, but as a graphical game).

In stock market, I have so far not seen any reason not to do the following:

Buy one stock of each type.

Click “end turn” until the game is over.

It isn’t like there is some data upon which to base how well a stock can do.

Which means I may as well not bother making a choice at all.

Games are about choices.  Well, compelling games are about choices.  Sometimes the only winning move is not to play.

Next on the docket: Splore!  Of course, it may not come out next, but I want to work on it next.

I don’t really want to say too to describe Splore, or I’ll tend to have a lot of text written about a game that doesn’t exist.  The basic idea is a text based HamQuest.

Russian Roulette Completed

June 26, 2012

So, I managed to get RR done today.

Rather than my “one activity=one game state” idea that I used for GMN and RSP, I went with a single activity for everything, and using setContentView to change the UI for the states.

Generally, it worked extremely well.

Except.

The one edit text I was using (the one where you type in the number) first wouldn’t cause the soft keyboard to come up.

Fixed that.

Then the soft keyboard wouldn’t hide unless the “back” key was pressed.

No good.

Eventually, figured it out, mostly by googling code until finding something suitable at stackexchange.

Had to hide it myself.

Not a big deal, but it was not something I had to deal with when it was one activity per page.

Maybe that was the better way?

Dunno.

A Few Things, Mostly Android Related

June 26, 2012

First, I “finished” Rock, Scissors, Paper.  Here’s the support page.

A few post-mortem items about RSP:

  • Subclasses of Activity do not make good game states.
  • I’ve officially outgrown LinearLayout.
  • “There Has Got To Be A Better Way”™ to manage strings.

The next game is either Russian Roulette or Feed the Fish, dunno which.

After another quick game or two, I’m going to need to put a link or something on the about page to my “publisher page”.

Also, after a few days of being up there, GMN has had three whole installs.  One was me. Another was my wife.  A third was from somebody in the UK.  Thanks, guy in the UK. Eventually I’ll get to making something worth playing on this platform.

In my current projects, I’m taking a page from the publishers of my books: build a vast array of craptacular titles so that on your two or three good titles, you can mention that you have a large number of titles available.

However, I will be sticking with free until I actually make something worth paying for.

Android Development Day Two

June 20, 2012

Today, learned a few things.

How to move from one Activity to another.

A bit more about the xml layout for controls, specifically layout weights.

The eclipse built-in way to take a screen shot from the emulator.

Even a simple game like “Guess My Number” needs things like a Main Menu, an Instructions page, and an About page.

I also bought myself a developer registration for the Google Play store.

Yes, I’m actually planning to publish the craptacular “Guess My Number”.

And I’m doing it in Java, not a cross platform hoop-de-hoo.

Why?

I already know Eclipse.

I’ve already been working in Java relatively steadily for Minecraft Plugins and other side projects.

The android UI stuff isn’t very hard.

And I’m already time constrained. Church, house, job, kid, marriage (alphabetical order).

And the entry fee was only $25.

Basically, if I do nothing more than release GMN for free in Google Play, then the $25 I spent was worth it, because I get an accomplishment badge – “Published Android App”.

If I go on to do a bunch of other craptacular games: Russian Roulette; Rock, Scissors, Paper; a turn based “Stock Market” simulator; and things akin to old David Ahl games, then all the better.

If I improve in my command of the platform, and decide to go more sophisticated, I can do that.

If one day I find something sell-able, I can do that, too.

And if I don’t…. $25.

 

A Complete Android Game

June 18, 2012

And here’s the source code:

package com.pdg.android.sandbox;

import java.util.Random;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class SandboxActivity extends Activity {
    private static final int INITIAL_GUESS_COUNT = 0;
	private static final int NUMBER_MAXIMUM = 100;
	private static final int NUMBER_MINIMUM = 1;
	private int guessCount;
	private Random random = new Random();
	private int number;

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        startGame();
    }

    private void startGame() {
    	pickNumber();
    	setGuessCount(INITIAL_GUESS_COUNT);
    	setPrompt(getString(R.string.guess_my_number));
    	updateGuessStatus();
	}

	private void pickNumber() {
		setNumber(random.nextInt(NUMBER_MAXIMUM-NUMBER_MINIMUM+1)+NUMBER_MINIMUM);
	}

	private void setNumber(int theNumber) {
		number = theNumber;
	}

	private int getNumber(){
		return number;
	}

	private void updateGuessStatus() {
    	setGuessStatus(String.format(getString(R.string.guess_count_format), getGuessCount()));
	}

	private void setGuessStatus(String theGuessStatus) {
		TextView tv = (TextView)findViewById(R.id.guessCount);
		tv.setText(theGuessStatus);
	}

	private int getGuessCount() {
		return guessCount;
	}

	private void setGuessCount(int theGuessCount) {
		guessCount = theGuessCount;
	}

	private void setPrompt(String thePrompt) {
		TextView tv = (TextView)findViewById(R.id.prompt);
		tv.setText(thePrompt);
	}

	public void guessButtonPressed(View view){
		EditText et = (EditText)findViewById(R.id.currentGuess);
		int theGuess = Integer.parseInt(et.getText().toString());
		setGuessCount(getGuessCount()+1);
		updateGuessStatus();
		if(theGuessgetNumber()){
			setPrompt(getString(R.string.guess_too_high));
		}else{
			setPrompt(getString(R.string.guess_correct));
			setGuessCount(INITIAL_GUESS_COUNT);
			pickNumber();
		}
    }
}

Yes, it is the perennial classic “Guess My Number 1 to 100″ game that just about everyone has written.

Why did I write this?

Mainly, I’m teaching myself the view based xml ui for android.

This is how I do it.

By writing an entirely too simplistic game.

But now I know how to put resources correctly into xml files, how to grab widgets by id, and how to set text values on TextViews.

Of course, the thing still blows up if you don’t put anything into the edit box and press “Guess!”, but that’s a feature!

Java CTYR, Now in the browser…

April 14, 2012

I get it now.

I really, really get it now.

After figuring out the stuff in LWJGL to make it work in a browser and show a black rectangle, I finally figured out how get a Slick2D app to do the same thing.

And here it is.

So now, from exactly the same code base, I can generate both the stand alone runnable jar and the web browser app.

The deployment is different, but that’s fine.

I can do it.

Yay for me.

Updating Minecraft Plugins

April 14, 2012

So, I updated my bukkit plugins recently.

And when I did, the users were jubilant, like the onlookers in a Tom Slick race.

And I noticed that there were some tickets associated with my plugins, some of which were submitted by me, some from others.

Neat! I’ve actually got people interested in the improvement of my software.

So, I start to address them, now that I have straightened out my Java workspaces thanks to Dropbox.

And I was cruising along, and made a few additions.

One of the most important parts any bukkit plugin is the command console processing.

Generally there is at least some sort of command that need to set configuration or otherwise check the status of the plugin.

In the one I am working on now, SpawnSurance, has to process a lot of config parameters.

And looking at the code, it was of the nature:

  • if there is one parameter
    • if the parameter is X
    • if the parameter is Y
    • if the parameter is Z
  • if there are two parameters
    • if the parameter is X
    • if the parameter is Y
    • if the parameter is Z
  • if there are three parameters
    • if the parameter is X
    • if the parameter is Y
    • if the parameter is Z

Which is obviously a mess to have to maintain and deal with, especially since added a new parameter that takes the rest of the parameters and concatenates them to add to a custom message.

So, after now acquiring quite a bit of Java experience, I know that I can use List<String>, copy my String[] of arguments over to it, and process through them in a more natural way.

  • if the first parameter is X
    • remove first parameter, then process with the processX method
  • if the first parameter is Y
    • remove first parameter, then process with the processY method
  • if the first parameter is Z
    • remove first parameter, then process with the processZ method

Which is way more maintainable.

But I got hoist on my own petard, and had a hard time finding out why or how I had done so.

I have had a bizarre fetish for not using magic numbers or strings.

I put everything into a class called Constants, and there are a large number of public final static String X = “something”; and public final static Integer Y = 0; and so on.

Which is a good idea, but here’s where I went awry.

All of my constant integers were Integer, not int.

So, when I had my List<String>, I was passing Constants.argCountZero (an Integer) into the remove function.

There are two remove functions for List<String>. One takes an int, the other takes an Object.

Integer is an Object.

So called theArgList.remove(Constants.argCountZero) DID NOTHING!

BECAUSE IT IS AN Integer, NOT AN int!

Of course, this took me about an hour to determine.

Sigh.

The Answer is Dropbox

April 13, 2012

I have multiple machines that I develop on.

When doing C# dev, I can use SVN and google code or assembla and keep things synchronized pretty well.

For Java dev, I have not had as much success.

For one thing, eclipse has a large number of frivolous files that I just don’t need checked in.

Also, I tend to leave out the bin directory when I’m checking in to SVN.

This apparently confuses eclipse.

Yes, I tried the svn plugin.

Hated it.

So, the answer is Dropbox for Java projects.

However, the way I install it is not the standard way.

The standard installation in Windows puts the folder under C:\Users\USERNAME\Dropbox

Not all of my machines have the same user.

So I put it in a custom location instead.

C:\Dropbox

This way all of my classpath and other garbage stays consistent between the machines I develop on.

Also, I’ve gotten more organized with how my Dropbox folder is organized.

I have a Libs folder with subfolders for the various external dependencies that I have, like lwjgl, slick, zxing.

I have a Projects folder with subfolders for the various workspaces. I similarly split workspaces by broad category.

Sigh. Getting there…


Follow

Get every new post delivered to your Inbox.