473,378 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

python for console game development, memory tracking

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
Jul 18 '05 #1
4 2689
"Moosebumps" <mo********@moosebumps.com> 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...boxPython.html
Jul 18 '05 #2
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
Jul 18 '05 #3
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.

Jul 18 '05 #4

"Carl Banks" <im*****@aerojockey.invalid> wrote in message
news:Ih****************@fe1.columbus.rr.com...
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
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Aubrey Hutchison | last post by:
Using Python 2,3,2 with idle for developing programs about 200 lines long. - Problem is not common to any specific program. Program are rather simple with no trick programming. Usually no classes...
0
by: Emile van Sebille | last post by:
QOTW (advanced interfaces track): "I'm firmly in favour of any language that can DWIMNWIS." -- Tim Delaney QOTW (MS roadkill track): "Underestimate MS at your own risk. It is one thing to not...
0
by: Fuzzyman | last post by:
It's finally happened, `Movable Python <http://www.voidspace.org.uk/python/movpy/>`_ is finally released. Versions for Python 2.3 & 2.4 are available from `The Movable Python Shop...
29
by: 63q2o4i02 | last post by:
Hi, I'm interested in using python to start writing a CAD program for electrical design. I just got done reading Steven Rubin's book, I've used "real" EDA tools, and I have an MSEE, so I know what...
3
by: morris.slutsky | last post by:
So every now and then I like to mess around with hobby projects - I often end up trying to write an OpenGL video game. My last attempt aborted due to the difficulty of automating game elements and...
1
by: Neil Toronto | last post by:
So I've recently had a stroke of insanity, deciding that what the open-source Quake III engine *really* needs is a good, healthy dose of Python. Here's the quick version: The Q3 engine is split...
32
by: siggi | last post by:
@Ben Sizer Hi Ben, in January I received your message re Pygame and Python 2.5: As a Python (and programming ) newbie allow me a - certainly naive - question:
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.