python for console game development, memory tracking

Discussion in 'Python' started by Moosebumps, Apr 24, 2004.

  1. Moosebumps

    Moosebumps Guest

    When I have time, I am planning to evaluate Python for console game
    development (on Playstation 2, GameCube, and Xbox). Does anyone have any
    experience with this?

    Pretty much the only resource I have found, and the only thing that makes me
    think it might be possible is this:

    http://asbahr.com/python.html

    I would be interested to hear anybody's experience with Python on consoles.

    Before I even begin investigating though, there is a major question I have:
    How can you track the memory usage of Python? I would like to be able to
    track allocations by function / class, etc. I have googled and seen a bunch
    of threads with 1 guy asking the same exact question that I am, and no
    responses, which leads me to believe it's very easy or not possible. This
    would be dealbreaker unfortunately. But I am optimistic that Python is well
    designed so there must be some solution.

    thanks,
    MB
    Moosebumps, Apr 24, 2004
    #1
    1. Advertising

  2. Moosebumps

    Nelson Minar Guest

    "Moosebumps" <> writes:
    > When I have time, I am planning to evaluate Python for console game
    > development (on Playstation 2, GameCube, and Xbox). Does anyone have any
    > experience with this?


    Nope. But in addition to the PS2 and GC Python builds you found:
    http://asbahr.com/python.html

    There's Python for the XBox. Xbox Media Center, the unauthorized
    software, includes Python embedded in the XBMC builds. You'll need a
    modified / hacked XBox to run it. If you want to learn more, I just
    wrote an intro on my blog:
    http://www.nelson.monkey.org/~nelson/weblog/tech/xboxPython.html
    Nelson Minar, Apr 24, 2004
    #2
    1. Advertising

  3. Moosebumps

    Carl Banks Guest

    Moosebumps wrote:
    >
    >
    > When I have time, I am planning to evaluate Python for console game
    > development (on Playstation 2, GameCube, and Xbox). Does anyone have any
    > experience with this?
    >
    > Pretty much the only resource I have found, and the only thing that makes me
    > think it might be possible is this:
    >
    > http://asbahr.com/python.html
    >
    > I would be interested to hear anybody's experience with Python on consoles.


    I can't speak for Game Cube or XBOX, but I have a Playstation running
    Linux, so I know a little. I suspect Game Cube and XBOX have similar,
    but less severe, concerns. Of course, since my Playstation has Linux
    and a big ol' hard drive, I am not constrained with memory as much as
    a native PS2 game would be.

    It seems that Python works just fine. I was able to control graphics
    straight from Python using Numeric and a little C wrapper, and it
    worked pretty well. It wasn't much of a demo, though, and of course
    almost all of the graphics work would be done from C anyways. I don't
    have much more experience than a few graphics demos, though.

    One thing that bothers me a little is that Python uses double
    precision floats, but PS2 only supports single-precision natively. I
    suspect most calculation-type code would be done in C, though.


    > Before I even begin investigating though, there is a major question I have:
    > How can you track the memory usage of Python? I would like to be able to
    > track allocations by function / class, etc. I have googled and seen a bunch
    > of threads with 1 guy asking the same exact question that I am, and no
    > responses, which leads me to believe it's very easy or not possible. This
    > would be dealbreaker unfortunately. But I am optimistic that Python is well
    > designed so there must be some solution.


    You're right that memory is probably the biggest factor against Python
    use, at least if you don't patch it. If you use it for production
    work, I don't think there's any way you'd be able to use Python's
    regular memory allocation. So, seeing that you'd have to use your own
    memory allocation, you can keep track of the stuff yourself. Or you
    can use a library that works on PS2 and also does what you need.


    --
    CARL BANKS http://www.aerojockey.com/software
    "If you believe in yourself, drink your school, stay on drugs, and
    don't do milk, you can get work."
    -- Parody of Mr. T from a Robert Smigel Cartoon
    Carl Banks, Apr 24, 2004
    #3
  4. Moosebumps

    Simon Burton Guest

    On Sat, 24 Apr 2004 07:13:06 +0000, Moosebumps wrote:
    ....
    >
    > Before I even begin investigating though, there is a major question I
    > have: How can you track the memory usage of Python? I would like to be
    > able to track allocations by function / class, etc. I have googled and
    > seen a bunch of threads with 1 guy asking the same exact question that I
    > am, and no responses, which leads me to believe it's very easy or not
    > possible. This would be dealbreaker unfortunately. But I am optimistic
    > that Python is well designed so there must be some solution.
    >
    > thanks,
    > MB


    I was just investigating this myself. Check out pymem.h in the source:

    /* SCENARIOS

    Here are two scenarios by Vladimir Marangozov (the author of the
    memory allocation redesign).

    1) Scenario A

    Suppose you want to use a debugging malloc library that collects info on
    where the malloc calls originate from. Assume the interface is:

    d_malloc(size_t n, char* src_file, unsigned long src_line) c.s.

    In this case, you would define (for example in pyconfig.h) :

    #define PyCore_MALLOC_FUNC d_malloc
    ...
    #define PyCore_MALLOC_PROTO (size_t, char *, unsigned long)
    ...
    #define NEED_TO_DECLARE_MALLOC_AND_FRIEND

    #define PyCore_MALLOC(n) PyCore_MALLOC_FUNC((n), __FILE__, __LINE__)
    ...

    2) Scenario B

    Suppose you want to use malloc hooks (defined & initialized in a 3rd party
    malloc library) instead of malloc functions. In this case, you would
    define:

    #define PyCore_MALLOC_FUNC (*malloc_hook)
    ...
    #define NEED_TO_DECLARE_MALLOC_AND_FRIEND

    and ignore the previous definitions about PyCore_MALLOC_FUNC, etc.


    */


    Simon.
    Simon Burton, Apr 25, 2004
    #4
  5. Moosebumps

    Lucas Raab Guest

    "Carl Banks" <> wrote in message
    news:IhBic.8575$...
    > Moosebumps wrote:
    > >
    > >
    > > When I have time, I am planning to evaluate Python for console game
    > > development (on Playstation 2, GameCube, and Xbox). Does anyone have

    any
    > > experience with this?
    > >
    > > Pretty much the only resource I have found, and the only thing that

    makes me
    > > think it might be possible is this:
    > >
    > > http://asbahr.com/python.html
    > >
    > > I would be interested to hear anybody's experience with Python on

    consoles.
    >
    > I can't speak for Game Cube or XBOX, but I have a Playstation running
    > Linux, so I know a little. I suspect Game Cube and XBOX have similar,
    > but less severe, concerns. Of course, since my Playstation has Linux
    > and a big ol' hard drive, I am not constrained with memory as much as
    > a native PS2 game would be.
    >
    > It seems that Python works just fine. I was able to control graphics
    > straight from Python using Numeric and a little C wrapper, and it
    > worked pretty well. It wasn't much of a demo, though, and of course
    > almost all of the graphics work would be done from C anyways. I don't
    > have much more experience than a few graphics demos, though.
    >
    > One thing that bothers me a little is that Python uses double
    > precision floats, but PS2 only supports single-precision natively. I
    > suspect most calculation-type code would be done in C, though.
    >
    >
    > > Before I even begin investigating though, there is a major question I

    have:
    > > How can you track the memory usage of Python? I would like to be able

    to
    > > track allocations by function / class, etc. I have googled and seen a

    bunch
    > > of threads with 1 guy asking the same exact question that I am, and no
    > > responses, which leads me to believe it's very easy or not possible.

    This
    > > would be dealbreaker unfortunately. But I am optimistic that Python is

    well
    > > designed so there must be some solution.

    >
    > You're right that memory is probably the biggest factor against Python
    > use, at least if you don't patch it. If you use it for production
    > work, I don't think there's any way you'd be able to use Python's
    > regular memory allocation. So, seeing that you'd have to use your own
    > memory allocation, you can keep track of the stuff yourself. Or you
    > can use a library that works on PS2 and also does what you need.
    >
    >
    > --
    > CARL BANKS http://www.aerojockey.com/software
    > "If you believe in yourself, drink your school, stay on drugs, and
    > don't do milk, you can get work."
    > -- Parody of Mr. T from a Robert Smigel Cartoon


    There is a similar thing for Xbox. You can download Linux onto your Xbox,
    then hook up a mouse and keyboard to the memory ports on your controller. I
    can't personally attest to how well that works. Since I can't exactly recall
    where I saw it, you might try Googling "Xbox Linux".

    Lucas
    Lucas Raab, Apr 25, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. BlackHawke
    Replies:
    12
    Views:
    1,554
    Andrew Thompson
    Jan 26, 2004
  2. judith
    Replies:
    0
    Views:
    1,631
    judith
    Nov 1, 2006
  3. Max Kubierschky
    Replies:
    10
    Views:
    1,832
    pabloreda
    Mar 31, 2007
  4. Advertiser for `2D Games Development Central`

    {Game Development} 2D Game Development Central

    Advertiser for `2D Games Development Central`, May 7, 2008, in forum: Java
    Replies:
    2
    Views:
    404
    RedGrittyBrick
    May 8, 2008
  5. Advertiser for `2D Games Development Central`

    {Game Development} 2D Game Development Central

    Advertiser for `2D Games Development Central`, May 7, 2008, in forum: C++
    Replies:
    0
    Views:
    382
    Advertiser for `2D Games Development Central`
    May 7, 2008
Loading...

Share This Page