Phil Hassey - game dev blog
Phil Hassey as Rambo
".. I've been there,
I know what it's like,
and I'll do it again if I have to."

Archive for the 'python' Category

Galcon at 360iDev

Monday, July 13th, 2009

“I just got accepted to speak at the 360iDev Conference!  The show will be going down September 27 to 30, 2009.  It’s looking like it’s gonna be a great show, especially with yours truly speaking. The first one was a hit among the attendees and this one is looking even better than the last. Tickets are cheaper on a first come, first serve basis! So buy your tickets asap at http://www.360idev.com/ to get the best possible price. See you there and you better go to my session!”

So, yeah, .. It should be awesome.  I managed to secure an 80 minute talk spot – which will include me talking about dev, Nan talking about the community, and Tim talking about the audio.  So it’s really going to be a great opportunity to meet the whole Galcon team.

Cheers!

-Phil

Galcon Flash has arrived ..

Tuesday, June 23rd, 2009

So .. Yeah.  Check it out.  Realtime multi-player game .. in flash!

So on a more technical note .. The game involves quite a number of technologies!

  • AS3 – of course – for the Flash client itself
  • C++ – for the server
  • PHP – for the web API and rankings system
  • python – for the bots

If I did the project over, I’d probably do the server in python as well.  But all in all the project went pretty well.  After things were done, it only took me a morning to write up the python client.  There’s a very good chance I’ll release that code in a few weeks and let people try making bots for the game.

Anyway – have fun checking it out.  I’m a bit wiped out from wrapping all this up, so I’ll try and post some more interesting details later!

-Phil

I can has flash?!

Thursday, March 12th, 2009

So .. who thinks flash + Galcon = win?  I don’t know yet, but I’m giving it a try.  I’m not actually developing the flash version.  An awesome friend of mine has been doing the time on this one.  Though I’ll probably be doing the LAMP end of the deal.  At present the game is non-networked, but we’re been considering the possibilities.  A TCP/IP edition of the game could be made, but I wonder if that would end in tears.  TCP/IP isn’t ideal for gamedev IMO.  Flash doesn’t support UDP as-of-yet.

This isn’t the first time Galcon has reared it’s head from within the browser window.  (See my earlier blog posts …)

I haven’t decided exactly what I’m going to do with this once it’s completed.  Probably a few things.  Throwing it on facebook is an obvious one.  Throwing it on galcon.com is another one.  Maybe mixing it with something like The Maze of Madness is another one.  Or maybe something else!

One idea that I have that would be really cool would be if the tinypy vm were ported to ActionScript using Alchemy* .. and then somehow people would be able to script Galcon on the web and share it with their friends..

*I don’t know if you caught that .. but I think my weekend just got booked 🙂

Beast for the iPhone / iPod touch

Monday, February 23rd, 2009

Today marks the release of my first iPhone game release in five months.  It’s about time I got going on dev again.  I’ve been in the midst of many transitions in both of my businesses, so I decided to start out with something short-n-sweet.  The game is called Beast.

Beast is a re-make of an ancient MS-DOS game that I played ages ago (and I’ve re-made several times).  The original is here.  You may have followed my progress on twitter.  Here are some interesting “factoids” about the game dev.

The original game is pretty tough to play, if you have dosbox and have all the proper slow-down settings going, you’ll find it can be a challenge to surround the beasts and crush them with blocks.  The iPhone doesn’t have a D-Pad, so moving a character around the screen is a bit tricky.  I had to make several modifications to the original game so that it would work with the touch interface:

  • You can move the player around the screen by pushing your finger around.  However I had to make the player unable to move diagonally as I found the resolution of your finger movement made it near impossible to play and quite jumpy if I allowed diagonals.
  • You can touch any point on the screen and warp to that location.  The controls were still a bit tricky, so I had to add this feature so you could do quick movements to escape from a beast, or to attack it quickly.
  • I disabled the beasts so they can’t move diagonally, made the super beasts spawn into only 4 instead of 8 normal beasts, and slowed down the beast movement by about 50%.  These changes were all required to make the game playable.

All these changes turned an impossible to play on the iPhone into a reasonably fun diversion.  I also added a notable element of speed into your score.  This gives the player a good bit of replay value, since even after they beat a level, they can try again and try and “master” a map they are playing.

Overall the main point of this whole exercise was to get myself back into iPhone dev.  Really last year when I worked on Galcon I threw myself violently into that project for 3-4 months and came out a bit burnt out.  I knew this time I needed to do a small scale project to get going again.

I’m pretty pleased with the results of this project.  For some more interesting factoids about the game project, check out my game blog announcement.

Excuse to post this to the python planets: I actually made a python version of this game a few years ago.  It contains some really bizarre pure python sound-synth for both the music and sound effects.  Check it out.  Not only all that, but the whole game is a single 18k python file!  I ported from this code for the iPhone version.  Again, another great example of python prototype -> C++ final product!

(Silly side-note, actually the python code was a port of some C++ code I made ages ago.  So this is a great example of C++ code that was ported to python and then later ported back to C++.  I won’t bother you with details about my even earlier Java and C versions of the game.)

Can’t do everything ..

Wednesday, February 18th, 2009

Alas, I’m not going to be able to make PyCon this year .. Because I’m a finalist in the IGF Mobile competition 🙂  And the GDC is happening the same week as PyCon.  Oh well, can’t do everything.  I wish I could go to both, PyCon was a blast last year!

That said, some of us tinypy folks might do a tinypy sprint at the same time as the PyCon sprints.  So if there are any people at PyCon who want to sprint on tinypy, get in touch and we can all work together in #tinypy somewhere.  Further news about this sprint will be available in the tinypy mailing list.

tinypy has progressed a bit since I last posted about it.  It’s probably sandboxed and it now has meta methods.  If there are some serious smart VM coders who are interested, we could use a hand.  tinypy is as fast as python for some tasks, but for other things it is around 1/2 the speed of python.  It also uses more memory than python.

From python to C++

Saturday, February 14th, 2009

I think I wrote an article a few months ago comparing C and python.  I’m doing some new iPhone games now, and this time I’m using C++.  I found not having classes was getting to be too painful for me, so I’m trying out C++.  Here are a few things I’ve observed:

(As a side note – I’m writing my games /almost/ the same way I’d write them in python.  So if you’ve seen my game code, I’m doing almost the same stuff, except in C++.)

  • As usual, not having memory management is a bit of bother.  Fortunately, I’ve found there are only a few places where I actually need it.  The main thing I had to do was write some basic reference counting code for my state engine class.
  • I’m using structs instead of classes, since I have no use for private variables or methods.
  • Having separate .h and .cpp files is a drag.  But them’s the breaks .. It sure would be swell if C++ was a wee bit smarter about that.
  • For my in-game objects, I just define a single struct that has all the possible variables I need.  This is pretty much how I did things in python anyways.  I’ve never been a big fan of using much inheritance.
  • For writing my GUI classes, in python I was able to get lots of magic into them.  In C++ it isn’t so easy to get magic, so I’m doing without most of it.  It seems that most of the magic was gold-plating anyways.
  • Having written all this code in python before, getting clean C++ code seems pretty natural.  I know what I WANT my code to look like, so I try to get my C++ to be as close as possible to that. 
I think the bottom line of this post, is that my code is coming out pretty pythonic.  Maybe?

I’m on twitter now ..

Thursday, January 29th, 2009

I’ve just created a couple twitter accounts for myself!

philhassey is going to be my dev twitter account, where I might be posting real-time stuff about game-dev, python, and whatever else comes up.  Should be interesting if I get into it 🙂

galcon is my twitter account for news about Galcon, galcon.com, new games, etc.

P.S. Galcon for the iphone is an IGF Mobile finalist!  Check it out!

Running OpenGL Apps on a Linux guest in VMWare Fusion

Monday, January 26th, 2009

Here’s my “tip of the day” for running OpenGL Apps on a Linux / Ubuntu guest in VMWare Fusion.  The problem is that while running VMWare Fusion on OSX, your guest Ubuntu system doesn’t have 3D acceleration.  Bummer!  I really like doing my game-dev under linux .. so after a bit of searching I found this neat trick:

1. Open a Terminal in OSX (host OS)

2. ssh -Y ip.address.of.guest.OS
(You can find out the IP address of your guest OS via ifconfig.)

3. run the game you are working on 

4. OSX pops up a window with your game running at full speed!

Via that SSH session I can run my games under linux, but the OpenGL stuff is forwarded to my OSX host, which renders it at full speed.  This is called X11 forwarding, which I had heard of before, but I didn’t know it included OpenGL 🙂

I’d love it if Fusion included 3D acceleration of linux-based Guest OSs, but in the meantime, this will get me by.  One thing to note, this isn’t perfect.  I tried running tux racer, and although it seemed to run at full speed, the view wasn’t centered and so I only saw the top left 25% of the game.

-Phil

Setting up my Mac (part 2)

Friday, December 19th, 2008

(Okay, I’m going to syndicate this to the python planets, because well .. it seems general enough of interest that maybe other python folks might be interested.  However, if this sort of stuff is unwanted, please tell me and I’ll reign in my planet posts to being on-topic.)

Anti-Virus

So, I think I’m going to go with eset nod32 anti-virus.  From my research there are about a dozen pretty good anti-virus solutions.  I had tried this one out about half a year ago, and I found that it didn’t drain system resources.  My main objective with anti-virus is to have *something* and have it stay out of my way.  This one has one several awards in the past few years, so I guess it must be decent.

Folder Sync

I mentioned in my last post that I really wanted to be able to sync my photos, music, and documents between several machines.  I would use subversion, except somehow it just doesn’t seem like “the right tool” for the task of managing 1000s of photos and mp3s.

What I did find is the Unison File Synchronizer, which appears to do exactly what I want.  If we have a photo gallery and we add pictures to it, those pictures will get automagically synced to a central server and then automagically synced back to other machines.  It wouldn’t be a useful solution for source control, but it looks like a nice solution for managing a photo / music / document collection.

I’ve only given it the five minute inspection, so I can’t say for sure if it will work yet.  Stay tuned for a later report on it.  (If anyone has used it and has tips they want to give me, I’d love ’em!)

Python on Mac

Most people suggested MacPorts.  I guess I’ll give that a whirl sometime.  I think I need to update Classic Galcon at some point anyways.  (Okay, I did mention something about python.  I failed at being 100% off-topic.)

Virtual Machines

I haven’t resolved all the issues yet.  Right now I’m a bit vague on how many Windows XP licenses I’m using.  I’ve got Bootcamp, VMWare, and Parallels all with XP Pro .. Does that count as 3 licenses?  Or one?  Hmmn.  I suppose I should figure that out.  I was able to get Parallels to work with Ubuntu by disabling shared folders, disabling the sync time feature, and enabling the adaptive hypervisor. (As per some post on the Parallels forums.)  Hopefully though, they can fix the bug that causes it to hang with those features on.

Life In General

I’m looking forward to the Christmas break 🙂  A lot of things have been going on between my two businesses and life-in-general.  So a couple days off will do me well.  I must admit, the diversion of messing with this laptop has been pretty fun.  I was able to power up the gimp the other day and color in our Christmas card.  Merry Christmas to ya:

OS/X and virtualization

Saturday, December 13th, 2008

Hey .. so I got myself a MacBook Pro.  Here’s why:

– I found that at pycon, having linux on my laptop just didn’t work so hot.  Just too many driver issues to really make it be great for day to day use.

– I really would like to be able to do all my dev from one machine.  With a Mac “supposedly” I can work in Windows, Linux, and OS/X from the same machine.  Then, gee, I wouldn’t have to have my house cluttered up with so many computers.

I got the machine a few days ago.  Since then I’ve been playing around with my different options for realizing the “one machine” vision.  Here are some of my experiences so far:

Parallels Desktop

– I was able to install XP Pro easily.  Had a minor mouse related glitch when running Microsoft Office Live Meeting and sharing my desktop.  Tried playing Vampyre Story (a new adventure game by Bill Tiller!), this didn’t work.  Game crashed during the startup of the game.  So I guess the DirectX promises are a bit shallow.

– I was able to install Ubuntu 8.10 and 8.04.  However, in 8.10, the shared disk was useless.  In 8.04, the VM hangs after a while for no particular reason.  Most of these issues seem to be well covered in the Parallels forums.  So it seems that Parallels is useless for Linux stuff .. at least for Ubuntu, which is the distro I want to switch to for dev, since it’s most likely to be used by a Linux gamer.

– I tried interacting with their support and found that they appear to be using babblefish to translate my questions to their foreign staff who then type in an incoherent answer which is then translated back to English.  Somehow it didn’t seem worth the bother.

– If they fixed the Linux VM hang issue, it would be an excellent solution for all my VM needs.  

Crossover Games

– I tried to run Vampyre Story.  It didn’t even get through the installer before locking up and anytime I put a disk into the computer it tried to interact (weird default setting, I was able to switch that off).

– Not really useful to me.  I suppose it could be good if your game of choice is supported.

VMWare Fusion

– I was able to install XP Pro easily.  It auto-installed its Tools.  Sound seemed to work better in this than in Parallels.  Vampyre Story failed exactly the same way as in Parallels.  I suspect they have some common code for doing the DX9 emulation.  Too bad it doesn’t work for my game of choice.  Hopefully the 3D is good enough for my game dev, which isn’t so bleeding edge.

– I was able to install Ubuntu 8.04 on it.  The handing of Fullscreen vs. Windowed mode isn’t nearly as smooth as in Parallels.  One real drawback is that if I have both Windows and Linux in Fullscreen mode, Fusion attempts to put them both on the same “Space”, so I can really only have one in Fullscreen mode at a time.  That is non-awesome.

– If it weren’t for the Fullscreen issues, this was looking like an excellent solution.  I guess I’ll have to wait and see if Parallels or VMWare fixes issues quicker.  It does seem that VMWare has a better commitment to Linux support, which is hopeful.

Boot Camp

– OS/X comes with “Boot Camp” which allows for Dual booting of your machine into OS/X or Windows.  It works great if you don’t mess up.  It took me three tries to get Windows XP Pro installed properly.  (HInt: read the Apple troubleshooting guide BEFORE you try to run Boot Camp, not afterwards.)

– I was able to play Vampyre Story with no problem.  The game looks great!

– I haven’t tested much else, but since it’s just booting into Windows, I’m guessing it will work fine.  When running Vampyre Story the fan is on most of the time.  I guess all those pretty graphics really tax something or other.

Misc Thoughts

Both Parallels and Fusion support shared disk, which I’m hoping works.  It won’t be until I really dive into some dev that I’ll be able to comment on that.  Nice stuff, anyways.  

I do hope this all works out, as I really want to trim down the amount of machinery I have in my office.  I think my favorite experience so far was getting Parallels doing fullscreen for both Linux and Windows.  With OS/X Spaces, I was able to switch between OS/X, Windows, and Linux with the press of a key. 

Battleplan

I’m basically taking off a few weeks from game dev to mess around with this machine.  Some of the things coming up are:

– Figuring out how to deal with python under OS/X.  If anyone cares to give me tips in advance, I’d sure appreciate it.  I’m aware there are at LEAST 3 major ways of doing this.  1. Use the included python 2. Use the python from python.org 3. Use darwin 4. Use macports .. Or something like that.  I’m not sure which will be best for my situation.

– Trying out the iPhoto, iMusic, Garageband, and iMovie software.  Linux has always lacked on the “use to use junk” front .. and Windows isn’t much any better.  So hopefully these tools will be nice.

– Figuring out a decent backup scenario.  I’m aware of timemachine, which I’m sure is great .. But I’m interested in having shared folders across several machines .. and doing backup to a 3rd machine.  We’ll see what I can come up with for that.  I’m quite comfortable with rsync, so I wouldn’t be surprised if that comes up.  Any suggestions would also be appreciated here.