Posts Tagged ‘android’

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!

Adventures in Java

April 12, 2012

In the end, I don’t want much as a developer.

I want a canvas that I can draw images and text on.

I want the ability to play a sound, and the ability to set the volume of that sound.

I want to be able to respond to keyboard and mouse input.

And I want to be able to set a timer that periodically does something.

And that’s all I want to do.

Also, I’m impatient, and I don’t want to take the time to learn a new tool or API or method of deploying something.

However, at the same time, I want a decent tool for debugging, and a simply way of deploying.

Eclipse, I must say, is a decent tool for writing and debugging code.

Even though the various Java platforms resist anything being easy.

I have played with Slick2D, playn, LWJGL, and Android development.

Playn seems like too much of a black art for me to want to try to use it.  It had me downloading all sort of nonsense like maven and git and the gwt.

I didn’t mind the android SDK. I was able to get going with OpenGL on it.

The main issue for me was that it took a really long time for the emulator to start up, so android development work would take me quite a long time.

So, I like LWJGL and Slick2D.

And, because I have now taken the time to learn how to structure my Java projects into different packages, I can create my game in such a way where there is very little platform specific code separated from the game code and renderer.

Both the web platform and desktop platform can share a renderer, and the android gets its own renderer, but the underlying logic winds up the same.

Everything else is configuration.

So, a common library of useful classes is one package.

One package is the abstract game logic.

One package is a platform specific renderer.

One package is the overall wrapper for the platform.

(In the case of the Android, the renderer/platform shell can be the same package).

And I feel like I’m “architecting”.

But at the same time, I’ve gone back to basics.

Rather than write most of a usable game prototype, I made HelloLWJGL.

It works in eclipse.

I made HelloLWJGLApplet.

It also works in eclipse.

Next, make HelloLWJGL work as a runnable jar downloadable to Windows, Mac, and Linux.

Next, make HelloLWJGLApplet work in a web page that I upload to my Dropbox account.

And I LEAVE THESE THINGS AS PATTERNS SO THAT I CAN REFER BACK TO THEM AND NOT HAVE TO STRUGGLE SO MUCH.

So I’ve learned the language.

I’ve learned the tool.

I’ve learned the platform.

Now it is time to do some damage.

Stuff I Need To Do

March 2, 2012

Writing this down in one spot, so that I can measure progress against it.

  1. Learn to make a stand-alone JAR for CTYR that works on my mac, and do it.
  2. Learn to make a stand-alone JAR for CTYR that works on my linux box, and do it.
  3. Learn to make an applet for CTYR that works on my windows machine, my mac, and my linux machine, and do it.
  4. Learn how to sign my JARs, and do it
  5. Learn how to make an Android version of CTYR that works on my phone, and do it.
  6. Learn how to get a free version of CTYR in the Android marketplace, and do it.
  7. Make JetLag, complete with ASCII graphics, JetLag theme, and all the lucky charms, for desktop windows/mac/linux and Android.

Rudimentary Configuration Loading

May 25, 2011

I have achieved some of the basics for reading in XML configuration files into descriptor objects for HamQuest for the Android.

I put in the ability to specify types. This time around, I am not having the loader automatically trying to determine the type of data it is for the primitive data. The only assumption that it makes is the if there is no type specified, then it must be a string.

Also, since I do not want to shave the yak of introspection, I’m going to wind up with a small number of fixed types that can be loaded in. Really, there won’t be all that many, mainly weighted generators and string sets.

Getting this part done is highly important to the project. Upon this section lies the functionality of the rest of the application. Without it, I cannot even generate a room, nor a room’s contents.

—-

I started playing a game on my phone called “Adventure Ho!”.

It oddly has nothing to do with prostitutes.

It is one of those “whimsical” RPG-ish games. You choose a highly unlikely protagonist, purchase highly unlikely weapons and armors, and fight against highly unlikely antagonists in equally unlikely scenes.

For example, I am a Hamster armed with a leafblower and wearing a denim jacket. I just came through the casino where I fought against people like bouncers and drunks.

Basically, it is a “manage your hitpoints and mana and inventory” game.

You proceed through various locations, each one with a particular number of enemies to fight to get through it.  Each character has his own strengths and weaknesses.

I was starting to think that a similar type of game could be used for a HamQuest type game, meaning the same sort of combat mechanics as HQ, but without actually moving about a room, but instead going between locations. The locations would be towns/shoppes/places to buy stuff, or areas where a particular enemy to fight is, and the paths between places would be a particular number of monsters to fight to get through.

Its a thought, anyway.

I’d likely have to do things like add special abilities (i.e. “spells”) to HQ in order to make this work.

And naturally, the locations would be arrange in a maze of pathways. Can’t get away from mazes that easily, you know…