Solved

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

Posted on 2014-01-29
10
1,366 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
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.
0
 

Author Comment

by:beavoid
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?
0
 
LVL 27

Accepted Solution

by:
dpearson earned 500 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,

Doug
0
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.

 
LVL 31

Expert Comment

by:farzanj
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.
0
 

Author Closing Comment

by:beavoid
ID: 39852196
Thanks
0
 
LVL 26

Expert Comment

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

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 27

Expert Comment

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

Author Comment

by:beavoid
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?)
0
 
LVL 27

Expert Comment

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

Doug
0

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

Suggested Solutions

Title # Comments Views Activity
servlet filter example 37 72
Running JavaFX on JDeveloper 12C 1 55
jsp insert to database example 2 47
Java basic valueOf question 1 29
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Dictionaries contain key:value pairs. Which means a collection of tuples with an attribute name and an assigned value to it. The semicolon present in between each key and values and attribute with values are delimited with a comma.  In python we can…
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

820 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