Sunday, September 30, 2012

GIMP YouTube Videos

As I am waiting for the french toast to cook this morning, I watched this video on GIMP usage.  Simply awesome.



This woman has 83 videos on using GIMP on her YouTube channel, Your Favorite GIMP Teacher!

I've watched 1 out of the 83 so far.

Below is the result of my 10 minutes with GIMP.

Tiled Map Editor

In addition to thinking about moving my student's shooter game to the web, I've been thinking of the next type of game to work on.

Right now, I'm considering a tile map game.  This Tiled Map Editor looks interesting.

It listed these tools that work with Tiled on Python:

  • Pygame map loader by dr0id
  • PyTMX by Leif Theden (bitcraft)
  • tmx.py by Richard Jones, from his 2012 PyCon 'Introduction to Game Development' talk.
  • pytmxlib: library for programmatic manipulation of TMX maps


I'm hesitant to go down the path of making a 3D First Person Shooter (FPS) game with PyOgre or Panda3D.  I haven't looked at things like Kodu too much, though it does seem similar to Alice.

I also found an interesting Game Based Learning Wiki.


Saturday, September 29, 2012

Mobile Game Engines Site

I stumbled across the Mobile Game Engines site while I was looking for a Python to JavaScript converter.

I don't think that I'll find a converter that will convert a full Pygame game into JavaScript.  The GameJs library looks interesting since the drawing API is based on Pygame.

Another interesting project is pyjs, a Python-to-JavaScript compiler, AJAX framework, and Widget Set API.

Wikipedia has a nice comparison of JavaScript frameworks that includes Pyjamas (pyjs) as well as the obvious ones like Dojo and jQuery.


Despite the inability to easily share games inside of a web browser, I intend to keep focusing on Pygame for now.   I don't think JavaScript has the necessary structure for effective teaching.

Monday, September 24, 2012

Scoring and Gun Types


Son changed:

  • Scores for enemies landed and enemies shot
  • Change of gun between piston and shotgun
  • Aligned shotgun blast graphic with shotgun movement from left to right
  • Using three graphics for the shotgun for left, middle, right
  • Using three graphics for the pistol for left, middle right
Gun change is currently controlled by the keyboard.  Plan to switch this to Button 4 on the joystick.  Right now, there's a problem with repeating the button every time the program goes through a loop.  

Although there's many ways to set up a button delay, I'm going to show my student this method using python's time.time() library.




The above code snippet references my_joystick. It simply checks to see if 300 milliseconds have passed since the last time the gun was changed. get_button(3) will check the yellow button Y on the XBox 360 controller or the button labled 4 on the Logitech RumblePad 2



These shooter games are fairly easy for middle school children to build. They don't rely on lists and dictionaries as much as the memory puzzle game did. A shooter game primarily uses addition and subtraction of the rectangle coordinates. Using pygame's Rect, it is easy to check for collision of two rectangles.

 Just watched this video on Gimp Tutorial: Layers - The Basics.

Tuesday, September 11, 2012

PyWeek

PyWeek is a challenge to write a game from scratch in one week.  I don't have an official entry, but I am engaging the community in discussion while I develop my own project in parallel to the challenge.  I hope to enter the challenge in 2013 with my son.

We're on day 3 of PyWeek 15.  The theme is "One Way Trip!"

As far as I know, there is no prize for winning except some minor recognition from a small community of online people.  My game tracks the story of one soldier through a battlefield.



I used Inkscape for the first time today.  I still find Inkscape and the GIMP difficult to use.  I'm using Audacity for the audio editing.

Tonight was also the first time I tried using sound channels.  Prior to this, sound was getting cut off every time I started a new Sound.play() action.  For example, the explosions and pistol shots could not occur at the same time.  By using the channels, I'm able to play multiple explosion and pistol sounds at the same time.  The documentation indicates that there are eight sound channels.


Sunday, September 9, 2012

Making of Warcraft


Patrick Wyatt, a famous game developer who tuned his craft at Blizzard, wrote a blog post on the making of Warcraft.  He gives us a view into the different roles of people working at a game company, the artists, the software developers, and the managers.  His blog is in two parts.  The second part has more choice tidbits on the dynamics of people in the company.

This section captures the frenzied culture stemming from working on multiple projects at the same time:

We worked together, played together, partied together, slept 10 to a hotel room for trade shows together, and in cases even lived together: I shared a house with three other Blizzard-folks which was the first of many similar dorm rooms scattered throughout Orange County, California.

Blizzard was working on at least four other games when I started on the Warcraft project, and as the company numbered only 20 everyone was mega-busy keeping those projects on track. It wasn’t uncommon for artists, programmers and designers to be working on two or sometimes three projects at a time, and of course our sole musician/sound-engineer, Glenn Stafford, worked on everything.
After Patrick's blog, I felt that I wanted more information on the culture of video game companies.  I ordered David Kushner's 2004 book called, The Masters of Doom.

Saturday, September 8, 2012

Scrolling

I've been trying to figure out how to scroll the background scene from left to right and up and down.

I initially started using the pygame Surface.scroll feature for image surfaces.  Although I was able to quickly get the image to scroll with the cursor keys, I'm having a problem with redrawing the image properly.

As I was searching for a solution, I found this link to Parallax scrolling, which seems interesting.  Just I was about to try parallax scrolling, I opened up the scrolling example that ships with pygame and realized that there is a cool method for rectangles called, Rect.move_ip.  Although I had seen this in the documentation before, I always assumed that ip dealt with the networking.  Well, it turns out that ip stands for In Place, not Internet Protocol.  Wow, move in place.  With this, I was off and scrolling in no time.



video


I'm using a single image in this short example and simply controlling movement and sight with the joystick hats.  Here's a lengthy way to pan the image around.

    h_axis = joy.get_axis(0)

    v_axis = joy.get_axis(1)
    x = int(h_axis * scroll_speed)
 
    y = int(v_axis * scroll_speed)
 
    if scenery_rect.left < 0 and x < 0:
        scenery_rect.move_ip(-x, 0)
    elif scenery_rect.left > 0 and x < 0:
        scenery_rect.right = WIDTH
    elif x >= 0 and scenery_rect.right >= WIDTH:
        scenery_rect.move_ip(-x, 0)
    elif scenery_rect.right <= WIDTH and x > 0:
        scenery_rect.left = 0
    if scenery_rect.top < 0 and y < 0:
        scenery_rect.move_ip (0, -y)
    elif scenery_rect.bottom > HEIGHT and y >=0:
        scenery_rect.move_ip(0, -y)

Due to my sports injury, I've been spending more time with my student.  He's making great progress with his shooter game.  He's up to one jet, one stealth fighter and one pistol.    He also reduced the target area of the crosshairs to around 7 pixels.

Sunday, September 2, 2012

Shooter With Joystick

video

Since it's Labor Day weekend, I had some time to work with my son on game concepts.  I went back to the lesson on pygame.joystick, that my son worked on last year.  So far, we put about two hours into the lesson.  It's a fun, easy and rewarding lesson that uses simple math.  It's also short enough so that we didn't use functions or classes.

The background is a simple static image that doesn't move. The gun sight is also a single image with transparent background enabled. My student didn't develop any targets yet because he went out to a Labor Day BBQ.

Here's the code:

Saturday, September 1, 2012

Matching Game

video

This is an educational program written by a middle school student, my son.  It was a fairly tough project to tackle for these reasons:

  • The images were more difficult to randomize than we expected;
  • We didn't have a good algorithm to see if the second image had been selected;
  • The program is a bit too long for the intended learning purpose.
In the end, my son used objects.  It's all a bit clunky, but it works. 


I decided to archive the video and code on this blog so that we can see how the student progresses over time.

VPython Revisited and the Problems with 3D Projection


I previously wrote about VPython close to a year ago as a bit of fun eye candy for my student, who at the time was 12 years old.  After a break due to soccer, track, and summer activities, I started to focus on a memory game first and then a racer game.  It took an entire summer of sporadic weekends to finish two games and I feel we bit off more than we could handle.

After the problems with the memory game data structures and the headaches of 3D projection, the videos on VPython were fun and immediately rewarding.   I highly recommend these videos for 11 to 13 year old children.

Unfortunately, I can't recommend 3D projection until they get a bit further along in math.

So, why was 3D projection so tough?

Well, for one thing, complexities of 3D projection were getting a bit too tedious.  I didn't realize this, but my student hadn't studied the z-axis in school yet.  He had covered cross multiplication, but wasn't an expert at it.    The key to figuring out a simple projection method was to  use Louis Gorenfeld's Pseudo 3D page.

video

The application revolves around this deceptively simple formula.

Y_screen = (Y_world / Z) + (y_resolution / 2)
There are numerous libraries that can handle the 3D calculations for the student.  VPython is super easy to use.  Perhaps we'll revisit 3D projection after my students gets further along in math.