Is Java a gift to modders?

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Hydra

New Member
Jul 29, 2019
1,869
0
0
*raises hand* I'd love to contribute to the modding community. But not so much that I'd want to delve into the boilerplate horror that is Java. I know I should learn it, I really should. But every time I sit down to do so I run into the same conceptual problem. "Wait, it takes me 6 times the lines, each line being twice as verbose, to do the same thing as in Python? This is good, how?" And yeah, I could deal with braces again if I had to. That's not the issue. :)

The "6 times the lines" only applies if you also count the boilerplate stuff you need for classes and methods. Java forces you to work inside a class and it's methods while Python is a script language that will happily let you execute a single "print a string" command.

Although this might seem as a burden it really is not. First of all; a good IDE will let you generate all the boilerplate. When I add a new class to a Java project I don't write all the boilerplate stuff; I generate it. Same with all the getters and setters for a bean: I just at the private variables and Eclipse is smart enough to generate the getters and setters for me.

The only think you have to really write yourself is the intelligent stuff. The "how". The business logic. And that's the most work, and also the 'intelligent' work no system can do for you. And that part is exactly as "long" in Java as in Lua or whatever. And there Java benefits from a very good API, very good IDE's and literal craptons of open source implementation of basically whatever you need.

For example, do you know LUA doesn't have a basic string splitting method? You have to google an implementation and copy paste this into your program. I mean, the hell? Such basic operations need to be part of the implementation. Java has all this and if Java itself doesn't have something then there will be an open source library that does.

Java is such a popular language, especially for backend stuff, because there's a huge landscape of open source software behind it. And that's why if you go from Java to Python, Lua or Ruby on Rails and get over the exitement of not having to do the boilerplate stuff (which you didn't have to do anyway) you notice that those frameworks, while giving you some nice gadgets, don't really have the backing of huge companies like Oracle and IBM (IBM produced LOADS of open source Java stuff) and an active open-source community.

Last but not least: experience as a Java developer is simply worth more than experience in Python or Lua because there's much more work in Java. Most large enterprise systems are java-based on the backend because of the big landscape of open source stuff.
 

BananaSplit2

New Member
Jul 29, 2019
102
0
0
I realise that, just like LUA (addons, not mods) made World of Warcraft more popular, and Counter-Strike Source with its mods, dunno about the programming though, I'm not an expert.

those aren't real "mods". They're more like addons that can be added in through one mod which was created as a gateway between the game and the addons. A comparison would be bukkit plugins. Simple language make things easier, but more limited
 

Hydra

New Member
Jul 29, 2019
1,869
0
0
The benefit of LUA is much more on the game developer side than on the modder's side. LUA was chosen for WoW simply because it's easy to restrict access to only certain parts of the system (user interface). With MC mods you basically can access and even override the rendering. You can't do that in WoW at all. A modding API in Lua that would allow such a thing would actually be a really complex layer on top of the engine.
 

Greyed

New Member
Jul 29, 2019
445
0
0
Although this might seem as a burden it really is not. First of all; a good IDE will let you generate all the boilerplate.

If you don't generate it, then why require it to be there? It is required to be there. And even if I haven't typed it in myself doesn't mean it doesn't impact my workflow. That is taking up both screen and conceptual real estate.

Java is such a popular language, especially for backend stuff, because there's a huge landscape of open source software behind it. And that's why if you go from Java to Python, Lua or Ruby on Rails and get over the exitement of not having to do the boilerplate stuff (which you didn't have to do anyway) you notice that those frameworks, while giving you some nice gadgets, don't really have the backing of huge companies like Oracle and IBM (IBM produced LOADS of open source Java stuff) and an active open-source community.

The irony in the fact you made this statement in all seriousness is astounding. You do realize that every language listed there has an open source community contributing to it, right? That Python has an extensive library ready for use. If you don't believe me, take a gander at Ohloh's stats page. Monthly commits for Java has been flat, Python, growing. Monthyl contributors (people using the language), Java flat, Python growing. Monthly projects, Java flat, Python growing and set to exceed Java. Most telling of all, lines of code changed, Python remains about 1/3rd that of Java. A growing number of people are contributing more commits to more projects in Python while having to do, or keep track of, 1/3rd the work. One could almost conclude that the latter is contributing to the former.

Last but not least: experience as a Java developer is simply worth more than experience in Python or Lua because there's much more work in Java. Most large enterprise systems are java-based on the backend because of the big landscape of open source stuff.

Yeah, it isn't the open source stuff that drives Java's popularity in business. It is the "Who can we sue" aspect of it.
 

Hydra

New Member
Jul 29, 2019
1,869
0
0
Yeah, it isn't the open source stuff that drives Java's popularity in business. It is the "Who can we sue" aspect of it.

It seems you have some kind of 'dislike' of Java and I have no intention of getting in some kind of discussion on what's better. That's not my intention at all. I personally really like Python and my professional background is in Java. If I would have to write a mod my preference would be to do it in Java because unlike with Python I have over 15 years of experience in it (compared to some hobby stuff in Python). I am just giving my vision on why IMHO Java definitively is not "worse" than Python. If you disagree (I personally think your arguments about "screen real estate" in this context is silly) that's fine. I'm quite happy to see Python is maturing and I certainly hope it will replace PHP somewhere down the line.
 

BananaSplit2

New Member
Jul 29, 2019
102
0
0
The benefit of LUA is much more on the game developer side than on the modder's side. LUA was chosen for WoW simply because it's easy to restrict access to only certain parts of the system (user interface). With MC mods you basically can access and even override the rendering. You can't do that in WoW at all. A modding API in Lua that would allow such a thing would actually be a really complex layer on top of the engine.

It's not really a question of language. It's the program itself which limit what to access. Whatever language you use, you can access all the files if you modify the game itself without using a gateway between the two (Restrictive API)
 

whythisname

New Member
Jul 29, 2019
474
0
0
I'm no professional coder, but coming from the modding scene of other games I'd say Java is a gift for modders. The games I've modded in the past employed their own scripting languages and had the "core" locked down, unaccessible to modders. That doesn't mean there were no great/fun mods possible, but it did mean many things that were hardcoded simply couldn't be changed or accessed at all.

So you basically always had this feeling of "I'm working on a superficial layer with a lot of 'magic' going on underneath", which could create some very unexpected results. And if you had a problem with something the only way to solve it was to dump in random stuff, analyze the output and determine what happens using common coding knowledge and trying to imagine what's going on behind the scenes.

Seriously, being able to open up MC and at least just look at how it works is a huge blessing compared to something like that.
 
  • Like
Reactions: Poppycocks

jatie1

New Member
Jul 29, 2019
107
0
0
Would there be a difference if vanilla Minecraft was coded in another language? Would we have more FPS?
 

Sphinx2k

New Member
Jul 29, 2019
195
0
0
Would there be a difference if vanilla Minecraft was coded in another language? Would we have more FPS?

Maybe a little but not to much. People thinking Java is to slow are some years late + PCs have lots of power today. It is the same question as would a game run faster with openGL then DirectX.
It comes down to the programmer. If the Programmer is doing a good job it doesn't matter what he coded the game in.
Problem with MC is that it startet as a private projekt of notch in his free time. So when he set some things in stone he did not know what Minecraft could become an for what he thought would come his code is kind of OK. But for what it is now the code needs to be more polished.
 
  • Like
Reactions: Whovian

Hydra

New Member
Jul 29, 2019
1,869
0
0
Would there be a difference if vanilla Minecraft was coded in another language? Would we have more FPS?

C++ would probably give a slight improvement but the main bottleneck is basically MC itself. It's completely different from shooters. It's an OpenGL based 3D game but that's basically where the similarity ends.

Shooters have the benefit of having fixed terrain that can't really change much and can thus do a lot of optimizations on what needs to be drawn and what doesn't. MineCraft isn't like that; every single bit of the terrain can be removed or changed.

Some say that Minecraft looks like a game from the 90ies. Well, in the 90ies we didn't have the processing power for a game like MC in our home computers.
 

Whovian

New Member
Jul 29, 2019
1,181
0
1
It definitely did. Writing Mods in C++ would be much harder and only the best programmers would actually release Mod. (look at terraria and it's lack of good mods, cause it's written in C++)

So you're suggesting C++ is harder. I could argue that one needs to understand O-o to even understand a simple "Hello world" program in Java, so why the *censored* would anyone want to program in that language?

I think modding, though, would be more difficult in C++. Only due to the issue of compiling it for each separate system.
 

Sphinx2k

New Member
Jul 29, 2019
195
0
0
I think modding, though, would be more difficult in C++. Only due to the issue of compiling it for each separate system.

You are missing that you need something to mod. Without a source code from the developer of the game, it is nearly impossible to decompile a c++ program properly (and law vise it is more complicated to recompile and distribute it). So you need a good API or need to hook it in memory or use other tricks.
 

slay_mithos

New Member
Jul 29, 2019
1,288
0
0
You are missing that you need something to mod. Without a source code from the developer of the game, it is nearly impossible to decompile a c++ program properly (and law vise it is more complicated to recompile and distribute it). So you need a good API or need to hook it in memory or use other tricks.
That is true, but at the same time, if making calls to the actual code was such a pain to do, Mojang would have put more resources in making hooks and an API, rather than giving the task to some people that happened to make a good server-side modification (after months of talking about it being in next release, no less).

I am not well placed to talk, as I am not making mods for Minecraft, but most of the games that advertise their mod ability also provide tools for said mods to be made.
The Elder scrolls series is quite a big example of that, they even give a tool that has an user interface. Same goes for Warcraft III, Never winter night, and others.
Some other games have a harder path than others, some are using a scripting system, some accept direct code...

But Minecraft is one of the very few that is known for having tons of mods, and still needs its base code to be modified in order for most of them to even work at all.

Minecraft needs a good API for the mods, and I am talking about something at the very least on the level of Forge in term of hooks and ease to use. Later on, it would be good if they also made a tool to make models and textures directly in it, because that would open the door to many more people, but that's for way later.
 
  • Like
Reactions: Sh3it4n and Whovian

Greyed

New Member
Jul 29, 2019
445
0
0
So you're suggesting C++ is harder. I could argue that one needs to understand O-o to even understand a simple "Hello world" program in Java, so why the *censored* would anyone want to program in that language?

C++, the OO version of C, which allows for anything in C, so to program in C++ you have to keep in mind everything from a functional language as well as an OO language. Conversely in Java you only have to learn OO and keep that paradigm in mind when coding for it.
 

Bigglesworth

New Member
Jul 29, 2019
1,072
0
1
I think Python is a good gateway language to things like Java and C. As Mincraft is a game about creation, I think java as its official mod language puts off a much larger chunk of people than would Python. You gotta give most people a taste first for free, then lead them to Java slowly, or they get scared and run away.
 

KirinDave

New Member
Jul 29, 2019
3,086
0
0
I think Python is a good gateway language to things like Java and C. As Mincraft is a game about creation, I think java as its official mod language puts off a much larger chunk of people than would Python. You gotta give most people a taste first for free, then lead them to Java slowly, or they get scared and run away.

Doesn't this argument lead to Lua, though? And Lua, unlike Python, does not have a contemptuous and self-loathing culture.
 

Bigglesworth

New Member
Jul 29, 2019
1,072
0
1
Doesn't this argument lead to Lua, though? And Lua, unlike Python, does not have a contemptuous and self-loathing culture.
Python is that as much as java is a 'cellphone language'.

And not in my opinion, LUA would be the in-between if anything. I did some LUA (mainly wow addons) before getting into Python and wished it was the other way around. When you get passed the nazi indent requirements (that actually really help newbies develop good habits), its quite pleasant.
 

slay_mithos

New Member
Jul 29, 2019
1,288
0
0
The language I enjoy the most is unknown and under used...

Why is ruby never considered when talking about scripting languages, when it does its job really well, and is really easy to learn?

Ok, that was out of topic, because the only thing that let you use Ruby as a modding language is RPG maker.
But I mean come on, where did the topic switch to "what language do you prefer using"?

Also, it is good to remember that Minecraft is originally the work of a single person, and as such, he choose a language that gave him the tools to make it happen as easily as possible.

We can talk all we want about C++ and scripting languages, but they don't rival Java for simply making a simple engine to render single sized blocks in a 3D environment.
C++ does have some great libraries, but learning how to use them is way more time consuming than the java ones.
As for scripting languages, most of them as great for their own task, but they usually don't perform nearly as well in a full program environment, where they have to handle everything. Also, they are not keen on using obfuscation and compilation, making them use slightly more resources than their compiled counterparts.

I personally would prefer going for C# for the XNA library, but it also means limiting the final product to windows, where Java can run on many different systems, as long as they can handle the graphics output, and can input from devices such as mice and keyboards.

Of course, it's so easy for us to talk about all this, because we didn't have to do it in the first place, but I totally understand choosing Java over the other languages if you are alone to make a game based on textured blocks.
 

Bigglesworth

New Member
Jul 29, 2019
1,072
0
1
Minecraft is about accessibility to creation. None of the C variants provide that nearly as well on multiple levels. Losing easy Linux support would pale in comparison to the mods we would be reduced to.

Also, Ruby, Python and LUA are not scripting languages. AutoIT is a scripting language. :p

AutoIT mods~ yeahh~
 

slay_mithos

New Member
Jul 29, 2019
1,288
0
0
Ok, the correct term is "interpreted" language, not scripting, but the fact remains that their most powerful feature of being interpreted at runtime is also arguably their weakest point.
When used for small programs, or hooking into other languages for specific tasks, they do a great job, and are really great for modding.
When used alone in an heavier program, they show their limit, because it takes a bit more CPU time to do the same thing as a compiled code.

I never heard about AutoIT before, but it seems like a fun tool, just not sure it would be great as a mod language.
 
  • Like
Reactions: Whovian