January 18th, 2005, 02:55 PM
I'm interested in creating a programming game in python. I'm looking for any thoughts you might have on the structure of such a thing... (are there any precedents for this?)
At first I was thinking of simply providing the base classes, and the 'environment' class for download. Participants would then develop their own bots, test them out, then upload them. I would have to write a system for managing uploaded classes. This might be messy and error-prone. I want it to be as user-friendly as possible.
Security is obviously a big concern, I'm not sure how to handle that. I could make sure they're not importing os, or using eval(), etc. etc. Would that basically be it? A laundry list of dangerous things I would have to search for in each submitted script?
I'm just trying to mentally outline this thing, so any thoughts or suggestions would be appreciated.
January 19th, 2005, 03:56 PM
That project is going to be a LOT of work. Unless you know exactly what to do, it isn't going to be easy. I'm guessing that this game is going to have some kind of GUI or graphics to it? If so, you could also learn wxPython, I think their main site is http://www.wxpython.org. wxPython is said to be the best utility for creating GUI/Graphics for your Python programs. As for your program being online I think you mentioned something like that, you would most likely need your own server.
January 19th, 2005, 06:07 PM
take a look at pygame as it may already have stuff you will need, as well as a user base that might be interested in your projects.
January 19th, 2005, 06:30 PM
Giving access to Python to strangers is a massive concern:
firstl: you could create your own framework and strip away all the Python modules you don't need – Zope seems to do something similar – and only allow your functions/classes to be used, this would give you some control over what the user can do however it might be too limiting.
A second approach would be to create a sequence of instances containing only those objects you wish to be available and use a special function/object to access these instances. Maybe a New() function? This way you simply check if the instance passed to the function is in the sequence, if it is then continue. Else raise a great big error .
I did read about a sandbox module a while back but I can't find it anymore. Unfortunately there's no built-in permissions in the Python shell; any user can do anything . In a sense what would be ideal would be a Unix-Python-Shell hybrid .
An interesting Idea in any case: please keep me informed! You can get my contact details from the link below or PM me.
Hope this helps,
Last edited by netytan; January 19th, 2005 at 06:36 PM.
Reason: Contact details link.
January 20th, 2005, 06:30 PM
Thanks for the replies! It's very helpful.
As far as visualization, I don't plan on worrying about that, at least not for the first stage. I just want to get the data for how each game plays out. I'll try to make it viewable as a log. If that works out, then I'll think about visualization.
I'll be sure to keep the board update.
January 20th, 2005, 06:53 PM
Very welcome. Anyway, another approach to the security issue would be to use a SOAP/web-service to communicate between the computers, the two plays and your server in the middle acting as a referee of sorts; capturing/directing output. This would also make it pretty easy to allow access to only certain objects and would leave the gate open for more than two players .
Worth looking into,