News:

Rings of Reznor!

Main Menu

Looking for a good Python Editor?

Started by Outcast, February 27, 2016, 02:49:55 AM

Previous topic - Next topic

Outcast

Trying to look for a good Python Editor. Any suggestions? I want to try it out to see if there's any difference as compared to just using a regular notepad?

spydermann93


Epimethee

#2
Using a dedicated Python editor was day and night for me. You'll really, really waste a lot less time with auto-completion, syntax validation and an integrated Python interpreter, among others.

I did most of my FF code in PythonWin, which came with ActiveState's Python distribution (the Python interpreter isn't installed by default on Windows, contrarily to the situation on OS X and Linux). It was perfect for a complete beginner like me... one-click syntax checker FTW. ;) However, I doubt it has evolved much if at all in 15 years...

Nowaday, PyCharmCE + the official Python.org distribution of the language is probably the best bet. PyCharm is much more powerful than PythonWin – as the free community edition of a pro tool, it's alas more complicated to set up, but nothing too bad.

Note that if you're coding for FF/FFvsTTR, the game engine embeds the ancient Python 1.5. The basic syntax is still very similar to Python 2.7 (the current version of the 2.x branch), but you should avoid the newer Python 3.

https://www.python.org/ (https://www.python.org/downloads/windows/ ; reference for old v.1.5: https://docs.python.org/release/1.5.2p2/)
https://www.jetbrains.com/pycharm/
http://www.activestate.com/activepython
FFX add-on for FFvsTTR at ffx.freedomforceforever.com

Outcast

Thanks for the suggestions both of you.

Quote from: spydermann93 on February 27, 2016, 04:40:47 AM
I just use Notepad++ :P
I first thought you were just kidding with the smiley and all. But i eventually looked it up and downloaded it. It looks like a really neat tool with lots of useful features. Not sure if i can easily learn them.

Quote from: Epimethee on March 03, 2016, 05:48:10 AM
Using a dedicated Python editor was day and night for me. You'll really, really waste a lot less time with auto-completion, syntax validation and an integrated Python interpreter, among others.

I did most of my FF code in PythonWin, which came with ActiveState's Python distribution (the Python interpreter isn't installed by default on Windows, contrarily to the situation on OS X and Linux). It was perfect for a complete beginner like me... one-click syntax checker FTW. ;) However, I doubt it has evolved much if at all in 15 years...

Nowaday, PyCharmCE + the official Python.org distribution of the language is probably the best bet. PyCharm is much more powerful than PythonWin – as the free community edition of a pro tool, it's alas more complicated to set up, but nothing too bad.

Note that if you're coding for FF/FFvsTTR, the game engine embeds the ancient Python 1.5. The basic syntax is still very similar to Python 2.7 (the current version of the 2.x branch), but you should avoid the newer Python 3.

https://www.python.org/ (https://www.python.org/downloads/windows/ ; reference for old v.1.5: https://docs.python.org/release/1.5.2p2/)
https://www.jetbrains.com/pycharm/
http://www.activestate.com/activepython

Thanks. An interpreter for Python? How does that work? Could it possibly convert/read the .py/.pyc files in Freedom Force? So i can see/understand how they coded it? I think i've come across a few files that contained symbols and characters that were unreadable. If only it was as easy as to learn as they (Irrational Games) said it was. :P

I think the scripting tutorials/documentations they provided in Freedomfans.com didn't really give that much detailed explanation/examples on how to use/apply it to the game. They gave explanations of different kinds of commands but did not give any example as to how to set these codes up. Not sure, i just skimmed through most of the pages.

Ez Script tutorials provided a much better explanation by providing examples.


spydermann93

Quote from: Outcast on March 03, 2016, 02:58:30 PMI first thought you were just kidding with the smiley and all. But i eventually looked it up and downloaded it. It looks like a really neat tool with lots of useful features. Not sure if i can easily learn them.

Haha, no, I was actually being serious about using Notepad++. I love it!

I use PythonWin to run a few scripts here and there (the Ghosting Fix and the Active Defense Duration Change scripts), but mostly, I use Notepad++

Epimethee

Quote from: Outcast on March 03, 2016, 02:58:30 PM
An interpreter for Python? How does that work?

Basically, there are two sorts of programming languages: compiled languages and interpreted languages.

In a compiled language, like C++ (which was used to code the core of FF/FFvsTTR), once the programmer has written her code, she needs to process it with a special app, the compiler, which will convert it to machine-readable code and create an executable program (compiling can take a long time as the compiler tries to maximize performance – consequently, coding with a compiled language involves waiting a lot, AFAIK).

On the other hand, interpreted languages (or scripting languages) such as Python or your browser's JavaScript don't need to be compiled. Instead of a compiler on the programmer's computer, it depends on a different program, the interpreter, on the user's machine. Every time the user executes the script, the interpreter converts it on the fly into instructions the computer can understand. (Since the interpreted program doesn't have nearly as much time to optimize the code, it's usually slower than compiled code. It is, however, much faster to code in it, as you can write something and run it immediately. This makes learning as you go MUCH easier.)

Actually, to save a bit of time on subsequent runs of a program, many interpreters don't discard the converted-on-the-fly code. For example, Python saves the converted .py files as .pyc files. If you delete the .pyc file, it'll just get regenerated next time you run it.


Quote from: Outcast on March 03, 2016, 02:58:30 PM
Could it possibly convert/read the .py/.pyc files in Freedom Force? So i can see/understand how they coded it? I think i've come across a few files that contained symbols and characters that were unreadable.
The unreadable files were the .pyc files. The .py files are the human-readable ones. No need of the interpreter for this, as it "just" runs the program. Any plain text editor/IDE will do. You definitively want to check Irrational's mission script .py files and their documentation, especially the sample mission tutorial.

Note that a standard standalone Python interpreter can't do all that much for FF's Python, as the game's embedded Python interpreter relies on functionalities available only inside the game engine (stuff coded in C++). Instead, a standalone Python interpreter is best used to test quickly small chunks of code, which is still quite useful. You can of course complement it with the in-game console, which uses the in-game Python interpreter.


Quote from: Outcast on March 03, 2016, 02:58:30 PM
If only it was as easy as to learn as they (Irrational Games) said it was. :P

Well, compared to C++, and whatever else was available at the time, the folks at Irrational certainly would good reason to think it much easier! Even today, Python might still be the language with the best ease of learning/capabilities ratio. Many schools use it to teach programming, and many organizations, such as Netflix, Google and the NASA, use it professionally.

But, of course, learning both the language and how to use it inside the game can be overwhelming no doubt. The best way to start is to take minuscule steps at first. Good luck and have fun!
FFX add-on for FFvsTTR at ffx.freedomforceforever.com