Link to home
Start Free TrialLog in
Avatar of James Hancock
James HancockFlag for United States of America

asked on

Must I capitulate and do my server in C? but, is playerIO okay?

Hi
Considering my other game-server question, a rep from Amazon called me a little while back and said the server I had acquired for my project is being unused. I accepted an upgrade deal for it. - anticipating my awesomeness.
(This is the one I got before I became interested in playerIO.com as a game server.)
It is a bare metal dedicated server, I think, on its own, that's what she said, and I read that recently that that is faster/more reliable  than cloud servers.
Should I let playerIO out to pasture and do the entire job myself on my dedicated? Luckily, I haven't committed any money to the other.
playerIO servers must be written in C, not Java, (only clients can be in Java) and based on the ridicule, and spiteful comments I've received for wanting to do a server in Java ;D is that a hint!?
Why is minecraft java okay, then?
Does playerIO seem practical?

Thanks again for the time.
Avatar of evilrix
evilrix
Flag of United Kingdom of Great Britain and Northern Ireland image

Minecraft Java edition is known to be a significant resource hog, mostly due to its Java implementation. There's a reason why Mojang have implemented a non-Java (C++) version... Java scales terribly.
SOLUTION
Avatar of dpearson
dpearson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Doug, I'm not a Java expert and so I'm not attempting to contradict you here, but why do you think Mojang decided to go down the route of reimplementing Minecraft in C++? I'm just making an observation, not disagreeing with you, per se.

My guess is that whilst the assertion that hardware is cheaper than engineering time is true, you also have to consider the end user. What I mean by that is, if your end user can afford the hardware then so be it, but if your target audience isn't likely to be able to make such an investment, the only real option (of those given by the OP is C/C++).

Thoughts?
Hi Rix,

Everything I've read said that both the Mojang and Microsoft variants have been rewritten in C++ strictly for performance.  Machines that are not designed for gaming will get smoother graphics and a better user experience.  

I have no idea how many devices this brings into their network, but it probably doesn't take more than a couple thousand user accounts to pay for the programming time, and a 1% increase means 10s of thousands.

Kent
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Doug, I'm curious as to why you think Modern C++ has greater development overheads than Java. C, sure. Modern C++, significantly less so.
Avatar of dpearson
dpearson

Having to manage your own memory still makes coding C++ correctly significantly harder than coding Java.  Certainly in my experience (I spent many years writing C++ code and we still use it for native mobile apps - although I personally no longer write it day to day).

It's definitely possible to learn to write C++ apps such that memory management is largely automatic - by the correct use of auto pointers and the like.  But there remain really ugly patterns (e.g. double free of memory causing a crash much later in the app) that simply don't exist in Java.  I think there are data structures and algorithms that you can write in Java (e.g. complex cyclical data structures that may fail at any point during construction and where everything is on the heap) that would be exceptionally difficult to implement correctly in C++.  Not impossible.  Just difficult.

I would say a highly talented C++ developer could maybe develop code just as quickly and accurately as a highly talented Java developer (and it will certainly run faster) but for the average developer that's not going to be a good trade.  And I've been developing professionally for over 20 years with 10+ in C++ and I'd certainly not put myself in the pool of folks for whom C++ would be as fast to develop in as Java.

To be fair, I'd also say newer languages like Kotlin or Go might be even faster than Java to write.  Kotlin certainly is.  Not for me yet (I'm a novice there) but clearly it's cheaper development costs again compared to Java.

Just my two cents :)

Doug
Certainly, prior to C++11 most of what you say is true, but Modern C++ solves most, if not all of these issues, including issues with cyclical data structures. No language is perfect and all have strengths and weaknesses, but the historical arguments against C++ are mostly redundant with Modern C++. Of course, if you're going to hire a C++ software engineer, it only pays to hire someone who is versed in the latest C++ standard and modern C++ design patterns.

Thanks for the discussion.
evilrix - can you say more about how C++ solves those issues today?  Since I've not been writing it recently I may be out of date on what's now easy or at least easier to get right.

E.g. Is there now a language protection to prevent calling free twice on the same block of memory?
And for cyclical data structures on the heap - how is memory reclaimed without great care in unwinding it (since ref counts won't generally work here)?
Well, weak_ptr is used to solve cyclic issues, whilst unique_ptr and shared_ptr are used to solve heap memory ownership and sharing issues. Knowing how to use them still matters, of course.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of James Hancock

ASKER

Thanks all for the help.
...
mods, why cant I select expert helps and close the question?