#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Location
    Bay area
    Posts
    9
    Rep Power
    0

    python robocode?


    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.

    Next I thought of managing it more strictly: It would all be done through a web interface. I would write a fancy javascript code-editing textarea, and sort of guide them through the process... That may only make it slightly easier... I'm not sure it's worth the effort.

    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.
  2. #2
  3. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    155
    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.
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Posts
    174
    Rep Power
    11
    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.

    cheers
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    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.

    http://forums.devshed.com/member.php?find=lastposter&t=220454

    Hope this helps,

    Mark.
    Last edited by netytan; January 19th, 2005 at 06:36 PM. Reason: Contact details link.
    programming language development: www.netytan.com Hula

  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Location
    Bay area
    Posts
    9
    Rep Power
    0
    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.
  10. #6
  11. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    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,

    Mark.
    programming language development: www.netytan.com Hula


IMN logo majestic logo threadwatch logo seochat tools logo