Now we're cooking!

After getting nothing done on day 1, and deciding to abandon my original idea and start again this morning, I've spent the evening learning OpenGL for doing 2D stuff, and have to say, it's pretty damn sweet. Hit a few brick walls along the way, and it's taken me a while to get my head around the way the API works, but I've now managed to write (completely from scratch) a set of 2D routines to handle fonts, scrolling backgrounds, sprites (with rotation, scaling, alpha blending, automatic movement and inertia) plus a handful of bits and pieces which will be generally useful for games. I'll probably get around to optimising it all tomorrow, but for an evening's worth of work it's actually looking pretty tidy. I'm probably not actually going to need a lot of the stuff I'm coding for this game, but I really want to make sure I understood all the important stuff now, rather than it causing me problems when the time starts to run out. And anyway, it may be useful for adding eye-candy if I have any time left towards the end of the week. I'd like to add a basic particle system, a simple animation system and some intelligent path following for the sprites before I call it a day, but I'm just reaching that point where tiredness is starting to make it all somewhat less fun, so I may leave it until tomorrow. Aside from a font which I'll probably keep, and a bunch of abstract test bitmaps, I've not really gotten around to doing any artwork, so once I have today's libraries tested and optimised, and I've worked out how to use py2exe (how hard can it be?!?), I'm going to sit down and draw a few odds and ends so I can post up at least some screenshots of version 0.1 before the end of tomorrow. That's the idea anyway.

(log in to comment)

Comments

Py2exe with PyOpenGL can be a bit difficult. For packaging up my PyWeek 1 entry, I came up with a script like the following:

import sys
from distutils.core import setup
import py2exe
import glob

opts = { 
    "py2exe": { 
        "excludes": "OpenGL, _dotblas, pygame.sndarray, pygame.font, multiarray, pygame.surfarray, pygame.mixer_music"
    } 
} 


setup (
	options = opts,
	version="0.1.0",
	description="Fast 3D shoot-'em-up",
	name="Accelerator",
	windows=["accelerator.py"],
	data_files=[("gfx",glob.glob("gfx\\*png")),("snd",glob.glob("snd\\*wav"))],
	zipfile="lib\lib.zip"
)

Notice the "excludes OpenGL" bit. I then added 'sys.path.append("lib")' to my main game script, allowing it to look in the local lib directory for Python modules, and distributed the game with as little of the contents of Python24/Lib/site-packages/OpenGL as I could get away with manually shoved inside a local lib/OpenGL directory.

You would run this by saying "py2exe.py py2exe" IIRC.

Thanks mangobrain, you're an absolute star. Looks like that'll save me a fair bit of messing around later on.