Welcome! Log In Create A New Profile

Advanced

MTek-GDL - Game Development Library for the Nintendo Wii

Posted by TheCodingBrony 
MTek-GDL - Game Development Library for the Nintendo Wii
January 01, 2015 11:28AM

I don't know where to post this library exactly but I think this is the most fitting section for me to post this on...

But anyway, here's MTek-GDL which stands for Meido-Tek Game Development Library which is an object-oriented library for devKitPPC designed to simplify game and application development as it wraps and handles low-level graphics and sound functions for you in a much more simplified API pretty much like GRRLIB but with more features, less cumbersome and is much easier to use (in my opinion that is) allowing one to make Wii games quickly and easily while being versatile enough to be used as a base for developing custom graphics engines for advanced game programmers like me.

This library features pretty much everything you need for game and application development on the Nintendo Wii such as optimized hardware-accelerated 2D graphics, image loading/saving, stereo sound and streaming music... No longer do you have to (painfully) go through the libogc docs and writing your own graphics routines unless you want to do advanced 2D or 3D graphics programming.

Library features:
- Object-oriented based programming interface inspired from SFML for handling textures, images, sprite sets, and sound files.
- Simplified system initialization with automatic video mode selection and aspect ratio correction based on console settings.
- Almost all graphics functions are hardware accelerated for maximum performance.
- Stream music off of OGG files on SD card or USB drive with little CPU and memory usage.
- Simple sound system with volume controls and 2D stereo separation (may be improved upon in the future).
- Can be used as a base for developing custom graphics engines without much of a fuss.

With MTek-GDL, something as simple as loading and displaying an image can be done very easily with only a few lines of code as shown below:
int main() {

	// Init FAT library and system
	fatInitDefault();
	gdl::InitSystem(0);

	// Load an image (assuming it exists)
	gdl::Image myImage;
	myImage.LoadImage("octavia.png", gdl::Nearest, gdl::RGBA8);

	// Display it
	while(1) {
		
		gdl::PrepDisplay();

		myImage.Put(0, 0, gdl::Color::White);

		gdl::Display();
		
	}

}
Since this library is still fairly new and hasn't gained much of a following yet, there are not that many examples included, the documentation is a bit vague depending on your programming skills and there are no tutorials available for now... However, don't feel discouraged due to these factors alone as the library is pretty much complete and the included examples and documentation are good enough to get you going in developing your own games on the Wii. If you're having trouble, you can always ask questions in the Coding section on this forum.

If you have any suggestions, contributions (mainly examples) or discovered a bug, please post them in this thread or PM them to me as such entries will be greatly appreciated... If you have any library questions, post them in the Coding section of this forum instead.


Oh, and by the way, can anyone do the following for me please?
- Test this library on a PAL system and while you're at it, test EURGB60 and MPAL (PAL60) mode through the console's video settings if possible.
- Make a Gamecube controller example while using this library (my Wii lacks GC ports unfortunately).

Associated libraries (no need to download them separately as they are already included):
- zlib
- png
- tremor (binary only)
- oggplayer (modified for file streaming and reverse stereo bug fix)
- valloc (from devKitPSP/PSPSDK modified for MEM2 memory management)
- dolexec (created by me based from FIX94's loadMii forwarder)

Download the library here (latest release recommended):
Github Repository (for those who want to try out the most recent work-in-progress version or to contribute)
Release 2.6 (07-12-2015) (17MB)
Release 2.5 (07-03-2015) (17MB)
Release 2 (03-20-2015) (15MB)
Release 1.1 (01-31-2015) (15MB)
Release 1 (01-22-2015) (15MB)
Release 0 (01-01-2015) (6MB)




Edited 14 time(s). Last edit at 10/08/2015 05:40AM by TheCodingBrony.
Re: MTek-GDL - Game Development Library for the Nintendo Wii
January 02, 2015 08:53AM
Thanks to owen, I've discovered a bug regarding installing the associated libraries where you'll get a compile error with oggplayer... Fortunately, this bug is very easy to fix.

Replace all the code inside /mtek-gdl/libs/wii/makefile with the following:
LIBOGC_INC	:= $(DEVKITPRO)/libogc/include
LIBOGC_LIB	:= $(DEVKITPRO)/libogc/lib/wii

ARC 		:= tremor/libvorbisidec.a
HDR 		:= tremor/ivorbiscodec.h tremor/ivorbisfile.h tremor/ogg.h tremor/config_types.h tremor/os_types.h

SUBDIRS		:= `ls | egrep -v '^(\.svn)$$'`

all:
	mkdir -p  $(LIBOGC_LIB)  $(LIBOGC_INC)
	mkdir -p  $(LIBOGC_INC)/tremor
	cp -f $(ARC) $(LIBOGC_LIB)
	cp -f $(HDR) $(LIBOGC_INC)/tremor
	
	@for i in $(SUBDIRS); do \
	  if test -e $$i/Makefile ; then \
	    echo "-----------------------------------------------------------";\
	    $(MAKE) -C $$i || { exit 1;} \
	  fi; \
	done;

clean:
	@rm -f *.bz2
	@for i in $(SUBDIRS); do \
	  if test -e $$i/Makefile ; then \
	    $(MAKE) -C $$i clean || { exit 1;} \
	  fi; \
	done;

install:
	@rm -f *.bz2
	@for i in $(SUBDIRS); do \
	  if test -e $$i/Makefile ; then \
	    $(MAKE) -C $$i install || { exit 1;} \
	  fi; \
	done;

And don't forget to delete the makefile inside the tremor directory as it is no longer needed. Also, performing this fix is no longer necessary in the future releases of this library.



Edited 1 time(s). Last edit at 01/02/2015 09:01AM by TheCodingBrony.
Re: MTek-GDL - Game Development Library for the Nintendo Wii
January 22, 2015 03:04PM
Release 1 of the library had just been released which features some big improvements over the first New Year's eve release such as the inclusion of the Sprite Mapper tool to create TSM sprite map files for the the gdl::SpriteSet class, a non-interlaced low-res video mode for retro style games, and additional graphics examples plus a new mini-game to top it all off.

Here's the changelog for this shiny new release:
- PC version of the library now included (there might still be some hiccups here and there as most of
  the development effort went to the Wii version of the library).

- Sprite Mapper tool now included (it is kinda bloaty as it was recycled from an ill-fated game
  engine I made with QB64 2 years ago).

- Created and added dolexec forwarder library based on FIX94's loadMii forwarder (no example of it
  for now but its EXTREMELY easy to use, no joke... Not defined in the template makefile though
  but its easy to implement anyway.

- Forgot to include bulb.ply for the wii/graphics/3dsample example... Silly me!

- Added spritesets example (WARNING: features ponies).

- Added a silly whack-a-cirra minigame example.

- Added wii/graphics/mipmap example.

- Added wii/graphics/tilemap example.

- Added wii/graphics/displaylist example.

Wii library v0.42b changes:

	- Added built-in power off/reset handling with fade-out (only effective during a
	  gdl::PrepDisplay() and gdl::Display() loop). Pressing the reset button won't perform a
	  hot-reset (restarts the running application) but instead, brings you back to the
	  Homebrew Channel. This can be overridden with SYS_SetResetCallback() and
	  SYS_SetPowerCallback() however.

	- Added non-interlaced low resolution mode (320x240/432x240 on NTSC/MPAL/EURGB60,
	  320x264/432x264 on PAL) which will do great for retro styled games or emulators. Will
	  always be recognized as 480i/576i on HDTVs even with component cables and progressive
	  scan mode set.

	- Added gdl::Texture::LoadTexture() function supporting single texture TPL files... Mipmapped
	  textures are accepted but color-index textures and TPL files containing more than 1 texture
	  are not supported.

	- Added TPL texture file support in gdl::Image::LoadImage()... Filter mode and texture format
	  parameters specified to the function are ignored when loading TPL files.

	- Added I4, I8, IA4, and IA8 texture format support for the gdl::Texture and gdl::Image
	  classes.

	- gdl::Texture::ConvertFromRaw() and gdl::Image::LoadImage() now uses MEM2 for storing
	  temporary image data to help prevent malloc from jumping into MEM2 when loading lots of
	  large images, can be reverted back to MEM1 allocation by specifying -DGDL_GC_COMPAT when
	  compiling.

	- gdl::Image::LoadImage() now supports 8-bit palettized PNG images but it'll be converted
	  into an RGB image upon loading.
Now that I'm pretty much satisfied about the status of this library for now, I won't be doing another update release of this library for a long while as I need to continue working on my other projects and that not so many people are into Wii homebrew game development these days unless a bug had been discovered in this release which must be reported on this thread immediately.

Also, considering the number of downloads release 0 got (which is 4 by the way). I think its safe to say that the Wii homebrew scene is pretty much dead these days while the DS and the recently formed 3DS homebrew scenes continue to rock on for some reason. Heck, the fact that GBAtemp doesn't have a Wii Homebrew Games subforum while the DS and 3DS sections have such a subforum pisses me off... I hope this library project may help bring back the Wii homebrew scene by giving people an easier way to develop homebrew games on the Wii and is one of the reasons why I created this project in the first place.




Edited 1 time(s). Last edit at 01/22/2015 03:07PM by TheCodingBrony.
Re: MTek-GDL - Game Development Library for the Nintendo Wii
January 22, 2015 03:35PM
It's not good to force non-interlaced modes when component cables are used... most HDTVs only support it for composite inputs.
Also: [gbatemp.net]
Re: MTek-GDL - Game Development Library for the Nintendo Wii
January 22, 2015 11:32PM
I've already mentioned in the changelog that using non-interlaced low-resolution mode is always recognized as 480i/576i even though the actual video feed is 240p/264p like as if it we're an older game console. This is also the same video mode used in many official VC games and this mode still works fine with component cables.
Re: MTek-GDL - Game Development Library for the Nintendo Wii
January 23, 2015 02:31AM
Not always, that's why they provided an option to disable it using a special button combination on the home menu (which always uses regular 480i/576i).
Re: MTek-GDL - Game Development Library for the Nintendo Wii
January 23, 2015 03:18AM
The Wii is not actually outputting full-on 240p/264p when using the low-resolution mode featured in this library. Instead, the video signal is still 480i/576i but without the interlace jitter caused by switching scanlines which eliminates interlacing and effectively halves the line count down to 240p. This is how many older game consoles such as the NES, SNES, Genesis, and many others output their video signal when running at 240p mode and such modes still work on HDTVs over composite, s-video, and even component cables (which definitely worked and is recognized as 480i/576i on my HDTV).

This Wikipedia article should help you understand this more: [en.wikipedia.org]



Edited 1 time(s). Last edit at 01/23/2015 03:22AM by TheCodingBrony.
Re: MTek-GDL - Game Development Library for the Nintendo Wii
January 23, 2015 09:37AM
To remove such jitter, you need an even number of lines.
Last I checked, 525 (NTSC) and 625 (PAL) aren't even numbers.
As such, the double-strike modes are 526-line (NTSC) and 624-line (PAL). This changes the refresh rate slightly.
Re: MTek-GDL - Game Development Library for the Nintendo Wii
January 23, 2015 09:52AM
Call it whatever you like, it's commonly known as 240p (even your wikipedia link confirms this) and if you search for "hdtv 240p component" you'll find plenty of evidence that your TV is the exception, not the rule.
Re: MTek-GDL - Game Development Library for the Nintendo Wii
January 23, 2015 12:11PM
Well, why don't you try using the low-res mode of this library yourself then?

I'll just finish this debate off by saying that this library will override the viTVMode settings when low-res mode is enabled with VI_NON_INTERLACE while VI_PROGRESSIVE is what activates progressive scan mode, both modes are completely different.

Here's the code that sets up low-res mode which was taken from my library:
// Set non-interlaced mode while keeping the video standard setting
rmode->viTVMode		=VI_TVMODE(rmode->viTVMode>>2, VI_NON_INTERLACE);

// Set single-field framebuffer mode
rmode->xfbMode		=VI_XFBMODE_SF;

// Disable field-rendering (I think?)
rmode->field_rendering	=GX_FALSE;

// Halve the framebuffer resolution
rmode->fbWidth		=320;
rmode->efbHeight	/=2;
rmode->xfbHeight	/=2;



Edited 2 time(s). Last edit at 01/23/2015 12:14PM by TheCodingBrony.
Re: MTek-GDL - Game Development Library for the Nintendo Wii
January 23, 2015 01:05PM
I've already told you: it. does. not. work.

[en-americas-support.nintendo.com]
Look under the NES and SNES sections; see how they provide a way to turn off non-interlaced mode if it's incompatible with the TV?
This is a well known problem (at least it seems to everyone besides you):
[answers.yahoo.com]
[www.gamespot.com]
[www.nintendolife.com]
[www.ghacks.net]
[www.ifixit.com]
[www.wiichat.com]
Re: MTek-GDL - Game Development Library for the Nintendo Wii
January 23, 2015 11:56PM
Okay, I stand corrected... I'll try to make the low resolution mode more HDTV friendly shortly. For now, I'll just continue testing this mode on a bunch of HDTVs and see if I could find one that rejects the mode.
Re: MTek-GDL - Game Development Library for the Nintendo Wii
January 25, 2015 01:25AM
Minor Release 1.1 had just been released, here's the changelog:
- Minor Wii library update.

- Wii library documentation for gdl::Texture::ConvertRawImage() is now up-to-date (forgot about it in relese 1).

- Corrected some entries in the Wii library documentation.

Wii library v0.43b changes:

	- Made low-res mode more HDTV friendly by enabling interlace jitter when component cables are used (after
	  having a debate with tueidj).

	- Removed useless *colTable parameter in gdl::Texture::ConvertRawImage().

Also, I wanna know if anyone actually found this library to be very useful and intuitive for Wii game/application development...



Edited 1 time(s). Last edit at 01/25/2015 01:27AM by TheCodingBrony.
Re: MTek-GDL - Game Development Library for the Nintendo Wii
March 23, 2015 08:15AM
Release 2 of MTek-GDL has been released! For details on what has been changed since the last release, see here.

Since the library is pretty much complete enough for most game projects, there will be no update of this library for a while as I need to work on actual game projects for now. If you've encountered any bugs or issues with the library, please report them in this thread and I'll try to address it as soon as I can.
Re: MTek-GDL - Game Development Library for the Nintendo Wii
March 28, 2015 07:07AM
I just recently found a bug in Release 2 (and possibly older) Wii version of this library where if you call the Put() function inside the gdl::SpriteSet class, it will either not draw the sprite properly or crash the system and halt to an exception screen. Hopefully, this is a very simple fix which will be described down below.

Open up mtek-gdl/source/wii/mgdl-wii-sprites.cpp and head to line 185, replace the entire function with the following:
void gdl::SpriteSet::Put(short x, short y, short index, u_int col) {
	
	_put(x, y, col,
		spriteList[index].texObj, spriteList[index].vList, spriteList[index].tList);
	
}
Re: MTek-GDL - Game Development Library for the Nintendo Wii
May 28, 2015 04:05AM
I've finally gotten a chance to compile some of the samples so that they can easily be downloaded and run. Tried updating the wikipage but no luck. anyway here is the link to the download; [owensoft.net] ( 8md download )



Edited 1 time(s). Last edit at 05/29/2015 02:28PM by owen.
Re: MTek-GDL - Game Development Library for the Nintendo Wii
May 29, 2015 12:50PM
Quote
owen
I've finally gotten a cancel to compile some of the samples so that they can easily be downloaded and run. Tried updating the wikipage but no luck. anyway here is the link to the download; [owensoft.net] ( 8md download )

Download added to the wiki page, this should help convince new users to get interested in using MTek-GDL.
Re: MTek-GDL - Game Development Library for the Nintendo Wii
July 04, 2015 05:20AM
Release 2.5 of MTek-GDL has been released! Some new features such as built-in mipmapped texture support, added project templates for CodeBlocks and the library had been overhauled and restructured so it can be compiled as a binary library.

For more details on what has been added/changed since the last release, see here.
Re: MTek-GDL - Game Development Library for the Nintendo Wii
July 12, 2015 07:20AM
Release 2.6 of MTek-GDL has been hastily released addressing a major bug with gdl::PrepDisplay() where it won't reset the projection matrix and low-resolution mode is completely broken when the console is set for progressive-scan mode.

If you've already set-up Release 2.5 on your computer, just replace the include and source folders inside the mtek-gdl folder with the ones from Release 2.6 then recompile and reinstall the library since this is mostly just a quick small update.



Edited 1 time(s). Last edit at 07/12/2015 07:21AM by TheCodingBrony.
Re: MTek-GDL - Game Development Library for the Nintendo Wii
October 08, 2015 05:37AM
The source code of the MTek-GDL library is now on Github to those who want to try out the most recent version of this library with new features, bug fixes, optimizations and syntax corrections not yet present in the official release packages of this library or to contribute to this library project to help improve it.

The Wii library now supports USB keyboard and mouse input devices similar to the PC version of this library (which is not yet available for now as it is currently being reworked) as well as multi-sample anti-aliasing mode. Keyboard functions are pretty much complete and is fully documented but mouse functions are still in the works and lack documentation as of the time this post was made and will change drastically in the next commit update.
Sorry, only registered users may post in this forum.

Click here to login