RE: [GD-Consoles] question: Embedded scripting language on consol e
Brought to you by:
vexxed72
From: Tom F. <to...@mu...> - 2003-02-20 11:29:04
|
Bear in mind that the project is only about a third of the way through, so we haven't hit any evil crunch times yet. Porting was pretty simple. You need to override the memory handling stuff to use your own heaps of course, but that was pretty simple. You also probably want to give Python its own heap because it does a lot of 12-byte allocations, and if you throw that in the general heap you'll get horrible fragmentation. We used a stack-based allocator hard-coded to deliver 12-byte entries - nice and fast, no fragmentation. Biggest worry is speed on the PS2, because its cache is sooo tiny. But Python is hardly a speed demon in the best of times, so you need to make sure you're not using a "heartbeat" system (i.e. calling each object each frame) - you need a queue-based event system and a C "autonomic" system to do the mundane work. This is just good programming practice, whatever language you use, but it's especially important when using a slow scripting language for your high-level stuff. SWIG takes a bit of work to integrate into the toolchain, and it's still not great - it doesn't auto-SWIG headers very well, and we do tend to have to manually do a "SWIG rebuild" quite often. However, it is pretty fast, so that's not a big problem, it's just a bit annoying. I suspect we could fix it easily if we just wrote a makefile (rather than trying to use VC.net's stuff, which isn't very suited to this sort of stuff). Benefits are that Python is incredibly easy to code, and we've got some good stuff up and working very quickly. And of course you get a scripting language that the designers can use "for free". Yes, it's a brave step. But we know that if it does all fall down around our ears and speed is a big problem, we can just port the code back to C, and only use Python for actual "level scripts" (this switch opens this door, stuff like that). SWIG is probably the most important bit of the puzzle, because it means that you can freely mix and match Python and C - they can access each others members and fucntions quite happily, which means you can throw code from one to the other in case of speed emergencies. But we've not had to so far. Even if the worst happens and no trace of Python survives to the shipped game (which I very very much doubt), Python is a great prototyping tool. We were inspired by Humungous's work with Python and SWIG - they've definately had more experience with this sort of stuff. IIRC, there's a GDC talk they did on the pros and cons and gotchas. Definately worth checking out. Tom Forsyth - Muckyfoot bloke and Microsoft MVP. This email is the product of your deranged imagination, and does not in any way imply existence of the author. > -----Original Message----- > From: Andrew Perella [mailto:aj...@eu...] > Sent: 20 February 2003 10:54 > To: gam...@li... > Subject: RE: [GD-Consoles] question: Embedded scripting language on > console > > > Hi Tom, > Can you tell us more of your experiences with using > python on ps2/xbox/gc? > What problems have you had? What unexpected benefits did you get? What > worries do you have at the back of your mind? My feeling is > that this was a > brave step to make at this time. > Regards, > Andrew > > > Dr Andrew Perella > Programming Manager > aj...@eu... > > Eutechnyx Limited is a Deloitte & Touche Fast 50 and a Sunday > Times Tech > Track 100 company. > > Eutechnyx Limited > Metro Centre East Business Park > Gateshead > Tyne & Wear > NE11 9HU > UK > Phone: +44 (0) 191 460 60 60 > Fax: +44 (0) 191 460 22 66 > www.eutechnyx.com |