In-game graphics settings alteration/save changes?

Hello, I am making a puzzle game in Blender which has a story mode with cutscenes. I plan to actually sell the game once it is complete, so I need to make it as much like other games as possible. One thing I need to know is, how can I change the graphics settings (anti-aliasing, resolution, etc.) in-game? Is this even possible within Blender’s game engine? I assume it is using Python scripting, but as I am new to scripting in the game engine, and only have experience programming with logic bricks, if anyone has a way to do this could they please post the script in this thread? I will be sure to credit whoever wrote it in the game’s credits. On a related note, I would like the game to be able to load the graphics configuration on startup. If anyone can help me get this feature working, I would be very grateful.

P.S. I am using Blender 2.72.

If you’re planning to make a game ‘like other games’ you may want to learn at least some form of coding.

Yes, it’s possible, it’s not easy though.

Lets talk about … lights. How many lights are there in a game? Tens" Hundreds? Can your computer handle that many? Nope. Modern game engines automatically display only the close ones, using trickery on the far ones. In BGE you have to do it yourself. (Which is a good think in my opinion). Writing a script to do this took me over a month. Integrating into a game is complex.
Now do the same for animations, sounds etc. Now make a menu that can present these to the user.
I guess it’ll take only, say, a year or so.

Making a ‘game like other games’ is not a good starting point. Possible, but i’d suggest something a little less ambitious.

Let me rephrase: By saying “like other games” I meant having the ability to change graphics settings, like other games do.

The gameplay is actually super simple. Here is the layout of one of the levels:


You can change Anti-Aliasing with python, but I don’t know the script. You can change camera clipping settings with animations and properties etc. You can also make a light setup by using emptys and adding only requiered lights or animating their energy. To save and load them, use this script, but edit it for your properties. To implent it use empties to save and load settings and copy properties from them(you should load only once and in settings save only when xiting the settings scene).
Code:


import os
from bge import logic


os.makedirs("Data/Settings", exist_ok = True)


path = "Data/Settings/" #Set this to your own. It will be set globally in .blend, but locally(//) in standalone.


def save():
    cont = logic.getCurrentController()
    own = cont.owner    
    prop1 = str(own['prop1']) # Set the own['prop1'] to own['prp_name']
    prop2 = str(own['prop2']) # Here too...
    info = prop1 + ',' + prop2
    try:    
        with open(path+"settings.txt", 'w') as saveFile:   
            saveFile.write(info)
    except IOError:
        print("Unable to save game data")
    
    
def load():
    cont = logic.getCurrentController()
    own = cont.owner    
    try:
        with open(path+"settings.txt", 'r') as saveFile: 
           line = saveFile.readline().replace('
','').split(',')
    except FileNotFoundError:
        print("unable to find saved settings, defaults will be used.")
        own['prop1'] = 5
        own['prop2'] = 0.5 
    else:
        own['prop1'] = int(line[0]) # This property is integer, but you can set it as you like.
        own['prop2'] = float(line[1]) # But this property is floater

Hmm… Ok, but not quite what I was asking… I’m having no issues with the game’s lighting. What I want is for the player to be able to enter the pause menu and change settings such as AA, resolution, and whether the game runs in fullscreen or windowed mode. Then, they save their settings, and the next time the game is launched, it loads the settings the user saved.

Or, if this can’t be done, I guess I could just have a single graphics configuration…

You could make different external .blend files (or scenes). One that is high-res, and one that is low res. Then from the menu let the player decide which file to open.

How can this be done? I know there’s a setting in the “game” actuator that is “Start Game From File” but I’ve never been able to figure out how it works…

its pretty straight forward. You save the game file separately (make sure the settings + framerate are the same). and then open it using the menu or initialize .blend. The start game from file, just opens the .blend.

If you want to use scenes instead you can just use a set scene actuator (and remove the un-needed scenes).

I’ve got a question- do this code(made by battery, maybe should be placed on top in #s) help you?