Canadian Computing Competition 2011

I hope I’m not the only one excited for this :-)

Having written this last year (Senior Division) and getting slaughtered by the last three questions (so much input processing!), I’m more than anxious to take this on again this year.

Good luck to all those writing! Hopefully the CEMC will go easy on us this time (yeah right…)

ShowCaSe 2011

It’ll be exciting to meet all those who have entered / planning on attending the University of Toronto : St. George Balen Hall Open House meeting.

I’ve entered four projects :

1. [C] Avia

2. [Actionscript] Balance

3. [PHP/Javascript] B12Panel

4. [Assembly] asmmaze

I’m anxious to see the other entries already. Good luck to everyone who’s entered (or hopefully entering within the next 45 minutes :p)!

To those still loyal from Court-Records

Sorry, B12. I was the anonymous commenter (you can check, the email tied to those posts uses a disposable inbox service called ‘Geurilla Mail’), and I’m glad that the post did not go unheard or unagreed-with (thanks, Nedi and Arakasi).
Now that you’re hearing us again, I think I can come out of hiding here.

I’m a lurker at Court Records (specifically, YOUR topic on the Casemaker), and you haven’t been keeping us updated very much (or at all). It was natural to assume that people would think that you quit or died or something.
The original ETA for this project was February, and, with the exception of a scrapped build and a tech demo, we haven’t really been getting much we can use.
We understand that you’ve been having obstacles and setbacks, but would it kill you to let your fans in on the loop every now and then? Questions have gone unanswered, concerns not allayed, and there’s a famine of information all over.
We feel a little…forsaken.

- NoxedWin

After reading the above comment from NoxedWin (which he had posted almost 6 months ago) again, I have realized something was due.

The main reason for LuAA’s halt was the lack of a sufficient Lua engine for the Nintendo DS platform. MicroLua and DSLua were both insufficient for the tasks a casemaker was held up to perform. It was my original plan to create the tequiLua engine for the Nintendo DS, which I had announced after finc’s announcement of his Lua port for the Nintendo DS. Thus, out of courtesy, I chose to abandon my project so not to compete with his, considering he had announced it earlier.

Ever since, I’ve been checking his blog every week or so to see if any updates have been started on his Lua port. In order for LuAA to progress, I needed an engine to support it. Due to waiting for this port, I have taken on many small and large projects (web administration jobs, small C++ homebrew projects, web design jobs, Java applet development jobs) and am even now overwhelmed with a major project of my own.

Thus, I have chosen to announce the abandonment of this project. I am sorry.

The source code will be released sometime within the next 2 months.

WhatTheHexDS

Hey guys,

found this amazing game online (thanks to Kortaggio for linking me to it). I’ve frankly immersed myself into it… so much so that I just had to make a DS port so I could play this on-the-go.

Get ahold of the ROM here.

Source code will probably be uploaded as well in a day or two.

Have fun!

wxWidgets Example :: wxPong

Hey guys,

So I’ve veered away from homebrew development for a bit (fincs has taken over with a Lua port of PALib of his own so tequiLua has been cancelled) to work on some PC development.

This tutorial is for those using wxSmith, a plugin included with the binary for Code::Blocks, a very flexible and configurable IDE. Code::Blocks works with devkitPro as well.

wxSmith is the equivalent to a free, open-source version of Borland C++ builder, a form-based editor used for GUI applications. Installing wxWidgets and its dependencies is relatively straightforward, here’s a list of tutorials on just how to do it:

http://wiki.wxwidgets.org/CodeBlocks_Setup_Guide

http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_nightly_build_on_Ubuntu

http://wxpack.sourceforge.net/Tutorials/CodeBlocks

After installing, set up your wxWidgets project through the project creation menu in Code::Blocks. I’m currently using wxWidgets for a more extensive project; however, I will be going through a simple pong example to demonstrate:

Input events (including concurrent keydown)

Drawing on the form’s device context

Flicker-free drawing

Press the Tool tab in the object menu and press the clock icon to include a Timer. A timer icon should now show up above the form. Click on this and under the properties menu, change interval to 17 (about 60 FPS). Double clicking this icon will create an event function named:

void PongFrame::OnTimer1Trigger(wxTimerEvent& event)

This function will then be ran every 17 milliseconds. Go to the header of the current file and include the following:

#include <time.h>         //randomizing
#include <wx/dcbuffer.h>     //double buffered painting
#include <wx/defs.h>         //defining wxKeyCodes
#include <wx/utils.h>        //defining timer input events

For Pong, you will need some images. Feel free to use these.

bg.png

ball.png

paddle.png

Access PongMain.h through the Projects menu. We will now modify the PongFrame class to include some variables used in this project.

class PongFrame: public wxFrame
{
wxBitmap bg_img;
wxBitmap ball_img;
wxBitmap paddle_img;

struct projectile
{
double x, y, vx, vy;
} ball, paddle[2];

char turn;

public:

PongFrame(wxWindow* parent,wxWindowID id = -1);

.

.

.

}

This declares three bitmaps stored in the program’s memory as well as a basic projectile structure defining a ball and an array of paddles. Going back to PongMain.cpp, we will declare them in PongFrame’s initialization block:

PongFrame::PongFrame( wxWindow* parent,wxWindowID id )
{
//( *Initialize( PongFrame )
srand( time( NULL ) );

//load the image files into the wxBitmaps declared in PongMain.h
bg_img.LoadFile( wxT( “bg.png” ), wxBITMAP_TYPE_PNG );
ball_img.LoadFile( wxT( “ball.png” ), wxBITMAP_TYPE_PNG );
paddle_img.LoadFile( wxT( “paddle.png” ), wxBITMAP_TYPE_PNG );

//initialize the variables
turn = -1;
ball.x = 232;                               // Ball’s x component
ball.y = 232;                               // Ball’s y component
ball.vx = ( rand(  ) % 10 + 1 ) * turn;         // Generate ball’s velocity y component
ball.vy = rand(  ) % 10 + 1;                  // Generate ball’s velocity x component
paddle[0].x = 0;                            // Paddle’s x component
paddle[0].y = 208;                          // Paddle’s x component
paddle[1].x = 456;                          // Paddle’s y component
paddle[1].y = 208;                          // Paddle’s y component

.

.

.

}

Now, we’ll look into flicker-free drawing. Refer back to the Timer1Trigger event.

void PongFrame::OnTimer1Trigger( wxTimerEvent& event )
{
ball.x += ball.vx; //change the ball’s position
ball.y += ball.vy;

this->Refresh(  );
}

this->Refresh(  ); calls two events in wxWidgets : EVT_PAINT and EVT_ERASE_BACKGROUND. Create event instances for these two using the event panel in the Resources menu.

This should create the following events:

void PongFrame::OnEraseBackground( wxEraseEvent& event )

void PongFrame::OnPaint( wxPaintEvent& event )

Keep PongFrame::OnEraseBackground empty, as a prototype. This allows the program to skip over the default function, which erases the screen.

We will then use PongFrame::OnPaint to double-buffer draw.

void PongFrame::OnPaint( wxPaintEvent& event )
{
wxBufferedPaintDC dc( this );

dc.BeginDrawing(  );

dc.DrawBitmap( bg_img, 0, 0, true );
dc.DrawBitmap( paddle_img, int( paddle[0].x ), int( paddle[0].y ), true );
dc.DrawBitmap( paddle_img, int( paddle[1].x ), int( paddle[1].y ), true );
dc.DrawBitmap( ball_img, int( ball.x ), int( ball.y ), true );

dc.EndDrawing(  );
}

Refer back to the Timer1Trigger function. Here, we will activate the erase and paint events.

void PongFrame::OnTimer1Trigger( wxTimerEvent& event )
{
ball.x += ball.vx; //move the ball using its velocity components
ball.y += ball.vy;

this->Refresh(  );
}

this->Refresh(  ); calls the OnEraseBackground and OnPaint events. If you compile, you should notice the the paddle and ball images being drawn on the background, without flicker.

Now, we will expand the Timer1Trigger function to include input events and collision detection, making it a fully working pong game.

void PongFrame::OnTimer1Trigger( wxTimerEvent& event )
{
if( wxGetKeyState( WXK_SHIFT ) )
paddle[0].y -= 8;
else if( wxGetKeyState( WXK_CONTROL ) )
paddle[0].y += 8;
if( wxGetKeyState( WXK_UP ) )
paddle[1].y -= 8;
else if( wxGetKeyState( WXK_DOWN ) )
paddle[1].y += 8;

ball.x += ball.vx;
ball.y += ball.vy;

if( ball.x < 0 || ball.x > 464 )
{
ball.x = 232;                               // Ball’s x component
ball.y = 232;                               // Ball’s y component
ball.vx = ( rand(  ) % 10 + 1 ) * turn;         // Generate ball’s velocity y component
ball.vy = rand(  ) % 10 + 1;                  // Generate ball’s velocity x component
paddle[0].x = 0;                            // Paddle’s x component
paddle[0].y = 208;                          // Paddle’s x component
paddle[1].x = 456;                          // Paddle’s y component
paddle[1].y = 208;                          // Paddle’s y component
turn = ( turn < 0 ) ? 1 : -1;
}
else if( ball.y < 0 || ball.y > 464 )
ball.vy *= -1;
else if( ( ball.x < 24 && ball.y > paddle[0].y && ball.y + 16 < paddle[0].y + 64 )
|| ( ball.x > 456 && ball.y > paddle[1].y && ball.y + 16 < paddle[1].y + 64 ) )
ball.vx *= -1;

this->Refresh(  );
}

And that’s all! Any questions or comments are welcome. I’m relatively new to wxWidgets (just started looking into this a month ago) so if any experts would like to adjust anything or add anything to the tutorial, their suggestions are welcome as well.

NOTE: This tutorial is not fully complete.

Flake Out! DS

Flake Out! DS is my entry for this year’s Winter 2009 Competition. It’s a fast-paced, challenging, arcade-esque game involving a nightclub full of intoxicated snowflakes.

It’s Christmas Eve 2009, and there’s no snow to be found. In fact, just recently, all you’ve been getting has been rain.

Your task, as the new bouncer of Club Zero, is to prevent the snowflakes from escaping the nightclub, catching them before they reach the Earth’s surface.

Mr. Claus has given you the powers of Sun, Moon and Wind to aid you. Further details on how to use these are in the game.

Controls
  • L/Up/X – Activate Sun’s Power
  • R/Down/B – Activate Moon’s Power
  • Left/Y – Move Left
  • Right/A – Move Right
  • Touch Screen – Activate Wind’s Power
  • Start – Pause Game

There is also a high score system implemented for the top 10 scores. The high score table is saved and loaded from FAT for later play.

Credits
  • Thanks to:
  • devkitPro for maintaining their distribution of libraries for free, public use
  • ModArchive for organizing royalty-free module sound files
  • Drunken Coders for supporting the homebrew community with their annual competitions (hope to see more)
Music Credits:
  • scorpik PULSE – Crying Boy
  • projex – Christmas Dance Mix
  • CyberZip – Christmas Mix ’95
  • CyberZip – Christmas Mix ’96
  • CyberZip – Christmas Mix ’98
Have fun!

Winter 2010 Competition Logo

Feel free to use this logo in your entries in this year’s Winter 2010 Competition!

tequiLua

DSLua
________________________________________________
DSLua’s been long gone; their alternative, MicroLua, has also died down. I will be working towards a new backend of Lua, attached to PALib, for homebrew developers.
Expect an open-source release under the name of tequiLua eventually. Any further updates may be found on this blog.
UPDATE: With the introduction to fincs’s new Lua engine, tequiLua has been cancelled.

Operation Libra

Operation Libra is just a little escape-the-room VN I worked on back in ’09.

I’m also planning on creating an iPhone port soon enough — maybe even going open-source with this. Any further information will be found here.

Special thanks to Dovoto (Jason) for giving me this blog space to work with! These 50 mb sure come in handy :p