Search My Blog

Friday, October 2, 2009

Make a Python game in minutes with Gloss | TuxRadar

I've always wanted to try writing a Program. Now, maybe I can...

Make a Python game in minutes with Gloss
Posted at 2:59pm on Wednesday September 30th 2009
Code

When Hudzilla isn't busy working on his free Mono tutorials using C#, he
likes to hack on one of his pet Python projects: Gloss. It's hosted
right here on TuxRadar and you may already have given it a try. If not,
he wrote a short tutorial for PC Plus magazine a few months ago, and
took the time to repurpose it for the web.

So, if you fancy learning the fastest way to create Python games, read
on as Hudzilla talks you through an example Gloss project...

While Electronic Arts has done a good job of convincing the world that
it takes 100 squibillion dollars to make a modern computer game, the
indie scene continues to thrive in a world where people like to try out
ideas just for fun, learn for learning's sake and are happy if a
finished piece of software comes out at the end of the day.

If that sounds like you, hopefully you're already having a lot of fun
programming your Linux box, Xbox, iPhone and any other device that stays
still long enough. On the other hand, if you're fine with trying out
ideas and happy with the idea of having a finished piece of software,
but hit a bit of a mental speed bump at the idea of learning lots of new
stuff to accomplish said feat, you're not alone: lots of people like the
idea of having a bit of fun making their own games, but the Venn diagram
of where they cross with people happy to spend their time learning to
program is, well, non-existent.

Fortunately, if you have great ideas bubbling away in your brain, there
are two things that will act as mental floss. The first is called
Pygame, which is a set of libraries that make it easy for everyone to
make games in the newbie-friendly Python programming language.

But Pygame itself is a bit limited because it does much of its drawing
on the CPU, which makes it slow when drawing lots of things or
performing complex operations such as rotation or scaling. And that's
where our other useful tool comes in: Gloss is an OpenGL graphics system
that sits on top of Pygame providing GPU-accelerated graphics, a
simplified coding framework and a stack of coder-friendly functions that
make it easy to perform common tasks.

In this tutorial, I'm going to walk you through what it takes to make a
simple game with Pygame + Gloss. All the code is already written (and I
think you'll find it very short!) so it's just a matter of explaining to
you what it does and why. We used Linux (naturally), but both Pygame and
Gloss should work fine on Windows too - make sure you have Pygame,
Python OpenGL and Gloss installed, and if you're on Linux you'll also
need the Numpy Python module.

Read more...
http://www.tuxradar.com/content/make-python-game-minutes-gloss

Don

No comments: