Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Say I have a game which has lots objects (NPCs, monsters, etc.), I want a console so I can change the variables of the objects (like changing HP for example), how could I embed python into my program, so that I can change these variables and classes with a few keystrokes in the console? An example of a command would be: /monster 1 1 HP 100 (monster is the object name, 1 1 is the coordinates, and HP 100 is the variable to change, and to what amount)

share|improve this question
2  
Does this link answer your question? wiki.python.org/moin/… –  Philipp Mar 12 at 8:14
    
@Philipp It's helpful, but doesn't tell me how to access classes using Python, it just says how I could embed python (which I have already done, using #include <Python.h> with python in the project directory –  bboy3577 Mar 12 at 10:05
    
@bboy3577 it isn't very easy, but that link does show you quite a few ways of doing it. If you're using C/C++ boost python is probably the easiest way of doing this. –  mklingen Mar 13 at 0:40
    
@bboy3577 in particular, this chapter shows how to do it. –  mklingen Mar 13 at 0:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.