Is Python as good as Java for an RTS game server?


After my trail of Java RTS questions, I'm curious,
Is Python networking / Threading as good as Java's for an RTS game server?

But, Python Threading looks complicated, not just extends Runnable. . .

Should Python be avoided for this? why?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mahesh BhutkarCommented:
I preferred Java (High level language) instead of Python(Scripting language) as I am not much aware of Python.

After googling few sites about RTS (Real Time Strategy) game server, I come to know about node.js.  You can think off what they says,

Node.js provides great real-time integration, especially together with (WebSockets), which provides an easy and transparent WebSocket interface with gracefull fallback to Flash and Long-Polling.

Also, since you will need to simulate the game on the client (latency issues) as well as on the server (the authority simulation), you will need the same code on the server as well as on the client. Since you can only use JavaScript on the client, it is convenient to share some of the simulation code with the server instead of having to rewrite everything.
beavoidAuthor Commented:
I am thinking that the curve to learn a new language, compared to what I can already do with Java, makes the choice easy.
I'm not sure an interpreter can perform as well as compiled Java code, also, for something this complex. - Even if Python is superior? or are computers so fast now, that that doesn't factor in?

I dont see how MIT can think Python is the language of choice to start off CS 101 with, compared to Java? What am I not seeing?
Generally speaking any programming language can be used to solve any problem.

So the question you should be asking is how well suited is a specific language to a specific problem?  As no one language is best for everything.

What were the goals of Java when it was designed?  What were the goals for Python?

The simple answer is that Java is a strongly typed language, designed to be portable between environments (which is why today it works well on a variety of servers) and to be used in large scale development projects which require complex solutions.

Python is a dynamically typed language, which generally means it can be quicker to write code in, but tends to mean it doesn't scale as well to large complex systems.  But it's great for things like scripting where you can quickly write code to solve relatively simple problems, but more rapidly.

So now to answer your original question you should decide how complex your RTS will be?  If you expect to write the entire server in 5,000 lines of code, then Python may be a great choice.  If however you expect to write the server in 100,000 of code, then Java is probably the better choice.  A school project or relatively simple game you might find on Kongregate is more likely in the 5,000 lines or less level.  A commercial product you might buy at Best Buy is more likely in the 100,000 lines+ range.

Hope that helps,


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

A Python geek would argue that Python is a better language and it can be used even to produce Java byte code by using Jython (a variation of Python).  Python geeks believe that it is the cleanest possible language.  So, yes, if you like Python like code, you can use it to do whatever, even creating Java byte code.  I had a professor who was a research scientist and used Python for parallel processing and distributed computing in days when it was a very rare thing.

But, if you are used to Java, find Java syntax logical and are used to it, I don't see any reason for you to switch to Python.
beavoidAuthor Commented:
I will add my 2 cents to this even if the question was answered. One of the most successful and most complex multiplayer real time, strategy and visual online game in the world uses Python on both client and servers sides. They have their own client though, is not a browser game. I am naming here the EVE Online (MMORPG), which is a one server game and holds several records in terms of concurrent players and they had last year the biggest multiplayer battle(spaceships battle) in gaming history.

My knowledge in gaming coding is null but I can appreciate the results and EVE Online is probably the most spectacular game out there, at least in SciFi genre. Some links:

PS. This is more like an EVE Online praise rather than Python. ;) The only problem with this Game is that it is so complex that you practically have to treat it like a full time job, which actually I never did.
The only problem with this Game is that it is so complex

Haha - so true.  I tried EVE a few years ago and after spending 8 hours playing I was still only about 1/3 of the way through the *tutorial*.

Not for the faint of heart, but it is a huge technical achievement.
beavoidAuthor Commented:
Sorry for a late add on, but with many other questions' comments and certainly this question, I think I am going to brave doing a Python server, . . game. I got far in my Java efforts, but would prefer to be able to say I did it in the apex language, to not be in clown shoes! - with some help ;) Peer approval is nice.
I mean, I live on the edge of UNCW. If I seek student contributions to the project, (v. likely) they'll think I'm "some far out old man" (Apocalypse Now) if not in Python, like an indication of weakness.

Last time, how can an interpreted virtual machine, which isn't given rapid fire byte code, must analyze lines, be equal to compiled, which is "unclouded by conscience, remorse, or delusions of morality?" (Alien)

Isn't the split, split second of interpretation a factor, or is it inconceivably small?

Does Python have as good inheritance, data structure capacity and polymorphism?
I should leave my comfort zone. - Just forget my reluctance? Is it tedious?

Python UDP looks like a walk in the park!  here
Does it have good byte array construction, conversion capacity? (4 byte integers, etc, how?)
Anything that's not compiled directly to machine code is running some sort of interpreter.  Java's JVM is an interpreter.  But these days Java (and some implementations of Python like PyPy) employ a JIT - which is a "Just In Time" compiler.

That means the first time they encounter the byte code in the interpreter they convert it to machine code and execute that.  So the first time through a piece of code there's a small delay for the interpreter but after that it's the same speed as compiled code.

There is a school of thought that this sort of compilation can actually be better than standard compilers that go direct to machine code.  That's because the JIT compilers operate on a specific target machine (yours).  They can know things like your available RAM,  what CPU you have etc. and *in theory* build code specific for that target.  In practice this doesn't happen very often, but it can be done in some cases.

So interpreted languages can be close to compiled ones for execution speed.  Whether they are or not is usually more limited by the design of the language itself, rather than whether it's using a byte code or not.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Game Programming

From novice to tech pro — start learning today.