Warzone and Python

Ideas and suggestions for how to improve the Warzone 2100 base game only. Ideas for mods go in Mapping/Modding instead. Read sticky posts first!
User avatar
Andrie
Regular
Regular
Posts: 533
Joined: 20 Jun 2012, 14:11
Location: Suid Afrika

Warzone and Python

Post by Andrie »

I have a question why is Warzone not developed in Python Programming Language?
"My IRC en multiplay naam is Andrie"

Groete Andrie
Cyp
Evitcani
Evitcani
Posts: 784
Joined: 17 Jan 2010, 23:35

Re: Warzone and Python

Post by Cyp »

Because noone had time. If you have time this week, could you port it to python, please?
User avatar
Andrie
Regular
Regular
Posts: 533
Joined: 20 Jun 2012, 14:11
Location: Suid Afrika

Re: Warzone and Python

Post by Andrie »

I am still new and I am still learning Python, so sorry I cant yet!
"My IRC en multiplay naam is Andrie"

Groete Andrie
User avatar
Andrie
Regular
Regular
Posts: 533
Joined: 20 Jun 2012, 14:11
Location: Suid Afrika

Re: Warzone and Python

Post by Andrie »

Where can I get the on script?
Imean the warzone game script!
"My IRC en multiplay naam is Andrie"

Groete Andrie
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Warzone and Python

Post by Jorzi »

I actually think that warzone is older than python. Edit: apparently python is older than I thought, released in 1991
Also, python is a scripting language and not very fast at all. A language like Java/c#/go would be a better motivated alternative (although still not as motivated as sticking to c++)
Last edited by Jorzi on 02 Oct 2012, 19:46, edited 1 time in total.
ImageImage
-insert deep philosophical statement here-
User avatar
Andrie
Regular
Regular
Posts: 533
Joined: 20 Jun 2012, 14:11
Location: Suid Afrika

Re: Warzone and Python

Post by Andrie »

But Python has many advantages and besides that it doesn't need mac builds/linux builds/windows builds because then it's python build, and then there would be more focus on warzone and the website!
"My IRC en multiplay naam is Andrie"

Groete Andrie
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Warzone and Python

Post by Jorzi »

Don't take me wrong: python really is a nice laguage to write and I've written some python apps, but it's not a language you would write a game engine in. You are right about the importance of fast development , but I wouldn't say python is that much faster to write than, for example, java.
ImageImage
-insert deep philosophical statement here-
cybersphinx
Inactive
Inactive
Posts: 1695
Joined: 01 Sep 2006, 19:17

Re: Warzone and Python

Post by cybersphinx »

The advantages of Python mainly apply to newly written programs. If you already have a codebase of ~150000 lines, rewriting all that is a crazy amount of work.
We want information... information... information.
stiv
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 876
Joined: 18 Jul 2008, 04:41
Location: 45N 86W

Re: Warzone and Python

Post by stiv »

but it's not a language you would write a game engine in.
Like EVE Online?
"Python enabled us to create EVE Online, a massive multiplayer game, in record time. The EVE Online server cluster runs over 50,000 simultaneous players in a shared space simulation, most of which is created in Python. The flexibilities of Python have enabled us to quickly improve the game experience based on player feedback" said Hilmar Veigar Petursson of CCP Games.
http://www.python.org/about/quotes/

One of the nice features of python, besides its utility as a scripting language, is that you can easily extend it with modules written in C/C++. You wouldn't write the entire game in python, you would use python as the glue to call your compiled code.

And what cybersphinx said is certainly true.
Lord Apocalypse
Regular
Regular
Posts: 678
Joined: 29 Jul 2009, 18:01

Re: Warzone and Python

Post by Lord Apocalypse »

The core EVE engine is still C++ with a lot of stackless python used. I have looked into heavily as Vega Strike uses a fair amount of python for its scripting needs.
stiv
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 876
Joined: 18 Jul 2008, 04:41
Location: 45N 86W

Re: Warzone and Python

Post by stiv »

The core EVE engine is still C++ with a lot of stackless python used.
Exactly my point - you do the heavy lifting in C/C++ and use python to run it.

Stackless Python, for the unhip, is an interesting implementation that uses lightweight eventlets (like little simultaneously executing co-routines), an alternative to running lots & lots of threads.

Interesting about Vega Strike using Py for scripting. I played it a bit, many moons ago. Showed great promise, IMHO.
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: Warzone and Python

Post by Emdek »

Jorzi wrote:Java/c#/go
Java or C#? No (especially not C#, there is at least one framework for doing that using this 'thing' but this is simply wrong). :-)
Go? Maybe, in very distant future.

Python? Yes:
http://www.pygame.org/news.html

But still C++ (not bare C++, but with some libraries or toolkit) seems to be one of best choices for now.

And yeah, porting large applications (that applies not only to games) doesn't make big sense usually, it often would be easier to write it (mostly) from scratch.
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
raycast
Trained
Trained
Posts: 131
Joined: 12 Sep 2012, 19:16

Re: Warzone and Python

Post by raycast »

I love python.

But it is a scripting language, it's not very useful for really large projects. It's good for writing glue code, connecting web server with backend apps and so on. It's really nice, and decently fast (note that according to some benchmarks, now JavaScript executes much faster with the modern JS engines such as V8). But you would *never* use it for performance critical things. And there is a lot in WZ that is performance critical, at least if your CPU has just 1 GHz and not 10. For example path finding is a major issue -- on my older computer, on a large 8 player map, DyDO AI would issue so many movement orders that it sometimes took units 15 seconds to react to a new order, just because the pathfinding thread could not compute movement plans fast enough!

And similar the 3D engine. You need to do such things in low level languages such as C, that have a really strong static optimization. While everybody is these days into JavaScript (worst language ever since COBOL), and there have been quite some performance improvements on JS, you must not forget the fact that both Python and Java and JavaScript are executed by a C engine. Chrome is not writtenin JavaScript (or python) for a reason. It's not that the authors of Chrome don't have a clue about JavaScript (Google kicks ass at writing JavaScript). But sometimes, you need to use lower levels.

And as such, a lot of Python modules are actually written in C. Think of numpy, the numerics library for Python. It's mostly a Python wrapper around the low level BLAS library, which in some parts are Fortran and/or Assembler.

Python is good for beginning and scripting. But not for large projects that need a lot of performance. It may be desireable to have Python as a scripting language inside, but WZ already got JavaScript for AI scripting, so why also add python?
Lord Apocalypse
Regular
Regular
Posts: 678
Joined: 29 Jul 2009, 18:01

Re: Warzone and Python

Post by Lord Apocalypse »

Python could be used as a netcode replacement or at least to handle all the tedious networking chores
raycast
Trained
Trained
Posts: 131
Joined: 12 Sep 2012, 19:16

Re: Warzone and Python

Post by raycast »

Python could replace the world altogether. If it were fast and appropriate for this task.

No, the netcode is critical enough, we don't want extra lag by Python Garbage Collection or anything like that. Stick to what we already have in C. Scripting languages are good for scripts, but do not rewrite infrastructure in a slow scripting language, when you already have an efficient version.
Post Reply