Jump to content

Recommended Posts

Posted

I've been thinking, what would be better:

  • A complete rewrite of Minecraft in flash

OR:

  • A complete rewrite of Minecraft in C++

Seeing as both are great, I think flash would be entirely laggy (not to mention, who'd pay $29 for a flash game?!) on slow computers (even slower than Java) but C++ is quite better, seeing as Terraria is written in it (iirc). Thoughts?

Posted

I choose for C++. Also, isn't C++ a better coding language than java itself?

But if someone actually does want to completely rewrite minecraft to C++ (lets hope Mojang does this without fucking it up), then what about the modders? Do they have to do thesame too then?

EDIT: Whoever still reads this, I'm gone from the Technic Forums.

Posted

The reason java was chosen to write Minecraft in is because it is supported by almost every platform there is, meaning that it isn't locked to a specific platform. Plus, Java is awesome. How dare you say otherwise?

Posted

C++ would be faster, by quite a bit actually. The problems are compile speed is slower so updates would take MUCH longer, C++ is single platform without some major code rewriting each time you compile, and the clincher is there would be exactly no modding whatsoever.

You can't decompile C++, once you hit compile it's irrevocably machine code.

Even if the source was released you still run into the problem of no reflection in C++, so mods would not be as cross-compatible as they are now.

The only reason MC modding is as hard as it currently is (which is pretty darn easy for something without full source release or a good modding API) is because JAVA decompiles quite nicely and the only other protection there is on the code is the obfuscation, which is just a piss poor attempt at security through obscurity.

Posted

How about Python? It seems decent, but I haven't the faintest idea if one can code games for it (I seem to only use it for MCNostalgia)

Plus, Java is awesome. How dare you say otherwise?

I'm not one of the fanboys who decide Java is "awesome" because Notch used it. Minecraft was his test project, and it so happened to become a money-making game that sells itself (since players advertise it in every possible place). I am quite objective upon this matter.

Posted

Terraria was made in C#, fyi.

There is already a Minecraft clone written in C++ here.

Minecraft would be plenty moddable if it were written in C++... if it had a modding API (which, seeing as Mojang is completely incapable of providing such, I guess it wouldn't be moddable at all!). I guess the Bukkit team isn't actually any good at writing proper APIs any more than Mojang!

Posted

The main problem with Minecraft is that it is nearly completely hardcoded. If it were designed as a game engine with essentially the same built-in hooks Forge or Bukkit provided then it would be extremely flexible as vanilla would be a branch of modular code added to the engine (which could then be easily altered by mods, or added in addition to, etc).

EDIT: So even a complete re-write in Java could perhaps add to flexibility if done correctly. As to speed, I think it is unanimous that TileEntity ticks are one of the main bottlenecks so speeding that portion of code may not require a language-shift if done smartly.

Posted

C++ would be faster, by quite a bit actually.
Not really, as long as you write proper Java. If one would rewrite MC with same quality C++ code as is in it's current form I wouldn't be surprised if it ended up actually being slower (JIT compiler does work quite nicely actually and it's easy to blow your legs off with bad C++ code). Using the best coding for either language C++ might pull ahead by a few percentage points, not more.

The problems are compile speed is slower so updates would take MUCH longer, C++ is single platform without some major code rewriting each time you compile, and the clincher is there would be exactly no modding whatsoever.
Hmm, where to begin here. Yeah, compiling is slower but as long as you use anything half-decent (= anythng but MSVC) it's nowhere near as awful as you make it sound. My ancient quadcore Core2 recompiled Linux kernel in under 5 minutes and that's several orders of magnitude more code that make up MC. Compiling speed of C++ is absolutely not a problem.

C++ is NOT single platform thing. Not more than Java with LWJGL that MC uses is. Unless you are complete retard you WILL NOT have to recode almost anything to get the thing running on most platforms.

Modding would have been a bit harder, yes, but not impossible had there been a proper API from the start. Though even then it wouldn't have been impossible: @see original Quake mods.

Even if the source was released you still run into the problem of no reflection in C++, so mods would not be as cross-compatible as they are now.
A proper API would have resolved this.

How about Python?
Now that's definitely a language to use if you plan to cut your performance lower a few times. No amount of good code helps there, unless you do everything in C/C++ modules and just call something like runGame() from your python code.

As to speed, I think it is unanimous that TileEntity ticks are one of the main bottlenecks so speeding that portion of code may not require a language-shift if done smartly.
TileEntity ticks are bad but nowhere near as awful as the rendering system as a whole.

Basically Java is good enough for most stuff (fast enough when used properly) and rather awesome for some things (runtime modification of existing stuff) so rewriting it in another language wouldn't really make much sense. Though rewriting MC is kind of needed anyway to fix the awfulness of what Notch made, it's nearly impossible to salvage it. Good thing that they are already doing that with the "soon" released modding API + renderer rewrite.

Posted

And just because Notch used it doesn't mean it's flawless. He coded greatly but if you want to re-write it in C++, as long as your coding is not too messed up you should be able to get top performance out of it as well IMO.

Posted

And just because Notch used it doesn't mean it's flawless. He coded greatly but if you want to re-write it in C++, as long as your coding is not too messed up you should be able to get top performance out of it as well IMO.

actually, as i hear it, notches coding was mediocre. A deep optimization could probably do more for minecraft than a total language swap.

Posted

I am still waiting for a render rewrite that would allow for a full spectrum of colored lighting. Someone did it before the previous lighting rewrite, as a mod that modified like 20 base classes, but still, showed that it's actually possible.

Posted

actually, as i hear it, notches coding was terrible. A deep optimization could probably do more for minecraft than a total language swap.

Fixed that for you. As someone who has looked at the Minecraft source, I can tell you that it is a giant clusterfuck of spaghetti code and redundancies. It's terrible.

Posted

Not really, as long as you write proper Java. If one would rewrite MC with same quality C++ code as is in it's current form I wouldn't be surprised if it ended up actually being slower (JIT compiler does work quite nicely actually and it's easy to blow your legs off with bad C++ code). Using the best coding for either language C++ might pull ahead by a few percentage points, not more.

If minecraft was rewritten in java to be actually decent, then yes they would be comparable. But a straight up rewrite right now to C++ would require them to get some actual coding talent, so the end result would be a lot faster than what we currently have.

Hmm, where to begin here. Yeah, compiling is slower but as long as you use anything half-decent (= anythng but MSVC) it's nowhere near as awful as you make it sound. My ancient quadcore Core2 recompiled Linux kernel in under 5 minutes and that's several orders of magnitude more code that make up MC. Compiling speed of C++ is absolutely not a problem.

There's still an order of magnitude of difference between "Compile, wait for errors, run, hope it starts, check my changes" and "Hit run, hope it starts, check changes". You get your changes out the gate faster with java, so it's easier to debug said changes.

Also, please don't use ancient and quadcore in the same sentence... Ancient is old P3-233 I still have laying around because it was the first computer I bought myself.

C++ is NOT single platform thing. Not more than Java with LWJGL that MC uses is. Unless you are complete retard you WILL NOT have to recode almost anything to get the thing running on most platforms.

Yes, I'm well aware C++ can be compiled cross platform, I've been aware of that since I started with it 15 years ago.

I accept that Major may be an exaggeration, but I also know that if minecraft had been written in C++ originally, it would be single platform. Frankly I'm surprised Notch didn't accidentally find a way to make it single platform in java...

Modding would have been a bit harder, yes, but not impossible had there been a proper API from the start. Though even then it wouldn't have been impossible: @see original Quake mods.

IIRC, the quake mods were supported by ID and had access to the source, or atleast part of it.

I do remember looking through the source of one Q2 mod and being completely blown away.

A proper API would have resolved this.

Yes, but that requires the skill and foresight that's frankly in short supply at mojang.

Posted

He coded greatly but if you want to re-write it in C++, as long as your coding is not too messed up you should be able to get top performance out of it as well IMO.
First, as has been stated numerous times, notch coded far from greatly. Second, swapping languages WILL NOT bring a major performance increase assuming both implementations are written at roughly equal quality. Although I do admit that there are some things that are easier to optimize in C++ than in Java. Object pools and non-checked array access come to mind first.

Pocket/XB editions of MC show that it doesn't really take all that much of computing power to get it to work well on mediocre hardware. All it needs is decent coders behind the desk.

Simply writing an engine that would generate and render MC-like worlds isn't terribly hard or time-consuming. Adding all the content to make an actual game out of it is.

[edit]

Note: I've worked as Java coder for 3 years and C++ for 6 and written both for fun for much longer so I believe I have some experience on the matter of the two languages :)

There's still an order of magnitude of difference between "Compile, wait for errors, run, hope it starts, check my changes" and "Hit run, hope it starts, check changes". You get your changes out the gate faster with java, so it's easier to debug said changes.
Yeah, there definitely is but difference between waiting 5s vs 15 isn't really that much of a deal. Also, you rarely need to do a full recompile of your project so C++ stuff isn't anywhere near as slow as you make it out to be. I'd even dare say loading up JVM every time you want to run your stuff vs straight running of .exe makes up for the extra linking time.

That also completely discards the fact that I and quite likely every other coder spends extremely tiny fraction of development time compiling or even writing code vs figuring out how to solve problems in the first place. I've had numerous days where I've generated a whole total of <10 lines of code and have considered the day extremely productive :)

Also, please don't use ancient and quadcore in the same sentence... Ancient is old P3-233 I still have laying around because it was the first computer I bought myself.
Well, for anyone doing coding for living it is ancient. Newer CPUs easily compile stuff several times faster. Add in an SSD for another huge jump.

I accept that Major may be an exaggeration, but I also know that if minecraft had been written in C++ originally, it would be single platform. Frankly I'm surprised Notch didn't accidentally find a way to make it single platform in java...
I'd dare say it's still mostly single-platform if you dump all PC os'es in same pile and if they had staid with something like Allegro or SDL for IO and visuals then it would have worked on all three with just a simple recompile unless they had done something really dumb. The things running on consoles and phones are pretty much complete rewrites of the original.

IIRC, the quake mods were supported by ID and had access to the source, or atleast part of it.
Not initially but yes, after they became a thing ID quickly helped them out.
Posted

First, as has been stated numerous times, notch coded far from greatly. Second, swapping languages WILL NOT bring a major performance increase assuming both implementations are written at roughly equal quality. Although I do admit that there are some things that are easier to optimize in C++ than in Java. Object pools and non-checked array access come to mind first.

Pocket/XB editions of MC show that it doesn't really take all that much of computing power to get it to work well on mediocre hardware. All it needs is decent coders behind the desk.

Simply writing an engine that would generate and render MC-like worlds isn't terribly hard or time-consuming. Adding all the content to make an actual game out of it is.

[edit]

Note: I've worked as Java coder for 3 years and C++ for 6 and written both for fun for much longer so I believe I have some experience on the matter of the two languages :)

I wouldn't dishonor you by stating otherwise :P So from your point of view, how would you implement it? I mean as far as the coding goes? C++ or Java?

Posted

If I were Notch and just toyed around with code never expecting MC to become big I probably would have gone with C++ as I simply like the code in it more and quite likely I wouldn't have provided a decent API either. If I knew it would be an instant hit I'm not so sure any more. On one hand C++ has a few nice features and given decent API you can do almost anything with it. On the other hand Java gives people access to everything and extending things is far easier even when there is no API so I'd probably go with that.

Obviously in both cases I'd have it be opensource so people can help fixing and extending stuff :)

Posted

Fixed that for you. As someone who has looked at the Minecraft source, I can tell you that it is a giant clusterfuck of spaghetti code and redundancies. It's terrible.

I've seen it too, how can someone be that bad at coding? (I'm one to talk :P)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...