Sunday, February 24, 2008

Vector Graphics: Me Wantee

So after looking at what's been done with vector graphics inside Adobe Flash 2D games, I've decided I'm all for it, and I believe that we can achieve the same effects with either of the games currently in development here at Pezad Industries.

The problem faced with our side-scrolling platformer game is that I want to give the user the ability to render the game at various resolutions, but not have the camera appear to "zoom-out" at higher resolutions. It's like the effect everybody sees when they increase the resolution on their Windows XP desktop: All the icons and text have the same pixel size, but because there are more pixels that can be displayed on screen, more icons can go on the desktop.

I don't like it for two reasons: 1. The user now has to squint to see their character. 2. It destroys the difficulty of the level: Part of the fun of a game is in not knowing what you may run into next.

The problem might also be solved if the image is scaled properly. For this to work, I imagine that we'd have to start with a fairly large "base image" and then scale it down to fit properly with the displayed resolution. However, this just isn't as fun as going for the gold and having an engine that can efficiently perform vector graphics. And it is possible even today!

Just take a look at the Anti-Grain Geometry project, a GPL'ed project ready to be used in today's C++ projects. Combine that with something that can decode the SVG format or just make one of our own formats, and we're good to go! Never mind that doing this would set our project back to a crippling schedule, it sounds really neat. Anyone else on board?

What about the Java Entrippy project? Perhaps the Apache project batik and it's rasterizer source, properly modified of course, would provide just what we would need to go that extra step to get vector graphics going as well.

And it isn't like we have to do what Adobe Flash does and render the vector images in real time. We could just draw each character frame once in a back buffer, save it to memory, and then call upon it to draw the frame later. No fuss!

The idea sounds good to me, but that sure does look like much more work too. What are your thoughts?

Saturday, February 16, 2008

Controls, McSchmols

The best way to play a side-scrolling platform game is with a gamepad. Although the side scrolling game will have to support a keyboard, it is in the (unnamed) game's best interest if we get good peripheral support from the beginning. So, I went about looking for some documentation on getting the Playstation 3 SixAxis controller working in Linux.

It turns out there is a website with a couple of interesting videos using the bluetooth capabilities at http://www.pabr.org/sixlinux/sixlinux.en.html. Only by connecting the Sixaxis through bluetooth will the motion sensing capabilities of the gamepad be detected.

I don't really care too much about the bluetooth stuff or motion sensing for the game at the moment, though, even if it is fairly slick. I just want a nice standard gamepad to test the game out with, and is not too hard for the user to get working. For Linux at least, as long as the user is using 2.6.21 or higher (which includes Ubuntu Gutsy Gibbon 7.10), it is really simple:

  1. Plug in the Sixaxis to the computer via USB.

  2. Wait for the LEDs to start blinking. Hit the PS button to "wake up" the controller.

  3. Start using it with various games.

  4. (optional) install the joystick package and run jstest to see the raw data coming out of the controller. In Ubuntu 7.10, all I had to do was:

    sudo apt-get install joystick

    And then run jstest with the Sixaxis as so (with no other controllers connected):
    jstest --normal /dev/input/js0


Seriously, it is that simple. DON'T forget step 2. If you don't hit the PS button, the gamepad will not register anything, and you will spend at least an hour looking through forums just to discover you needed to hit a button like a chump like I did.

And there you have it. One controller, ready for use in Linux, good for the high-quality platformer we're sure to put out sometime within a decade I should hope.


But what about the Windows folks? It took a little research, but I finally found the drivers that actually work for my Windows XP system when connected via USB.
  1. Download sixaxisdriver.exe. You might need to search around to find it, but I was able to download mine here. Install it.
  2. Connect the Sixaxis to the PC via USB.
  3. Launch DriverLoader.exe and load driver.
  4. (optional) You should have a working ps3 gamepad in Windows now. Go to http://onakasuita.org/ps3/ and download the PS3 testing. It doesn't do anything other than show the raw data coming out of the controller, including the motion axes! I must say it was more fun to play around with that than I would have originally thought. It is really sensitive too.
A screen shot of the fun:
You can see clearly where I was shaking the remote like a madman and where I had set it down.

Setting up the gamepad was more of a hassle in Windows, so it might not be the "official" input device on that platform for the game. But still, the PS3 gamepad is one of the best around, so if the user had the option, I would tell them to go for it.

Tuesday, February 12, 2008

C/C++ fun

So I have been playing with C and C++ and here is what I have done. I wrote the following code

#include "stdio.h"

double golbal = 3.14; // global data

static double local = 2.718; // local data

double fun() // global function
{
return 1.0;
}

static double lfun() // local function
{
return 2.0;
}

int main()
{
printf("Hello World!\n");

return 0;
}

Then I compile it with gcc and g++ into object files. Using the nm command I look look into the object and here is what I got.

With gcc

0000000000000000 T fun
0000000000000000 D golbal
0000000000000019 t lfun
0000000000000008 d local
0000000000000032 T main
U puts

With g++

0000000000000000 T _Z3funv
U __gxx_personality_v0
0000000000000000 D golbal
000000000000001a T main
U puts

As you can see g++ mangles names. Also the printf call becomes puts and is an undefined symbols. Now the local data and function our shown in the gcc object while not in the g++ object. The other thing is the g++ object has a symbol of the name __gxx_personality_v0. Now I don't claim to explain all this or understand it, but there it is. If you man nm you can get more information on what all time means. There are other command like objdump that tell more and many more options to nm.

Someday I hope to understand all this.

Monday, February 11, 2008

Windows eclipse

Some time ago it came up that using eclipse cdt in windows is not as nice as in Linux because of the lack a good compiler and libraries. Now there is MinGW, but it has not seen much development as of late. This problem has also been seen by the lead developer of eclipse cdt (doug). I read his blog even now and again (http://cdtdoug.blogspot.com/) and the last post is something anyone how cares about compiler in windows for eclipse should check out.

Disclaimer: I don't now much about MinGW in windows so I might not be telling it right but read doug's blog if you care.

Sunday, February 10, 2008

Johnny Chung Lee > Projects > Wii

I know the three of us have already seen this site, but the items featured on it were so interesting that it was bloggable. So there.

http://www.cs.cmu.edu/~johnny/projects/wii/

Johnny Chung Lee shows three videos of interesting projects featuring the Wii remote: the Minority Report style interface, the cheap interactive whiteboard, and the virtual reality TV (my favorite).

Friday, February 8, 2008

Eclipse ganymede-M4-linux C++

So I installed the latest eclipse (M4) for the ganymede release. The first thing I saw that had changed was the startup screen as seen below. This is meaningless, but I thought it looked cool.
















The second thing I noticed was it was somewhat buggy. It would not start unless I pointed to a workspace that was already there. As a development version this is not surprising. The next thing I did was open up some C++ code because this was the C++ version. I only played with it for a couple of minutes, but I did notice it can now find errors in the code before you compile. This was the thing I missed most using the C++ version compared to the Java version. I hope this means there C++ parse has other fixes in it to. Below is and example of eclipse finding a missing semicolon. I did not see other new features, but I did not look long either. I can not wait until June for the real thing. The eclipse project it great and it just keeps getting better.


Pezad::init();

Team Pezad's current projects:
http://code.google.com/p/pezad-games/
http://sourceforge.net/projects/entrippy/

Programmers with a desire to make fun games comprise Pezad.
Pezad main site: http://www.pezad.com/