Solved

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

Posted on 2014-01-29
10
1,254 Views
Last Modified: 2014-02-22
Hi

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?

Thanks
0
Comment
Question by:beavoid
10 Comments
 
LVL 6

Expert Comment

by:Mahesh Bhutkar
Comment Utility
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.
0
 

Author Comment

by:beavoid
Comment Utility
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?
0
 
LVL 26

Accepted Solution

by:
dpearson earned 500 total points
Comment Utility
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,

Doug
0
 
LVL 31

Expert Comment

by:farzanj
Comment Utility
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.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Closing Comment

by:beavoid
Comment Utility
Thanks
0
 
LVL 26

Expert Comment

by:Zberteoc
Comment Utility
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:

http://en.wikipedia.org/wiki/Eve_Online

http://www.eveonline.com/

http://www.networkworld.com/news/2013/073113-mulitplayer-battle-272367.html

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.
0
 
LVL 26

Expert Comment

by:dpearson
Comment Utility
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.
0
 

Author Comment

by:beavoid
Comment Utility
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?)
0
 
LVL 26

Expert Comment

by:dpearson
Comment Utility
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.

Doug
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Flask is a microframework for Python based on Werkzeug and Jinja 2. This requires you to have a good understanding of Python 2.7. Lets install Flask! To install Flask you can use a python repository for libraries tool called pip. Download this f…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now