In-game display options for user specified resolution, etc. (UPDATE: version 2 soon)

UPDATE 6-24-07:
I’ve discovered a new method that works the same on Linux and Windows (not sure about Mac) using the os.system() function. Hopefully I’ll post v2 sometime soon, but basically, you just need to make the command and options into one string, and run it like this:

import os

os.system("blenderplayer -f 800 600 60 32 -g show_framerate myGame.blend")

Leave off the “.exe” on blenderplayer and it will work on both Windows and Linux (and probably Mac, too… I’ll test next week).

If you want to run a compiled runtime, you should put the name of a non-existent .blend file name at the end.

import os

os.system("myGame -p 10 10 640 480 no.blend")
IMPORTANT NOTE: There was an error with the original release that caused it not to run properly on computers without a full Python 2.4 install. If you downloaded the original, you need to copy the files "" and "zlib.dll" from your Blender directory to the Custom Display directory for it to work on all machines. The links below have been updated with the new files.

Be amazed. You have no other option.

Currently only Windows is supported. I know how to code multiplatform support, so I can make a “big three” version, but I don’t know how the command lines should be set up for each OS (that is, how to set up whatever replaces a .bat file on other systems). If anyone can offer information it would be greatly appreciated and I would promptly make available a multiplatform solution. I need to know exactly what you would type in to run the blenderplayer on a blend as well as what the flags are and how to properly apply them.

A zip file (3.0MB)
A rar file (2.4MB)

“OpenGL” is the same as “Use Blender Materials”. While I know that it outputs the right commands, I wasn’t able to test the OpenGL option, since my card doesn’t support it. Also, I don’t have any quad-buffered shutter glasses lying around to check the Hardware PageFlipping stereo mode.

The in-code documentation is sparse and incomplete. Sorry. To run it on your own blends, alter line 14 and 19 in “SaveToBat” as well as line 8 in “RunGame”. Hope you find this interesting. I know I do.

Edit: I forgot to tell you all how to run it outside of Blender. Double click “CustomDisplay.bat” to launch the menu.

you’ve done it again, awesome

Great thing although I wonder how proffessional it is to use a bat file to start your game. I thought about some kind of INI file perhaps that is loaded by the game and started appropriate. (This way you don’t really need a different version for each OS outthere.)

And if the user changes settings the ini (or similar) is written and then the game is restarted to effect changes.

Hmm or maybe even a BAT like file but then it should be called from an exe. (Hmm.)

Keep it up!

Nice Blendenzo. I’ll take a look later and see if I can get you the shell script commands for Linux. Problem I have, though, is that I can’t get a full screen from the BlenderPlayer for some reason. It works for a window, but not full screen. Anyway, it just gets ignored so it still should work and it would be fun to play around with.
I think the opengl is a little confusing though, isn’t it? Maybe opengl extensions or something, but I don’t have them and I still use blender materials.

Logan: I haven’t used windows in ages but you should be able to rename the bat file to anything you want and make it look like an execute, more or less, although the bat has to be there, but everyone double clicks now days anyway so give it a nice picture.

Really nice work and cool GUI. :DHeh, you might be interested in this too. Someone in the past also did sorta the same thing, but I think it was just restricted to changing the resolution.

Jason Lin

A great resource for the BGE community blendenzo, thanks.

Well, if you wanted to be really professional, there are several “bat to exe” programs available for something like $29.95(USD). I thought I had heard about a free one sometime back (thought it came up on your BlenderStarter thread) but when I went looking, I couldn’t find it. All of them are free to try, but money to buy. If anyone knows of a free bat2exe program, please let me know. Also, for professionalism, I would certainly replace the icon with ResourceHacker.

I don’t think there’s a way to avoid using a separate distribution for each OS, since they all take a separate blenderPlayer to run. It’s not so much to do to replace the initial .bat in each distibution with an operating system specific file. However, I do want the .blend itself to be truly multiplatform so that others can integrate it as they see fit without having to worry about that, so I’ll test the system with the OS module and give different instructions to the program for each.

Hmm… It was my understanding that “Use Blender Materials” required OpenGL, and I have heard others say in the past that the two are the same (which does not guarantee that it is the case). I went with “OpenGL” instead of “Use Blender Materials” for two reasons, though. Both are because I’m thinking of people using this in their published games, so “OpenGL” is the more user understood term for non-blenderheads. Also, “Use Blender Materials” would betray the fact that the game was created with Blender if someone was trying to hide that for commercial purposes. (Yeah, I know you don’t like that idea…)

Urgh! Milikiller is always doing the same things I do! I release an analog joystick script and two weeks later he releases an interface for the windows joystick api. I make a custom display menu, only to find that he’s already done that. And if he looks like his avatar, he stole my facial hair, too!

Thanks for the compliments on the GUI, though. All that work in the GIMP was the most time consuming part of the project. It’ll look nice in my portfolio, though…

Thanks! I hope you find it useful.

To All: I forgot to mention, don’t change the .bat for the menu to make it display in fullscreen mode. When you run the game and then close it, the resolution sticks.

Hmm… It was my understanding that “Use Blender Materials” required OpenGL, and I have heard others say in the past that the two are the same (which does not guarantee that it is the case).
I don’t understand that. The engine won’t run without OpenGl, that’s what it’s basically written in. That’s why I think that’s a little confusing. I mean, yeah, Use Blender Materials uses OpenGL because everything in the engine uses OpenGl.
I don’t have anything against selling a game. I just think it’s a little tough given the number of games around.

you make me want to dive into blender GE again, but no time :frowning:

fireside: I see. Maybe I’m confusing OpenGL and GLSL support. Is GLSL support required for “Use Blender Materials”? BTW, I was just teasing about the selling games thing.

Felix Kütt: Oh, I’m sure you could find a little time here and there… :wink:

I see. Maybe I’m confusing OpenGL and GLSL support. Is GLSL support required for “Use Blender Materials”? BTW, I was just teasing about the selling games thing.

Well, that’s the problem. It’s more or less right. Except you can use Blender materials and not have shader support on your card. Also, I’m not sure what would happen if the game was written for Blender Materials and then not allowed. It changes a lot of things. I think it would be better to just leave that option up to the author. If it was written for shaders, it’s going to look like crap on a card that doesn’t have it.

Very nice work blendenzo,

I booted windows (after something like a month) just to test it out. Very usefull stuff indeed.

As HatchFactory already said “You’ve done it again.”

PS: I hate microsoft with a passion. Just had to say it.

Well, I’m not sure what the real issue is, but my card doesn’t support “Use Blender Materials” at all. I think Blender Materials is really cool, especially multi-texturing, bump-mapping, and all of that. But you can make a game that does both “Blender Materials” and “No Blender Materials” if you UV map your main texture onto the character using the UV Editor, then add reflection maps and bumpmapping on top of that through the materials buttons. Having the option to turn Blender Materials on and off would allow developers to support a broader spectrum of gamers while still taking full advantage of next gen features where available. Regardless of all of that, I’ll look into a better name for the option and change it.


Wow, I got you to boot up Windows just to try out my Custom Loader? Amazing…

BTW, I hate Microsoft, too. I wouldn’t use their software if I didn’t get it for free. I’ve said it before, I meant it, and I still do.

Another edit: Blender Materials is turned off by default on the 2.42a blenderPlayer, so having that check box there is useful.

PS: I hate microsoft with a passion. Just had to say it.

I’m with you 100% on that one. They’ll do anything and everything to maintain their monopoly and extend it. We can choose freedom of information, or we can choose to pay a Microsoft toll for the rest of history.

thanks blendenzo

Well (many) thanks to this .blend (and you blendenzo) I discovered (after using the GE for an embarrassingly long time) that you can LINK THE SENSORS OF ONE OBJECT TO THE CONTROLLERS AND ACTUATORS OF ANOTHER!!! You can imagine my joy at discovering this very basic function! and my past frustrations (setting up convoluted Message chains between objects and any other work around I could think of).
It so helpful to look at other’s people’s blends.
thanks again,

Excellent !!
Thank you very much Blendenzo :slight_smile:
Your file is very insteresting and will help to create game. Your work is so great!

Do you know a “method” or a tutorial to change the keyboard keys (forward, left, jump, …) to use with your amazing file ?

I’m looking for a bat2exe (free), but I don’t have find it yet. If i find it, I would post a link in this thread :D.

Thank you again, Blendenzo.

I have not found any free bat2exe files, however, there is a free bat2com program (it is called “bat2exec”, but it outputs .com files). To use it, make sure the and bat2exec.asm files are in the same directory, then use the dos command:

BAT2EXEC filename.ext

It’s old, so it only supports 8.3 filenames (eight letters before the “.”, three after).

Funny, on Linux shell scripting is considered as high art of system administration, while on Windows a batch file is “unprofessional”. Weird world, this.

I’d prefer a human readable bat/sh/py/pl file over the same hidden in an exe any day.

Yea, but to be completely honest, the Windows cmd and the .bat programming syntax has nothing close to what the Linux BASH provides.

Anyone who started with batch scripting on windows and then crossed to the linux BASH and .ksh syntax will tell you the same thing.