I want to work in Python

BlitzMax Forums/BlitzMax Programming/I want to work in Python

Jay Kyburz(Posted 2007) [#1]
Hi All,

I've been away a while playing with other systems. To keep a long story short, I've fallen in love with Python and don't want to come back to blitz.

Problem is, there is no cross platform games library that comes anywhere close to beeing as good as Blitz Maxes. At the moment I'm using Pygame (SDL), but it really is slow.

So I just had an idea, I was wondering if you guys who are more technical than me could tell me how feasable it is.

I would like to write a Max app that calls a python script with callbacks allowing the script to call each of Max's 2d functions. Possible?

Does the LUA module do something similar to this?


Beaker(Posted 2007) [#2]
Wrapping Python is way too complicated. Doing it the other way round may be easier.

Have you seen Panda3D (which uses Python)?
http://panda3d.org

I agree tho, Python is great. I even heard somewhere that Mark likes it as well.


Gabriel(Posted 2007) [#3]
Does the LUA module do something similar to this?

No, but the guy who wrote the updated version says his next version will do the opposite ( what Beaker was suggesting ) which should be good.


FlameDuck(Posted 2007) [#4]
At the moment I'm using Pygame (SDL), but it really is slow.
Tried it with Psyco?


Jay Kyburz(Posted 2007) [#5]
Thanks Guys!

I realise you would want to wrap max not python, I was just trying to describe a system where the Max app was the main entry point and then called the script which in turn called functions in that main aplication.

Sounds like its not imposible. How far along is this new LUA module. Links?


Jay Kyburz(Posted 2007) [#6]
Hey FlameDuck, Psyco will speed up my python, but it wont change SDL from beeing a 2d raster render to an ogl polygon based one.


Gabriel(Posted 2007) [#7]
Dunno how far along it is, but his original estimate was around now.

http://www.blitzbasic.com/Community/posts.php?topic=63067


jhague(Posted 2007) [#8]
The approach I use is to do all graphics/sound/input related stuff in Blitz (a small minority of the code in most projects), then write the rest of the app in whatever language I want. The main app communicates with the Blitz part via a TCP socket.

This should be easy in Python, as there's great support for both sockets and decoding binary data (the "struct" module).


bradford6(Posted 2007) [#9]
Python is phenomenal. I absolutely love programming in it.
I have used it to knock up a CGI page, parse a spreadsheet, log into a bunch of cisco routers. etc. etc.


Python is interpreted so in the 3D Game world it is probably best as a scripting language or AI (maybe not the core drawing routines...even using psyco or other Python compilers).

Python is excellent for text parsing as well. In fact, there are so many things that Python does well that it would make sense to have a Python Module for BlitzMax (I think? I don't know how that would work actually.)

Mark mentioned his interest in Python awhile ago and I have to admit it did take a while to get used to the 'forced indentation' stuff in python, but to be honest, I use those habits in my Blitz Code and it makes reading and debugging it SO much easier.


I even use it as my calculator (on all systems, linux, mac and Windows. just fire up the interpreter and type in your variables)

Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> xrate=0.115
>>> cash=300
>>> cash*xrate
34.5
>>>




FlameDuck(Posted 2007) [#10]
Actually you could alternatively just get one of the engines that support Python as a scripting language (although they're quite expensive). Like Source or Gamebryo.