touilleMan / godot-python

Python support for Godot 🐍🐍🐍
Other
1.9k stars 142 forks source link

Windows godot-python #62

Closed ILope92 closed 6 years ago

ILope92 commented 6 years ago

Make an instruction for Windows users! I did not understand what to do! How to make this add-on for Godot ???

Nophlock commented 6 years ago

Hello,

I actually had the same struggles you had just yesterday and after reading through the other issues and a lot of try and error, I've managed to run Godot with python. Here are the steps you need to do:

  1. Download the pong game from the example folder of this project and place it somewhere, where Godot can open it.
  2. Inside the folder you can see the file "pythonscript.gdnlib". If you open it with an texteditor, you can see that they trying to link to .dlls in a folder that currently doesn't exists.
  3. Go to the release tab here on Github and download the corresponding zip file for your OS, for example "godot-python-v0.10.0-rc2-windows-64-cpython.zip".
  4. After the download is finished, extract the .zip and place it in the pong folder, so that the "res://"-paths from the "pythonscript.gdnlib" are linking to the corresponding files within the project (only the windows path needs to exist).
  5. Open Godot and import the pong-project. If it will start the editor, you are basicly good to go and play around with it. However if not(which was mine case too ...) you need a newer version of all the dlls etc. from the pythonscript folder (or try an older Godot version maybe?) and the only way to get these is to compile the newest source code. After you've managed to compile them on your machine, it will automaticly create a "pythonscript" folder and a "pythonscript.gdnlib" file under "build". Just copy them over to the pong project and try to reopen it in Godot.

Hope this helps a bit.

ILope92 commented 6 years ago

and the only way to get these is to compile the newest source code.

How to get these dlls? They are not in the releases. It's just the first time I run into a compilation.

Nophlock commented 6 years ago

@ILope92 Those dlls are in the zip files that are provided under the release section. If you download and unzip one of windows-zips, you can see that they are lying in the extracted folder "pythonscript". So you actually need copy the extracted folder to the pong example, cause the "pythonscript.gdnlib" are referencing to this path. If Godot won't start with these, you need to compile the newest sources which, will also create a "pythonscript" folder that you can use instead(With all the newest dlls included). The reason that Godot might not working with the provided zips under the release section is, that they are a bit dated (9. Januar) and Godot probably changed there Gdnative-Api since then.

ILope92 commented 6 years ago

Did I do it right? image

Nophlock commented 6 years ago

@ILope92 Your Pong example folder needs to look like this (Ignore Global.py, this was just a test of mine): grafik

I mean, if you are editing the ".gdnlib" you can see, that they are linking to "res://pythonscript/pythonscript.dll" and this doesn't currently exist in your screenshot(res:// basicly means the root folder of the pong project). You can ofcourse edit the path, but for future builds it's probably easier to setup the "normal" folder hierachy. The pythonscript folder itself is provided under the release section or by compiling the master branch.

garyo commented 6 years ago

The SCons build of godot-python can't create the symlinks into examples/pythonscript and tests/pythonscript that it does on other platforms (or maybe they're supposed to be created by git, either way they don't work out of the box), because Windows requires admin privs to create symlinks. So you can copy pythonscript and pythonscript.gdnlib out of build/windows-64-cpython instead, or create the symlinks in an Admin cmd.exe window (using mklink /D or mklink /J, either should work).

ILope92 commented 6 years ago

ModuleNotFoundError: No module named 'pythonscriptcffi'... And Error: Could not load the scene because of the lack of dependencies. image

image

Here are the folders: image

ILope92 commented 6 years ago

You can show how the development in Python looks in Godot???)

Nophlock commented 6 years ago

@ILope92 actually if everything works as epected, nothing much will change in Godot. The only thing that is different, is the script dialog because you can then add Python as the desired scripting-language for that specific node: grafik

Since the Python plugin still not work on your machine I suppose? I suggest you to just wait until @touilleMan added the Python plugin to the AssetLib(link).

touilleMan commented 6 years ago

Godot Python has landed on Godot asset store (see https://godotengine.org/asset-library/asset/179). It should be a 1-click deal to install and play with it now ;-)