Tuesday, 29 March 2011

Long Time No Nothing

Wow long time. So I've been a little busy with the random happenings that is life. All in all nothing exciting or worth mentioning. Uni is a bit of a bore. Little to no software development makes it very boring. And means I have no content for you guys. [Sadface]

miTanks is on hold again while uni is busy. Been playing a lot of age of empires 3 on my downtime. Good game.

Anyway, here are a couple random pictures I've saved onto the work computer.

Will post something tomorrow or the next day about M-Theory, String theory, as I have been watching heaps of videos about it at work. Some interesting concepts there.

Thursday, 10 March 2011

miTanks, Part 11

FINALLY!!! After 5 days searching the net and testing heaps of different custom views, I've drawn a circle. That's right. 5 days of work and all I've done is draw a circle. This must sound rediculous but this is the biggest break though. Look! Here it is:

It's amazing. Now I simply had to copy over the view handling bits of code to miTanks and BAM!

We get an ugly, badly drawn game of tanks. It's nice. So now I'm working on tweeking the look so that it, well, works. For those of you using the code snippets I'm putting on here, the main bits are:

In the main class:

public class miTanks extends Activity {

private GameView gv;

/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
GameView gv = new GameView(this);

In the GameView:

public class GameView extends View{

private final Paint PAINT;
private static final Bitmap[] TANK_IMAGES = new Bitmap[8];
private static final int[] TANK_COLOURS = new int[8];
private final GradientDrawable BACKGROUND_GRADIENT;
private static GameView INSTANCE;

 * Initialises the GameView.
 * @param context
public GameView(Context context) {
 * Draws the game onto the canvas.
protected void onDraw(Canvas canvas){

In the main.xml:

<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:maxHeight="40dip" />

Tuesday, 8 March 2011

miTanks, Part 10

It's not working... I've been trying different ways to get the game to draw to screen though I just don't have it working yet. Fixed a couple minor bugs, as I hadn't moved everything across from the PC version.

When running I follow the debug and step through the program. Turns out the game runs perfectly, that is the game constructs and plays out completely with two random computer players, except it never draws to the screen. Thought the onDraw(Canvas canvas) method would be called automatically every couple of milliseconds. Turns out no. So, I need a way to get the canvas (i.e. the screen) so that I can call the method myself. Working on it...

If anyone knows how android views work, let me know...

As for sounds, I have this site that generates old school game noises. So I'll probably use that for my sounds. Means I don't have to search for people to make decent sounds. Lol. Sorry to those of you that did help with that. There just weren't enough to continue with them.

So the site looks like this:

Here is the link. Will probably be my one stop shop for sounds in the future. Check it out.

My roommate made me a little icon for the game as well. His tanks looks better than the little ones I made in the last post. So may end up replacing them with copies of his. I'll post the icon when I have my computer again.


Saturday, 5 March 2011

miTanks, Part 9

That's right! miTanks is back. After a very very long break I've got motivated to finish it. Or at least get it on the platform it was originally for. Haven't really had much commitment from Foo, which is both our faults really. I'm not the best teacher and he has little / no coding experience. And lobbing him with graphics was not the best move.

Sorry to everyone that doesn't have an Android, but you can still enjoy my struggle with xml and the Android graphics classes... And the PC version will still have the same look and feel as the Android version, with the obvious touch-screen exception.

Can't remember if I've said already or not but this is a fantastic, simple example of how to make a game on Android. The game is open source so I'm basing the majority of figuring out how to do graphics on this. For those of you know don't know software programming is basically: "Learn the basics; google the rest."

Image courtesy of xkcd.

I think I have a pretty good idea of what I need to do now. The tanks are going to look something like this:

And the turrets are just going to be a black smooth edged square, pointing at whatever angle they need to. The ground is either going to be a solid colour or each pixel will be 1 of three colours. This will depend on how much time it takes up to search and utilise a very very large 2D colour array.

I'll be using the sky square (not a box, it's 2D) Foo created earlier, because it is awesome. This will be the background of most of the levels. Might end up overlaying some objects like a building or something.

What else? Damage isn't quite right. The tank only takes damage if the very centre is hit. Not a major flaw but not very ascetically pleasing.

I'll get to work on this all tonight and post something on Monday(?) about what I have done.

Links to the other miTanks posts:
Part 1, The Plan
Part 2, Initial Concept
Part 3, Object Oriented Design + Update
Part 4, Sound Request + Update
Part 5, First Screenshots
Part 6, Ground Types
Part 7, Weapons + Ground Dynamics
Part 8, Initial Release

The last one contains the initial release for PC. Have a look at that if you haven't already. Just renamed all my posts... I had two part 4's AND 2 part 6's. That's just bad...

And as always suggestions are always appreciated.


Friday, 4 March 2011

Internet Game / General Update

So I've started back at University this week. It's pretty boring so far. Seems that a lot of the code writing stuff is going to happen later on. Which is gay. It means no exciting content for this blog for a wee while.

Also I have recently moved house, which means I can only get online at University, and so haven't been on the blog or anything exciting for a while. Should have internets by next week though.

Supposed to be learning about networking this semester so hopefully, I should have a nice network game to stick on here for you all. That would be awesome.

Something fun:
Has anyone tried to play QWOP? You are Qwop, our small nation's sole representative at the Olympic Games. Ideally you will run 100m but our training program was under-funded. Remember, it's not about whether you win or lose.

Basically you have four buttons, Q, W, O, and P, with which you control the runners thighs and calves to make him run 100m. Sounds easy right? Shit no!

Woo! Straight away instead of running, I decide to do a backflip... Not good. After a decent amount of gameplay my record is 5.5m. Good job Qwop.