Distribute games as executable (well, sort of)


(saluk) #1

Hahaha, the power of the command-line interface. I have developed a way to make your games run, in full screen, using a batch file in windows. You could come up with a similar distribution method from linux, but I’m not familiar with blender under linux.

All you have to do, is distribute your .blend, along with the blender exe and the python dll. Use word or some such to write a batch file to put in the same directory with the other files. In the batch file, just write

blender -W -F [filename]

where you replace [filename] with your .blend’s name. Make sure to include the .blend part. Now, save that in the directory with the other files in ascii mode (.txt format) and rename the .txt extension to a .bat extension. Now, you can distribute these four files in a zip and inform the user to run the .bat file to run your game.

Oh yeah, make sure your game is set to autostart, and that you clear away all the blender menus and things out of the picture.

It works like a charm, no plugin or programming required. It’s not quite as good as publisher, in that your actual blend file isnt protected, and your distributing the tool the user could use to hack your game with, but for distribution on the internet to normal people, it should be fine.

You can even cheat and change the blender icon and filename, and mess with the paths placing all the files except the batch into seperate directories etc.


(S_W) #2

When I try to run Blender, I get the following error:

      ![http://www.geocities.com/sanderwozniak/ScreenShot.jpg](http://www.geocities.com/sanderwozniak/ScreenShot.jpg)
      (Sorry, but I don't get english error messages  ;)  )

I’m not sure whether this is a problem with my graphics driver (I have a ATI Rage 128 Pro)

I don’t get it running. :frowning:
Could anybody help me, please?


(gargola) #3

yeah,mine comes with an error too(bad command line or file name).


(Pooba) #4

Are you sure you typed the -w -f part right? When i run the batch file that I made It opens blender and shows the animation screen (the one that pops up when you click the “anim” button). i think one of those extensions is wrong.


(saluk) #5

I’m not sure, but you might have to use blender.exe instead of just blender. Also, make sure you type in your filename just right.

Heres an example of a batch file I used for my test:

“zelda.bat”

blender.exe -W -F zelda.blend

Oh, make sure that the “W” and the “F” are capital, they are case-sensetive I believe. If you still have problems, could you post EXACTLY what you wrote?


(Pooba) #6

Ahh! that’s the problem, this is what i did:

monster.bat

blender -w -f [monstersmall.blend]

i thought you needed the []. I’ll try it now…

Pooba


(Pooba) #7

It works it works! :smiley: :smiley: :smiley: .
for those people that don’t know how to create a batch file, here you go:

go into the ms-dos promt, there should be a shortcut in start–programs but there might not be, in which case just go to start–run and type in “command” (without quotes).

next, go to the directory where you put your blender.exe and the blend file and all that stuff.
Now type in the following (after each line hit enter, including the last one):

copy con game.bat
blender -W -F yourblendfilehere.blend

now after that hit ctrl-z which should bring up a little tidle and a Z on the screen one line after the blender -w -f… and then hit enter, TADA! now when you type in game then it should load up your game, full screen.
if you can’t figure that out, you’re really stupid and don’t deserve to work on computers :stuck_out_tongue: .
Just kidding,

Pooba


(gargola) #8

now i’m more confused…i give up!

ps: saluk,are you sure that’s the right way to creat the batch file,by only typing:blender.exe -W -F zelda.blend on a word pad program?


(S_W) #9

It doesn’t still work :frowning:

Well, I created a file named “test.bat” in the Blender directory and copied a blend file named “test.blend” there as well.
Then I typed the following command line:

blender.exe -W -F test.blend

The problem with the error doesn’t appear when I leave the -W argument out. But that is probably for using the whole screen.


(Pooba) #10

ok, i made this example file for you all. I didn’t include the blender.exe and python.dll, so you’ll have to extract the zip file into your blender directory. When you run “example.bat” it will, i repeat will, work. If it doesn’t your computer is funky, cause it worked on mine!

Gargola, putting the command in a wordpad file will NOT work as creating a batch file. If Saluk said that to you he’s crazy. Follow my instructions, they’re pretty easy. I could understand how to do it when I was 6.

Pooba


(Pooba) #11

ok, i made this example file for you all. I didn’t include the blender.exe and python.dll, so you’ll have to extract the zip file into your blender directory. When you run “example.bat” it will, i repeat will, work. If it doesn’t your computer is funky, cause it worked on mine!

Gargola, putting the command in a wordpad file will NOT work as creating a batch file. If Saluk said that to you he’s crazy. Follow my instructions, they’re pretty easy. I could understand how to do it when I was 6.

Pooba

oops, almost forgot teh link!
blenderarchives.0catch.com/example.zip

:stuck_out_tongue:


(Pooba) #12

Oops, here is a link (i forgot to close the tag)

blenderarchives.0catch.com/example.zip


(S_W) #13

Well your example was exactly what I did.
I doesn’t still work.
Damn, I have a funky computer (or graphics card, driver and Idontknowwhat…) :wink: !!!


(Pooba) #14

Does mine work, and yours not work?


(S_W) #15

both don’t work


(gargola) #16

S_W: our computers are funky!!! :-?


(saluk) #17

Um, pooba, wordpad WILL work to make a batch file. All you have to do is make sure to save it in .txt format and that the extension is .bat instead of .txt. For instance, if you save it “Mygame.txt” all you have to do is rename it “Mygame.bat” and there you go: you have a batch file.

Also, I found out that you don’t actually need the “-F” part of it. It can just be “blender.exe -W myfile.blend”. FOr me it still worked with the -F, but on other computers, that might confuse it.

Also, I’m not sure, but in the batch file you may have to make it blender.exe, not just blender.

If you still can’t get it to work, then I dont know what to tell you, here is my example file.

(Just extract it to a new directory, and run the bat file)
http://www.angelfire.com/ego/spinhead/dragothic.zip


(gargola) #18

ok! i got it to work with Saluk’s Worpad batch…i removed the -F from the code,added a copy of the original blender exe(not a copy of a shortcut to blender)it requires python20.dll on the folder of the game and last,if you got a game(like mine)named something like Flash Ninja,you got to remove the space(FlashNinja).that’s all.hope this helps you S_W. :slight_smile:

ps:make sure to use Blender.exe on the code (blender.exe -W yourgame.blend)


(S_W) #19

Well, perhaps the problems is my graphics card or driver.
It doesn’t work in fullscreen. :frowning:
If I leave the -W out it is the same as when I doubleclick an autostart blend file. But for giving it to friends, you don’t have to install blender on the system. Thank you all anyway! :slight_smile:


(Pooba) #20

Well, that was your problem, of course the shortcut wouldn’t work! You need the acual execuatble! And he said that you needed python20.dll there too. Follow instructions people! Also, DOS doesn’t do to well with directories or files with spaces in them, it tends to make it so that you have to type in a ~ sign sometimes.

Pooba