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

Posted on 2014-01-29
Medium Priority
Last Modified: 2014-02-22

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?

Question by:beavoid

Expert Comment

by:Mahesh Bhutkar
ID: 39820165
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 socket.io (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.

Author Comment

ID: 39823129
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?
LVL 28

Accepted Solution

dpearson earned 2000 total points
ID: 39852084
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,

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 31

Expert Comment

ID: 39852172
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.

Author Closing Comment

ID: 39852196
LVL 27

Expert Comment

ID: 39856192
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.
LVL 28

Expert Comment

ID: 39856782
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.

Author Comment

ID: 39880024
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?)
LVL 28

Expert Comment

ID: 39880146
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.


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Swadhin
Introduction of Lists in Python: There are six built-in types of sequences. Lists and tuples are the most common one. In this article we will see how to use Lists in python and how we can utilize it while doing our own program. In general we can al…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month16 days, 9 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question