Why mod in Python?

I will appologize in advance if this is in the wrong location, but since it is directly involved with Elemental modding I figured it wouldn't hurt. :grin:

 

I credit EWOM with exciting me about modding and therefore wanting to learn to program. I dabbled in Basic some 25 years ago for school, but it wasn't anything serious or that I even remember. I attempted to learn C++ out of a book, but it never caught on with me. I would like to develope scripts for EWOM, web apps (DJango/Rails?) and whatever else that might excite me as I learn.

I've heard great things about a few newer languages, namely Python and Ruby. They seem like they would be great starting points for someone that needs to learn programming theories from the beginning. In addition, the code and syntax seem to be cleaner and easier to read. I understand they are very similar in many ways and it almost seems to come down to preference (or which you learn first). At least that is the vibe I get from reading the many forum debates, some friendly some not, on which is better. Not trying to start anything here, but I was hoping the developers (and anyone else) would share their opinion on the subject. Why Python?

Please educate me oh wise ones!

9,659 views 9 replies
Reply #1 Top

I've used Python. It's incredibly easy, open source, and you can use it for commercial programs. I'd suggest you try it :)

Reply #2 Top

A lot of nonprogrammers use Python and get done what they need to get done. Ruby is a new language and reall doesn't have the community that Python does.

Reply #3 Top

Also, I don't know of any games that use ruby, not big titles with large modder communities, which just underscores the "python has a bigger community" in relation to what groups of modders with what games are familiar with what. A lot of Civilization modders with experience in scripting Python can come right over to Elemental when it ships and start playing with that. (And a lot of them will, since Civ V is ditching Python for Lua)

Personally I'd have preferred some C-like derivative, but you can't win them all.

Reply #4 Top

I have heard of many programs that use Python (Google, Youtube, EVE Online to name some big ones), so it's certainly a plus when it comes to 'community'. Considering Ruby is similar, it's tough to predict if it could surpass Python. I have heard great things about Rails, but I'm not sure how important that is to me at this early stage.

I appreciate the input!

Reply #5 Top

Also don't forget, even though Stardock is writing a lot of the game in Python, you'll still be able to edit and Mod a LOT of it with XML. Of course there will be some things that will have to be changed in Python for a serious Mod, e.i. something like a total conversion, but for the average user who's never been a student or never tried a Mod, XML is really, really easy.

When the Modding section of the forums open I'm sure plenty of us (I know the Devs will, and I'll need to show examples when I start the DL Mod) will be posting examples of code on the forums and explaining what needs to be changed and asking questions on how to do it.

At that point all the normal, non modder people, will need is Notepad or maybe a free trial of a program like Hex Workshop and they'll be able to make their own edits to the game. Most likely you'll even find step-by-step instructions on how to do just that right here on the forums.

Reply #6 Top

python is easy unlike c++ which would be hard to learn i really think the main reason behind being able to mod in python will allow a lot more people to mod since its not hard to learn and is more mainstream / popular.

they won't be letting anyone use the modding tools till the game is basicly finished since it would be stupid to try and mod something that isn't even past the halfway mark yet, knowing stardock it will be will worth the wait no wonder frogboy wants a brake when its done wonder if anyone thats working on it won't take a brake when its done.

Reply #7 Top

It also depends on how easy it is to integrate the scripting runtime into the game, and how easy it is to secure (ie: disabling it's ability to make system calls, because you really don't want a mod able to read the entire hard drive and send the results to the FBI!).

I think LUA is actually better for this type of thing then Python is, but Python is pretty good for it too.

Reply #8 Top

It sounds like basic modding in Elemental will be very straighforward. I'm still pondering learning Python/Ruby for all of the 'other' things I could do with them. Considering they both seem much more user friendly, I think this might be the right time for me to get started.

It seems at least a few of you are familiar with Python. Does anyone have experience with Ruby?

Reply #9 Top

It's somewhat deceptive to think of Python as an "easy" language for non-programmers. Its syntax is fairly simple, and the one-way-to-do-it principle is a massive improvement over the likes of Perl and Ruby.

But it's a very powerful language; it's *the* language of choice among many professional programmers, myself included, when starting up just about any kind of project that doesn't absolutely require C/C++ (eg, kernel drivers). It's a great fit for everything from simple scripts, to custom servers (with Twisted) to GUI apps (wxPython) to 2D games (PyGame) to serious computation (NumPy and SciPy). Yes, Django is fantastic too. When you identify bottlenecks, it's quite easy to write a native module with the Python C API, or with Boost.Python in C++.

Yeah, Python's major weakness for game scripting vs. Lua is that it's *too* powerful; it's not (easily) sandboxable, so you really should trust whatever source you're installing mods from.

 

Dive Into Python was how I learned:
http://diveintopython.org/

There are other resources for total newbies with zero programming or CS experience that teach Python, but I couldn't tell you which ones are any good.