That is a pretty broad question. I think your options with Java are similar to most other languages.

You can provide a tool (like a level editor, etc) that allows people to make modifications, although that can be a fairly complex task to develop in and of itself.

Another option is to take a data driven approach. For instance, use external configuration files rather than hard coding values. If you want to take this to the extreme, then you can use the Properties Pattern (Steve Yegge has a pretty good description of it). You essentially store everything in hash maps rather than fields.

So you don't have a Ship class any more. Everything is a bag of properties. This can give a lot of freedom to specify all sorts of behavior outside of your code.

The down sides of the approach are that the performance may not be as great, it can get unwieldy to program (lots of getValue("hitPoints"), and you can't take advantage of the static type checking that Java gives you. If your property is maxHealth and you call it maxhealth, you won't know until run time.

Or, you can even just use Java. Java's ability to load other JARs in a Java program allow it to be a capable modding platform. You can just use a ClassLoader, and load a class that has all the mod functions.

Or, you can even just use Java. Java's ability to load other JARs in a Java program allow it to be a capable modding platform. You can just use a ClassLoader, and load a class that has all the mod functions.

now all you have to do is implement init() and act(). the args parameter for init can be an array of string, an array of objects, a table of key/value pairs, or any other object suitable for storing parameters such as position, rotation, or entity specific values.The reason I use init() instead of a constructor is so you don't have to use reflection to get a constructor object, which would be slower.

Best games for mods basically have a folder where there are .xml type of files that they will use to load in any mods. Most of the loading and what not is done via config files that point to where the resources are and what the changes are. Look at skyrim for a modern approach or Arcanum for a very hacky but quick way.

In Arcanum, almost the whole game is loaded via .mes files which are text files. You can change and/or add things to the game. Fate also has a similar system which works very well. It also depends on the type of game. For fps, you could have some rules files that can be change and maybe a level editor. For a rpg you could load items/skills/all sorts of stuff through various files instead of hard coding things. This will let people play with them without having to recompile things.

As far as code getting stolen, unless it is super super super good no one will want to steal your code. In all honesty, I do not get the whole, "can't use my code" thing. Unless it is for security reasons, there is really no reason not to be liberal with your code. I know that many games do not just give the code away due to copyright issues but if you ask them how they do things, many will tell you or point you in the right direction. Even if someone uses your code, what is wrong with that? I would consider it a compliment.

Just put the source out there. It saves you a lot of time (by not having to deal with modding compatibility), and if someone really wanted to steal your game, they would have no trouble getting the source anyway.

The kind of people you are trying to stop are the kind who can't be stopped. You just end up ruining it for those who want to be honest and just make some mods.

Also, the chances of making a game people actually WANT to make mods for is quite low. No point wasting time on something that nobody will ever use.

Finally, there is absolutely no way you can account for everything in scripting. No way. That's why modders want to hack into the source and get the power they need.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org