Uncategorized

Stock Market Game Released

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.

Uncategorized

Russian Roulette Completed

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.

Uncategorized

A Few Things, Mostly Android Related

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.

Uncategorized

Android Development Day Two

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.

 

Uncategorized

A Complete Android Game

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!

Uncategorized

Java CTYR, Now in the browser…

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.