Progress report TowerDefence

Hello Everybody,

After four weeks of silence, here by a short update about the game build progress. The design phase is ready, most graphics are also ready. Building the game engine is behide planning. I think it will take at least two more months to finish everything. Main delay is my work and family live. Two weeks ago I was in India for a business visit. Spin off of the visit is lots of work.

Best Regards, wplaat

RedSquare 10.000 downloads

Since the launch of RedSquare, back in 20 December 2008, it was downloaded over 10.000 times. Wow! :). So a very special thanks to everyone who’s been downloading, playing and commenting this game.

Official Count

Homebrew Browser 7.802 times
My website 1.112 times
Other websites around the world +/- 1.100 times
Total +/- 10.014 times

GRRLIB 4.0 freetype support

In this post i have add information how to add freetype library support to GRRLIB 4.0 library

Add the following source code section in the upper part of the GRRLIB 4.0 C file.

#include "font_ttf.h"

#define DEFAULT_FIFO_SIZE (256 * 1024)

u32 fb = 0;
static void *xfb[2] = { NULL, NULL};
GXRModeObj *rmode;
void *gp_fifo = NULL;

/******************************************************************************/
/**** FREETYPE START ****/
/* This is a very rough implementation if freetype using GRRLIB */

#include  /* I presume you have freetype for the Wii installed */
#include FT_FREETYPE_H

static FT_Library ftLibrary;
static FT_Face ftFace;

void *fontTempLayer=NULL;
void *fontTexture=NULL;

/* Static function prototypes */
static void BitmapTo4x4RGBA(const unsigned char *src, void *dst, const unsigned int width, const unsigned int height);
static bool BlitGlyph(FT_Bitmap *bitmap, int offset, int top, int color) ;

extern void GRRLIB_InitFreetype(void)
{
	unsigned int error = FT_Init_FreeType(&ftLibrary);
	if (error)
	{
		exit(0);
	}

	error = FT_New_Memory_Face(ftLibrary, font_ttf, font_ttf_size, 0, &ftFace);
	if (error == FT_Err_Unknown_File_Format)
	{
		exit(0);
	}
	else if (error)
	{
		/* Some other error */
		exit(0);
	}
}

extern void GRRLIB_initTexture(void)
{
   // Clear previous video frame buffer
   if (fontTexture!=NULL) free(fontTexture);

   fontTempLayer = (void*) calloc(1, 640 * 480 * 4);

   if (fontTempLayer == NULL)
   {
	  /* Oops! Something went wrong! */
	  exit(0);
   }
}

extern void GRRLIB_Printf2(int x, int y, const char *string, unsigned int fontSize, int color)
{
	unsigned int error = 0;
	int penX = 0;
	int penY = fontSize;
	FT_GlyphSlot slot = ftFace->glyph;
	FT_UInt glyphIndex = 0;
	FT_UInt previousGlyph = 0;
	FT_Bool hasKerning = FT_HAS_KERNING(ftFace);

    error = FT_Set_Pixel_Sizes(ftFace, 0, fontSize);
	if (error)
	{
		/* Failed to set the font size to the requested size.
		 * You probably should set a default size or something.
		 * I'll leave that up to the reader. */
		 FT_Set_Pixel_Sizes(ftFace, 0, 12);
	}

	/* Convert the string to UTF32 */
	size_t length = strlen(string);
	wchar_t *utf32 = (wchar_t*)malloc(length * sizeof(wchar_t));
	length = mbstowcs(utf32, string, length);

	/* Loop over each character, drawing it on to the 4, until the
	 * end of the string is reached, or until the pixel width is too wide */
	unsigned int loop = 0;
	for (loop = 0; loop < length; ++loop)
    {
		glyphIndex = FT_Get_Char_Index(ftFace, utf32[ loop ]);

		/* To the best of my knowledge, none of the other freetype
		 * implementations use kerning, so my method ends up looking
		 * slightly better :) */
		if (hasKerning && previousGlyph && glyphIndex)
		{
			FT_Vector delta;
			FT_Get_Kerning(ftFace, previousGlyph, glyphIndex, FT_KERNING_DEFAULT, δ);
			penX += delta.x >> 6;
		}

		error = FT_Load_Glyph(ftFace, glyphIndex, FT_LOAD_RENDER);
		if (error)
        {
			/* Whoops, something went wrong trying to load the glyph
			 * for this character... you should handle this better */
			continue;
		}

		if (BlitGlyph(&slot->bitmap, penX + slot->bitmap_left+x, penY - slot->bitmap_top+y, color) == true)
		{
			/* The glyph was successfully blitted to the buffer, move the pen forwards */
			penX += slot->advance.x >> 6;
			previousGlyph = glyphIndex;
		}
		else
		{
			/* BlitGlyph returned false, the line must be full */
			free(utf32);
			return;
		}
	}

	free(utf32);
}

/* Returns true if the character was draw on to the buffer, false if otherwise */
static bool BlitGlyph(FT_Bitmap *bitmap, int offset, int top, int color)
{
	int bitmapWidth = bitmap->width;
	int bitmapHeight = bitmap->rows;

	if (offset + bitmapWidth > 640)
	{
		/* Drawing this character would over run the buffer, so don't draw it */
		return false;
	}

	/* Draw the glyph onto the buffer, blitting from the bottom up */
	/* CREDIT: Derived from a function by DragonMinded */
	unsigned char *p = fontTempLayer;
	unsigned int y = 0;
	for (y = 0; y < bitmapHeight; ++y)
	{
		int sywidth = y * bitmapWidth;
		int dywidth = (y + top) * 640;

		unsigned int column = 0;
		for (column = 0; column < bitmapWidth; ++column)
        {
			unsigned int srcloc = column + sywidth;
			unsigned int dstloc = ((column + offset) + dywidth) << 2;

			/* Copy the alpha value for this pixel into the texture buffer */
			p[ dstloc + 0 ] = (color & 0xff);
			p[ dstloc + 1 ] = ((color >> 8) & 0xff);
			p[ dstloc + 2 ] = ((color >> 16) & 0xff);
			p[ dstloc + 3 ] = (bitmap->buffer[ srcloc ]);
		}
	}

	return true;
}

/* Render the text string to a 4x4RGBA texture, return a pointer to this texture */
extern void* GRRLIB_GetTexture(void)
{
	/* Create a new buffer, this time to hold the final texture
	 * in a format suitable for the Wii */
	fontTexture = memalign(32, 640 * 480 * 4);

	/* Convert the RGBA temp buffer to a format usuable by GX */
	BitmapTo4x4RGBA(fontTempLayer, fontTexture, 640, 480);
	DCFlushRange(fontTexture, 640 * 480 * 4);

	/* The temp buffer is no longer required */
	free(fontTempLayer);

	return fontTexture;
}

static void BitmapTo4x4RGBA(const unsigned char *src, void *dst, const unsigned int width, const unsigned int height)
{
	unsigned int block = 0;
	unsigned int i = 0;
	unsigned int c = 0;
	unsigned int ar = 0;
	unsigned int gb = 0;
	unsigned char *p = (unsigned char*)dst;

	for (block = 0; block < height; block += 4) {
		for (i = 0; i < width; i += 4) {
			/* Alpha and Red */
			for (c = 0; c < 4; ++c) {
				for (ar = 0; ar < 4; ++ar) {
					/* Alpha pixels */
					*p++ = src[(((i + ar) + ((block + c) * width)) * 4) + 3];
					/* Red pixels */
					*p++ = src[((i + ar) + ((block + c) * width)) * 4];
				}
			}

			/* Green and Blue */
			for (c = 0; c < 4; ++c) {
				for (gb = 0; gb < 4; ++gb) {
					/* Green pixels */
					*p++ = src[(((i + gb) + ((block + c) * width)) * 4) + 1];
					/* Blue pixels */
					*p++ = src[(((i + gb) + ((block + c) * width)) * 4) + 2];
				}
			}
		} /* i */
	} /* block */
}

inline void GRRLIB_DrawImg2(f32 xpos, f32 ypos, u16 width, u16 height, u8 data[], float degrees, float scaleX, f32 scaleY, u8 alpha )
{
   GXTexObj texObj;

	GX_InitTexObj(&texObj, data, width,height, GX_TF_RGBA8,GX_CLAMP, GX_CLAMP,GX_FALSE);
	//GX_InitTexObjLOD(&texObj, GX_NEAR, GX_NEAR, 0.0f, 0.0f, 0.0f, 0, 0, GX_ANISO_1);
	GX_LoadTexObj(&texObj, GX_TEXMAP0);

	GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE);
  	GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT);

	Mtx m,m1,m2, mv;
	width *=.5;
	height*=.5;
	guMtxIdentity (m1);
	guMtxScaleApply(m1,m1,scaleX,scaleY,1.0);
	Vector axis =(Vector) {0 , 0, 1 };
	guMtxRotAxisDeg (m2, &axis, degrees);
	guMtxConcat(m2,m1,m);

	guMtxTransApply(m,m, xpos+width,ypos+height,0);
	guMtxConcat (GXmodelView2D, m, mv);
	GX_LoadPosMtxImm (mv, GX_PNMTX0);

	GX_Begin(GX_QUADS, GX_VTXFMT0,4);
  	GX_Position3f32(-width, -height,  0);
  	GX_Color4u8(0xFF,0xFF,0xFF,alpha);
  	GX_TexCoord2f32(0, 0);

  	GX_Position3f32(width, -height,  0);
 	GX_Color4u8(0xFF,0xFF,0xFF,alpha);
  	GX_TexCoord2f32(1, 0);

  	GX_Position3f32(width, height,  0);
	GX_Color4u8(0xFF,0xFF,0xFF,alpha);
  	GX_TexCoord2f32(1, 1);

  	GX_Position3f32(-width, height,  0);
	GX_Color4u8(0xFF,0xFF,0xFF,alpha);
  	GX_TexCoord2f32(0, 1);
	GX_End();
	GX_LoadPosMtxImm (GXmodelView2D, GX_PNMTX0);

	GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
  	GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);

}

/**** WVDP: FREETYPE END ****/
/******************************************************************************

Add the following part in the GRRLIB.h file

/**** WVDP: FREETYPE START ****/
extern void GRRLIB_InitFreetype();
extern void GRRLIB_initTexture(void);
extern void GRRLIB_Printf2(int x, int y, const char *string, unsigned int fontSize, int color);
extern void* GRRLIB_GetTexture(void);
inline void GRRLIB_DrawImg2(f32 xpos, f32 ypos, u16 width, u16 height, u8 data[], float degrees, float scaleX, f32 scaleY, u8 alpha );
/**** WVDP: FREETYPE END ****/

For example how to use this extension, please download the RedSquare source code.
Good Luck with it ❗ If you have any questions, please post a comment.

Wii BibleQuiz 0.92

Today I released a new version of BibleQuiz. The following changes were made:

13/03/2009 Version 0.92
– Upgrade GRRLIB graphical render engine from v3.0 to v4.0.
– Improve intro screens.
– Added fps (frame-per-second) information on all screens.
– Added screenshot functionality with plus button.
– Pictures are store on the SdCard in the following directory sd:/apps/bibleQuiz
– Build game with libogc 1.7.1 and devkitPPC r16 compiler.

Download

Click here for more information and the download link.

Wii SpaceBubble 0.9

Today I released a new version of SpaceBubble. The following changes were made:

09-03-2009 Version 0.9
– Upgrade GRRLIB graphical render engine from v3.0 to v4.0.
– Improve intro screens.
– Added fps (frame-per-second) information on all screens.
– Added screen shot functionality. Press the plus button to make a screen shot picture.
– Pictures are stored on the SD Card in the following directory sd:/apps/SpaceBubble
– Build game with libogc 1.7.1 and devkitPPC r16 compiler.

Wii RedSquare 0.91

Today I released a new version of RedSquare for Nitendo Wii. The following changes were made:

08/03/2009 Version 0.91
– Upgrade GRRLIB graphical render engine from v3.0 to v4.0.
– Improve intro screens.
– Added play time information on game screen.
– Added fps (frame-per-second) information on all screens.
– Added screen shot functionality. Press the plus button to make a screen shot picture.
– Pictures are stored on the SD Card in the following directory sd:/apps/RedSquare
– Build game with libogc 1.7.1 and devkitPPC r16 compiler.

Note:
All my open issues with new GRRLIB library are solved. Thanks NoNameNo and Xane

Click for more information about issue 1 here. This issue is solved 😀
Click for more information about issue 2 here. This issue is solved 😀

Progress report TowerDefence

Hello everybody,

Hereby a short progress report of the design phase of the TowerDefence game. The gameboard design is all most ready. I am now concentrating on the game graphics. After this is ready i will implement the needed game logic. I am still on schedule 😆 I think the first beta release will be available half April.

Best Regards wplaat

Website upgrade

This evening i have upgraded my website.

The following changes were implemented:
– Because of a misunderstandment (1) 🙁 Google has disabled my Adsense Ads account. I hope we can resolve this issue soon. In the mean time i switched over to AdBrite Ads.
– Added AdBrite Ads banner to lower part of my website.
– Added AdBrite inline Ads.
– Added AdBrite banners to right sidebar.
– Added anti spam key word to comments input area. Reduce spam with 99%. 🙂
– Added category links to left sidebar for easy data access.
– Updated existing wordpress plugins to latest available version.

(1) My letter to Google Adsense after my account was disabled. After reading today for the first time the Terms & Conditions (During setup, two months ago, I just accepted the license agreement) I now understand want I did accidentally wrong. I was really under the impression that clicking on Ads was allowed if you are really interested in the goods/services with were offered. That was the ONLY reason that I clicked on it. I am terrible sorry that I accidentally violated with this behavior the Adsense Terms & Conditions. It was really not my intention. As you also can read on my website (www.plaatsoft.nl) all the Ads earnings are donated to a Christian non profit organization “Compassion International”. It is in no means for my own personal benefit. I hope with this background information you will reconsider to reactivated my Adsense account again. Wants again I am very sorry that I course Google (and Google customers) any problems. It was not my intention and I hope that we can restart doing business. Best Regards

Tower Defense design

Hello everbody,

This evening i created some art drawings how the game will look like. Ofcourse this is just a really high level art design. So anything can change in time. 🙂

Menu screen

In the menu screen the player can choose several option. Ofcouse there is a Help, Credits and Release Notes option. Sound Settings and User Initials settings for highscore area can be configured. The game it self can run in Easy, Medium or Hard game mode.

Map select screen


After selecting the game mode the player can selected a game map.

Gameboard screen


Gameboard contains al kind of information. Defense system can be drag-and-drop on the battle field. Defense systems can be upgraded in Power, Fire speed and Range.

I have decided to build the game in C++. An object approach for this kind of game is much better then the tradional ansi c approach. If you have any comments on the art drawings, please posted them below. Looking forward to it ❗

My new project

Hello everybody,

Many, Many thanks for your overwhelming reactions. 289 votes were made in total. I have analyze the poll and all the 86 comments. Most people (51 votes) like a Tower Defense kind of Wii game. That is a great choice! 😆 I will start today with designing, building and testing this new game. In four to eight weeks the first beta release will be available. If you would like to be a Beta tester please leave a comment below. I will send you an email when the first beta release is ready. Greeting!

If you would like to be automatic informed about the progress of this game,
please subscribe to my Posts RSS feed. Many thanks in advance for your subscription.

The first high level art drawings are ready for the tower defense game. Check it out here.

Final poll outcome

51 votes – Tower Defense kind of game
48 votes – Poker (Texas Hold style)
43 votes – Boulder Dash
41 votes – Tetris2

4 votes – Super Mario War

3 votes – NetHack
3 votes – Risk
3 votes – Battle Tanks

2 votes – Acrobatic flying game
2 votes – Multiplayer Quiz game
2 votes – Tetris Attack
2 votes – Smash bros
2 votes – Rampart
2 votes – GoldenEye 007

1 vote – Iphone physics
1 vote – Elastomania (2D motorbike game)
1 vote – Bungie
1 vote – punch-out game
1 vote – Audiosurf’s
1 vote – gta VI
1 vote – portal
1 vote – bioshock
1 vote – no more heroes
1 vote – madworld
1 vote – RE4
1 vote – Seconding FullMetalEngineer
1 vote – Pocket Tanks
1 vote – metalocalypse epidosde
1 vote – online rpg game
1 vote – Counter Strike
1 vote – online multiplayer
1 vote – ADOM
1 vote – Nethack
1 vote – POWDER
1 vote – Darkcut/trauma centre
1 vote – DukeScrewEm38d
1 vote – Carcassonne
1 vote – hunt for food
1 vote – Guitar fun
1 vote – Phun
1 vote – Teeworlds
1 vote – Wolfenstien 3d
1 vote – Postal
1 vote – Called stack
1 vote – Rubics cube
1 vote – Platformer Game
1 vote – Marble Madness cone
1 vote – Hogs of War
1 vote – Gunbound
1 vote – Wild Canon
1 vote – Worms
1 vote – Freeciv (RTS game)
1 vote – Quake 2
1 vote – Wii Physics Game (with story + objectives)
1 vote – Command & Conquer
1 vote – Defendin the Penguin
1 vote – Rhythm Tengoku
1 vote – ChuChu Rocket!
1 vote – OpenTTD
1 vote – Painting game
1 vote – Marble Madness!
1 vote – Bang Bang
1 vote – bump n jump
1 vote – cube runner
1 vote – SMB
1 vote – gang garrison
1 vote – motorcycle trial racing game
1 vote – Liquid War
1 vote – Puzzle game
1 vote – Eye Of Beholder
1 vote – Dungeon and dragons
1 vote – FiSSION
1 vote – Counter Strike
1 vote – Supertux
1 vote – Celestia
1 vote – Lbreakout
1 vote – Xmoto
1 vote – Warzone 2100
1 vote – Touhou
1 vote – Scorched Eart
1 vote – Legend Of Zelda
1 vote – intellivision’s utopia
1 vote – populous
1 vote – simcity
1 vote – simple shoot the target game
1 vote – neverball
1 vote – vegastrike
1 vote – Ultra Star dx
1 vote – PacLand
1 vote – Mastermind
1 vote – Spade or Hearts
1 vote – Pokemon
1 vote – Super Tux

1 vote – Internet browser
1 vote – Online meeting point (like playstation)

[ratings]

SpaceBubble 5.000 downloads

Since the launch of SpaceBubble, less then a month ago, it was downloaded over 5.000 times. Wow! 😆 So a very special thanks to everyone who’s been downloading, playing and commenting this game.

Official download count

Homebrew Browser 3.963 times
My website 526 times
Other websites around the world +/- 512 times
Total +/- 5.001 times

New project ideas?

Hello everybody, The SpaceBubble game is almost ready 😀 So i am searching for a new project. I would like to hear from you what classic game you really like the have?  I will add a poll to this post. The outcome of the poll will decide which game I will develop in the next four a eight weeks. Looking forward to your reactions. Comments on this post are of course also welcome.

Which (classic) game shall i build for the Wii Homebrew scene?

  • Something else? Please leave a post with your idea (30%, 86 Votes)
  • Tower Defence (18%, 51 Votes)
  • Poker (Texas Hold style) (17%, 48 Votes)
  • Boulder Dash (15%, 43 Votes)
  • Tetris2 (14%, 41 Votes)
  • Battle Tanks (7%, 20 Votes)

Total Voters: 289

Loading ... Loading ...

This poll is closed! Check the final outcome here.

If you would like to be automatic informed what the outcome of the poll will be, please subscribe to my Posts RSS feed. During the design, build and test phase of the game you also will be informed. Many thanks in advance for your subscription.

Website upgrade

This afternoon i have upgraded my website.

The following features are added:
– Upgraded WordPress Engine to 2.7.1
– Upgraded some wordpress plugins

Some other actions to reduce the internet bandwidth:
– Remove tag cloud;
– Added html compress plugin (Save 5% html size for each page)
– Move most images to other web provider;
– Move all downloads to other web provider.

Wii SpaceBubble 0.81

A new version of SpaceBubble is released with the following major bug fix:

14/02/2000 Version 0.81
– Hot fix: Solve major bug in global highscore screen. If the local score does not contain more the 13 entries the global highscore screen crash.
– Work around for previous versions. Play at least 13 games before entering the highscore screens.
– Build game with libogc 1.7.1 and devkitPPC r16 compiler.

Website upgrade

This night i have upgraded my website.

The following features are added:
– Improve webpage design;
– Faster page load (page size reduced);
– Allows people to recommand/send blog’s post to a friend;
– Shows how many times a post/page had been viewed;
– Added file downloads hit counter;
– Only registrated users can download the source code of the developed games;
– Added a more advanced paging navigation;
– Added statistics page about this website;
– Make donate page visible in menu bar;
– Add more smilies.

Wii SpaceBubble 0.8

A new version of SpaceBubble is released with the following changes:

11/02/2009 Version 0.8
– Improve Frame-per-second performance during game play.
– Show frame per second information on game screen.
– Added information popup windows.
– Added 10 seconds extra playtime to each level.
– Disable MP3 background music support. Too slow!
– Bug fix: Remove bug in Global Highscore functionality.
– Build game with libogc 1.7.1 and devkitPPC r16 compiler.

Wii RedSquare 0.90

A new version of RedSquare for Nitendo Wii is released with the following changes:

08-02-2009 Version 0.90
– Added player initials setting screen.
– Added load/save game setting to sdcard.
– Improve Local and Global highscore screen.
– Improve third intro screen.
– Increase http receive buffer size to 8196 bytes.
– Use only one unique cookie number during the game.
– High score is send to web service if score is better then 40 seconds.
– Bug fix: menu screen graphical error solved.
– Build game with libogc 1.7.1 and devkitPPC r16 compiler.

Wii SpaceBubble 0.7

A new version of SpaceBubble is released with the following changes:

08/02/2009 Version 0.7
– Increase game board size from 12×12 to 14×14 bubbles.
– Added total clear (no bubbles left) bonus per level.
Remove game board control buttons. Use the WiiMote A button instead.
– Press the Home button on WiiMote to return to the menu screen.
– High score is send to web service if score is better then 12.000 point.
– Only this first WiiMote can control the music and stop a running game.
– Bug fix: Do not show bubble select hint when game is over.
– Bug fix: Hint is now always working correct.
– Build game with libogc 1.7.1 and devkitPPC r16 compiler.

Pong2 15.000 downloads

Today Pong2 is downloaded for the 15.000 times. Many thanks to all the pong players in the world. This game is now entered the top 10 of the best downloaded (played) games of the Wii Homebrew scene. :). I hope the pong2 game will rise to a top five place with the upcoming releases.

Official download count

Homebrew Browser 13.975 times
My Web Site 642 times
Other website around the world +/- 695 times
Total +/- 15.312 times

Top10 best downloaded (played) Homebrew Wii games

Top Game Name Downloads
1 WiiDoom 43.472
2 quake 36.773
3 duck_hunt 30.713
4 Tetris 28.054
5 uno 25.370
6 mahjongg 24.377
7 guitarfun 22.522
8 WiiShootingGallery 22.425
9 Pong2 15.312

10 Wiibreaker 13.570

Wii BibleQuiz 0.91

A new version of BibleQuiz is released with the following changes:

06/02/2009 Version 0.91
– Added multi player mode for two, three and four players.
– Improve third intro screen.
– Increase http receive buffer size to 8196 bytes.
– Use only one unique cookie number during the game.
– Bugfix: Highscore is now always loaded correctly.
– Build game with libogc 1.7.1 and devkitPPC r16 compiler.

Download

Click here for more information and the download link.