Phil Hassey - games, tech, web, stuff, biz, and bilge
Phil Hassey as Wolverine
"What kind of
arrogant jerk
has a website like this?"

FEAR THE PANDA

March 2nd, 2010

Yeah, you better …

pandapromo

This image represents the last few days of work.  I have ported some 3000 lines of python code to tinypyC++ code.  Fear it.

-Phil

Guide to finding Phil at GDC

February 26th, 2010

Hey,

So I’m going to be at GDC .. all week!  Here’s how to find me .. look for this guy:

IMG_5313

I’m going to be speaking during the iPhone Summit about multi-player games.  Check out the talk listing here.  I’ve been slaving away at the talk all this past week, and I think it’s come out pretty sweet.  I’ll be practicing it quite a bit over the coming week so that I can hit it pretty solid come Tuesday morning.

Other than that, I’ll be hanging around the iPhone and Indie summits a good bit, and just generally around for the rest of the week.  If you see me, come by and say ‘hi’!  Send me an e-mail or comment if there is anything cool going on that I should know about.

Thanks!
-Phil

Rebuilding my GDC talk …

February 22nd, 2010
Me speaking two sentences at some political thingie.

Me making a 15 second speech at some crazy political thing.

So, wow .. I’m going to be speaking during the iPhone summit at GDC in two weeks. The last few months have been a whirlwind of activity for me as I’ve been churning out Galcon Fusion. So now it’s time to get to business getting my talk ready.

Part of the GDC talk process is sending them a title and a draft version of your talk a month or so in advance. I did this with my talk, which was titled, “Nuts & Bolts of Internet Multiplayer iPhone Game Testing” .. The feedback I got from the iPhone summit advisors was (to summarize): “This talk looks short, and maybe a bit boring.”

After a week of soul searching and considering my options, I had to agree. I wouldn’t want to go to my talk, it didn’t sound that great. Having nowhere else to turn to, I turned to PyCon. I knew that at PyCon people gave talks about how to give talks almost every year. I’ve missed the last two PyCons, so thankfully they’ve been posting them online!

I watched Andrew Kuchling’s How to Give a Python Talk which gave me some insight. The three points he made that really struck me were:

  • Think About Your Audience

    This means I need to give my audience a reason to be at my talk.  What are they interested in?  What do they want to accomplish?  What can I give them so they are empowered to accomplish this goal?

  • Too Short > Too Long

    Andrew related that it’s better to cover too much material in too little time, then to cover too little material in too much time.  If I can cover a blazing amount of information, but at least hit some key points with a strong note, the audience will come away with something.  If I drone away about nothing for 30 minutes, they’ll come away bored.

  • Rehearse your talk!

    I knew this one.  But, it’s good to be reminded.  To those who are coming to GDC and plan on seeing my talk, fear not.  I’ve got this week and next week with NOTHING planned, so I’ll be rehearsing my talk MANY times.  I plan on delivering this one with a bit more style than last time.  Last time was at 360iDev, my first “long” talk at a conference.  I  rehearsed my talk about 1.5 times, and I think it showed.

I think for me the first two points answer my question really quickly.  Why does a dev want to hear me talk?  They want to learn how to make a multi-player game.  As for length, I can cover a bunch of keys to creating a multi-player game and maybe people will latch onto a few key points.  If I only cover testing (as was my original plan) the people at my talk would walk away completely unable to use that information if they don’t have any idea where to start.  Instead, if I give the whole picture, and include testing as part of it, they’ll have enough to go on to get started creating iPhone multi-player games.

-Phil

P.S. Yeah, if anyone wants to give me tips on talking, feel free.  Oh, and I think my talk is going to be re-titled to: “How GALCON Conquered the Universe of Online Multiplayer Games”

The Galcon Fusion beta testers rocked

February 11th, 2010

Galcon Fusion has arrived.“Yay, it’s finally here! Check out Galcon Fusion today! We’ve got a free demo and it works on Windows, Mac OS X, Linux, and Steam! It features some crazy nice hi-res graphics and soundtrack. And epic multi-player battles like you’ve never seen ‘em before! Have fun!” <– marketing blurb ;-)

Okay, for some dev thoughts. Man, it was a long week! Adding the “demo” feature to the build was a ton of work. And then doing all that other ’stuff’ that sort of comes up. I think the one serious lesson I’ve learned in this whole process is that beta-testers are awesome.

Really awesome. I had about 50 people who I passed out 10 builds of the game to over the past 3 months. Some of these people put in several dozen hours of play time. All this was a huge help for me, as this was my first desktop ‘3D’ game, so I had a lot of learning to do in terms of graphics capabilities. As in, I was able to get the game to run on my computer which is a pretty nice MacBook Pro .. but not everyone else’s.

The beta tester feedback was huge, I was able to get the game running on old PPC macs, various linux netbooks, and who knows what else .. as long as it had a somewhat reasonable 3D card. I changed the memory requirement for graphics from about 200 MB down to < 64MB. Without any noticeable reduction in graphics quality even in HD video modes. In fact, that reduction changed the loading time on my computer from 5-8 seconds down to about 1 second :)

Anyway, I think I’m going to take a nap. It’s been a long week, and I really appreciate everyone who helped me get this game put together. Give it a whirl, and thank the beta testers!

5 awkward and 5 awesome things about lua …

January 29th, 2010

Hey,

I’ve been spending some time checking out lua, because I’m thinking about using it for scripting in games.  I’m looking at it instead of tinypy because tinypy is slow and really needs some more TLC to be totally useful to me.  However, after looking at lua for a while, I’m finding the things that make it feel awkward to me.

  1. List indexes starting at 1.
  2. For loops use [a,b] intervals
  3. No += operator.
  4. do / end keywords instead of { }
  5. List and Dict types combined into one

At the same time, I’ve found that lua is totally awesome.  I mean, wow.  Really slick stuff!  Here’s 5 awesome things:

  1. Small codebase
  2. Faster than other dynamic languages
  3. Easy API integration
  4. Coroutines <- these are neat!
  5. State is serializable

So here are my thoughts:

  • The first 4 awkward things are superficial, I could probably hack those into shape in a day or two.  The 5th item (List + Dict) as one item is probably not something I can fix, but I could probably live with it.
  • If I changed the language like that, and provided it for users to create mods for my games I would not be able to give them a link to the lua documentation, since it would not be accurate anymore.

Not quite sure what to do here.  Lua seems great, though a few language design decisions seem awkward to me.  I could change the language easily enough, but then I would be breaking all the lua documentation for my users.

Anyone got some language-design thoughts on this one?

-Phil

Galcon Fusion announced – Finally!

January 29th, 2010

Hey,

So, I’m finally announcing Galcon Fusion to the world.  Fusion is a port of iPhone Galcon + Galcon Labs to the desktop.  This time with hi-def graphics and a full interactive soundtrack.  It’s going to be coming to Steam and direct on my website on Feb. 11.  Users who supported me when I was first starting (as in, you bought desktop Galcon), your license is compatible with Galcon Fusion.  Thanks!

fusion-pink-green

There are a few technical things that were challenging, dealing with endiannes for my network code, supporting fullscreen vs widescreen resolutions, and supporting a wide range of resolutions (from 800×600 all the way up to 1920×1080.)  To make it short, here are a few conclusions: best to support endiannes from the start, fullscreen vs widescreen is a pain, and baking lots of image data into your binary is a pain because it requires a ton of recompilation.  Oh, and installing VC++2008 is waaaay easier than installing mingw32, but keeping code working on both takes more effort.

I think my biggest conclusion comes along with this announcement, is that doing “secret dev” work isn’t really that sensible.  If you look at that last paragraph, there are a ton of issues I could have documented in my blog that I didn’t because I was all being secretive.  And hey, since I was so mum on this, nobody has heard about it until today.  I guess there might be some benefits to this (??) but I can’t think of what they are.  I think blogging about my progress is a good way for me to be able to see what I’m doing and not get lost in the haze myself.  My recent article on VC++2008 is a great example of something I’m going to get quite a bit of value out of just for my own reference.

One big different thing I’m doing with this project is my wife Nan is doing the PR for it.  She’s contacting all the reviewers, the general press, the newsletters, the announcement blog, twitter, and everything.  I’m trying to take a more dev-only role in the announcement.  This is nice, because I’m not very good on PR.  I try .. but I really don’t do it as well as I want to, largely because on a launch of a product I’ve always got about 50 technical things I’m trying to do along with the PR!

-Phil

VisualC++ 2008 for gcc / SDL people

January 14th, 2010

I’ve had to port a project to VC 2008 from my usual mingw setup.  Here’s what I did.  This covers quite a few things, in particular where to find common GCC settings in VC land.

Setting up the project
  1. New project
  2. Type: win32
  3. Template: Win32 console if you want a console.  Or just Win32 Project if you don’t want the console to pop up.
  4. Choose a name for your project
  5. The solution name is the folder everything gets put in.  In VC, you can have several projects within a single solution.
  6. On App settings, I choose Windows application, Empty project

Adding the source files

  1. I right click on my project name and Add>New filter, and use that to bundle a few different sets of source files together
  2. This is done so that VC will compile the files, but keep in mind that the separations don’t seem to mean anything to VC.  It’s just for your visual convenience.
  3. Note that if there are two files with the same base name “dostuff.c” and “dostuff.cc” this will cause VC to choke during compilation as it will create two .obj files with the same name and fail during linking.
  4. VC doesn’t support C99 so any C99 files will have to be Right Click > Properties > C/C++ > Advanced > Compile as > C++ Code

Note: a Project can have a number Configurations (Debug, Release ..) If you are targeting a certain distribution site with some special requirements you can add more Configurations via Solution > Properties > Configuration Manager >

Compilation Options

Adding some project compile time options (mainly -D and -I equivalents for specific defines and include folders.)  Keep in mind which Configuration you are modifying at all times.  You can also switch to “All Configurations” for global changes.

  1. (GCC -I)  To add in include folders, Project > Configuration Properties > C/C++ > General > Additional Include Directories > … I found with include folders you often need to stack on a few ../../’s to get it to point at what you want it to point at.  (In my project I’ve got my VC project separate from all my source code, so everything is up and over a few folders.)
  2. (GCC -D)  To add in defines, Project > Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions > .. I often add a few of these to tell the code what build we’re doing.  (iPhone vs, Windows, vs Linux, etc)
  3. (GCC -W)  Although warnings might be useful .. They made it impossible to see the errors.  You can turn down the warnings from level 3 to 1 in Project > Configuration Properties > C/C++ > General > Warning Level >
  4. (GCC -l)  Linked libraries are probably going to be needed.  Again in my project I’ve often got a few ../../’s in the paths.  Here’s where you add this stuff: Project > Configuration Properties > Linker > Input > Additional Dependencies >
  5. .. an alternate way is to add #pragma comment(lib,”MyLib.lib”) into your main.cpp.  By doing this you can refer to a lib right within your source if you prefer.
  6. For whatever reason, you may need to exclude some libs from being compiled into your project.  (If you see errors like “_tolower already defined in MSVCRTD.lib, etc).  You can exclude a lib in Project > Configuration Properties > Linker > Input > Ignore Specific Library > .. (in my case, I had to add msvcrt.lib and libcmt.lib)
  7. For my project I needed to expand the size of my stack, due to having excessive amounts of static data compiled into the project.  You can do this via Project > Config Properties > Linker > System > Stack (Reserve&Commit) Size > .. I changed them both to 4000000 and things worked.

Final packaging

I found that running right from VC didn’t always work. (Maybe I should find out why, but I haven’t.)  But I can run from the command-line.  Before doing so, I needed to:

  1. Copy in required dlls from SDL, etc
  2. Copy in game data files
  3. Copy in the VC Runtime files from: C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT
  4. For a release build I’m sure to build against SDLmain_nostdio.lib so that the game won’t crash Vista/Win7 where writing out stdout.txt and stderr.txt may result in some kind of fail.

Saving to Your_Favorite_Version_Control_System

  1. You may leave out all your ‘Debug’ folders or other Configuration folders, those seem to only contain generated files.
  2. You may leave out the .ncb and the .COMPUTER.username.blah file, they seem to be used by VC for stuff that can be regenerated, etc.

Hopefully this will be helpful to anyone who does the same thing.  Between you and me, I found the install of VC 2008 to be pretty nice in comparison to trying to install mingw, which tends to require considerable muscling.  Also, since everyone provides their libs as MSVC libs, building against those vendor libs is not only easy, but possible.  (With mingw, many MSVC C++ libs are unusable due to binary incompatibility.)

-Phil

P.S. Adding an Icon to your Project

This is pretty easy.  Add a Project.rc to your project.  The Project.rc should include this line:

IDI_PROJECT       ICON         “path/to/icon256.ico”

You can create an Icon with IconFX .

P.S.S. Creating a windows Installer

I’ve used Innosetup in the past.  It seems to work.

P.S.S.S. Dealing with LPCTSTR conversions

If your whole project is using C-strings, you can go into Project > Properties > Configuration Properties > General > Character Set > and change it to “Not Set” so that VC will no longer try and use Unicode strings to some of its functions (like ShellExecute.)

xkcd “Self-Description” solved with python+pygame

January 13th, 2010

Well, something about this xkcd comic drew me in …

The 3rd panel reminded me of a study I did in college on iterated function system fractals.  These fractals are known for creating ferns, trees, and the Sierpinski triangle.  There are a number of ways of creating these fractals, but one of them is called (something like) the reducing photo copier method.  Where you can start with ANY starting image on your photo copier, and just shrink the images, make a few copies, position them on the copier, and repeat.  Eventually your image converges towards the fern / triangle / whatever if you are precise.  (This can be done with a ‘Real Life’ photo copier for simple IFS like the Sierpinski triangle.)

So as a way to avoid work that I’m supposed to be doing this evening, I figured I’d see how “accurate” this comic was.  Here’s my pygame code that checks it out.  If you run main.py it will start with an image (the xkcd logo) and each time you press a key it will do an iteration of re-creating the comic.  You can see it flashing between the current iteration and the original strip.  After about 4-5 iterations the images converge (pretty closely.)

The most interesting bit was trying different starting images and seeing how long it took to converge.  Starting with all black  it takes 6 iterations.  Starting with all white takes 5 iterations.  And starting with the xkcd logo takes 4 iterations.  The logo probably goes the quickest because it has some black and white in it (like this image) so it converges faster.  (You can edit main.py towards the bottom page to try these different starting points.)

So .. there ya go!  Enjoy!

-Phil

Is None more like 0 or -1 ?

January 7th, 2010

In tinypyC++ every variable is a certain type.  In some cases I may have an int x = None;  But I’m not sure what that should mean?

What’s the most pythonic? Here’s some anecdotal evidence:

>>> None,None==None,None==-1,None==0,None==1,None==False,None==True,bool(None)
(None, True, False, False, False, False, False, False)
>>> -1,-1==None,-1==-1,-1==0,-1==1,-1==False,-1==True,bool(-1)
(-1, False, True, False, False, False, False, True)
>>> 0,0==None,0==-1,0==0,0==1,0==False,0==True,bool(0)
(0, False, False, True, False, True, False, False)
>>> 1,1==None,1==-1,1==0,1==1,1==False,1==True,bool(1)
(1, False, False, False, True, False, True, True)

So .. you can see -1 gets 4/7.  0 also gets 4/7.  (1 gets a mere 3/7, so it’s out.)

Anyone care to tilt the scales to -1 or 0?

Exceptions and various compilation option speeds

January 6th, 2010

So after some discussion yesterday with a few folks about Exceptions in C++, I decided to add a compilation flag to disable the use of exceptions in tinypyC++.  The claim given to me was around these few items: 1. Exceptions slow your code down.  2. Exceptions aren’t cross-platform (in some cases).  3. Exceptions can easily add in memory-leaks.

I can’t argue with #2, although it’s not completely relevant for the platforms I’m targeting right now.  #3, with the way tinypyC++ does reference counting, I wouldn’t be surprised if this could happen.  #1, I figured might be true, but I wanted to know how real #1 actually was.  So here are my results:

g++ flags ms
(none) 894
-g 891
-O3 414
-DTP_NO_THROW -fno-exceptions 894
-g -DTP_NO_THROW -fno-exceptions 878
-O3 -DTP_NO_THROW -fno-exceptions 378

In the first test I’m rendering a Julia fractal for 20 frames and averaging the time it takes to render. In the second test (below) I’m doing the same test, but I did one code optimization to remove a new/delete that was happening for each pixel – by reusing the coordinates object.

g++ flags ms
(none) 293
-g 290
-O3 153
-DTP_NO_THROW -fno-exceptions 304
-g -DTP_NO_THROW -fno-exceptions 303
-O3 -DTP_NO_THROW -fno-exceptions 112

I found it interesting that in the 2nd test case I did, removing exceptions actually increased the time it took to render the fractal!  Not quite sure why .. hmmm.  (I tried it a few times and kept getting similar results too.)

What is clear in the second test is that the compiler is able to optimize the code much more aggressively.  I guess Exceptions choke up the optimizer.  In all cases it seems that adding on the -g flag seems to make the code run slightly faster, surprisingly enough!  (-g adds in debugger info.)  In all cases, the optimizer was able to roughly double the speed of the program, and when I disable exceptions it is able to throw in even more speed.

-Phil


Galcon   Watermelons   Dynamite   The Hairy Chestival
All content of imitation pickles (c) 1999-2008 - Phil Hassey  "we care"