How to Mod Fetish Master: Tips for setting up a developing environment

Hey guys, i want to develop a mod for Fetish Master, and i am in search for tips how to do this best. my main question is about how to set up a environment where you can develop your stuff best. my problem with the dev mode of Fetish master is that it doesnt give immediate feedback if, for example, the syntax is wrong. i have a bit of experience with java, and i use normally Intelij as an ide, but i am not sure how to set up a project in intelij where not start compleatly from beginning, but far more modificate a existing project (like Fetish master). i already know a bit about how the game works in detail, but i am still a bit unsure and hope that maybe someone with more experience can give me some recomendations.

@jimbobvii i hope that i dont annoy you, but it seems like you have more experience than i.

So developing for Fetish Master can be a bit tricky and really falls into two different categories: do you want to add content to the game, or do you want to modify the game engine itself?

If all you want to do is mod the game - add characters, events, etc. - using the in-engine dev tools is unfortunately your best choice. The syntax used for modding is much less strict than actual Java, and has some abstractions to make it easier for modders to use without knowing the game’s actual structure, but trying to rewrite the editors to function as mini-IDEs that could show you when something doesn’t work would be a massive, if not impossible, undertaking.

The best advice I can offer for modding - other than digging through other events/templates/items/etc. to get a feel for the syntax - is to first write events and templates in a manner that lets you quickly check whether their contents work - set up their flags and add a direct link to them from the base or debug areas, rather than try to run through your quest only to find that something’s broken. Once you’re satisfied that the event or template works as it should, you can set up the proper links and activation conditions. The best advice I can really give for syntax is to take a peek at events and templates that do similar things to what you want to do, or dig into the source code to see what functions actually exist.

The source code of the game is available - for h.coder’s unreleased 0.99 version, for my Legacy version that more closely emulates the released 0.98 versions, and for my heavily customized build, which adds some new features to take advantage of but might be outright broken. Once downloaded, you can open the folders in your Java IDE of choice, including IntelliJ, and poke around at the source files to get a better idea of the available functions and how they work - for most modders, src/fetishmaster/engine/scripts/ScriptVarsIntegrator.java is probably the most important, with src/fetishmaster/bio/Creature.java and related files also providing a good idea about setting up or applying actions to characters.

Normal IDE functions such as warnings and corrections should function on the downloaded source code as well, although the syntax will be different from how event files and such traditionally work; to get a feel for the differences, load up an organ in the in-game organ editor and compare it to the closest similar file in src/fetishmaster/bio/organs. Additionally, if you want to build the game engine from source, the included build files are designed to work for NetBeans - IntelliJ doesn’t seem to have a problem building the various classes, but by default it won’t build a complete JAR file for the game.

Note that using an IDE won’t really help with creating in-engine stuff like events, templates, items, whatever. Aside from syntax stuff, the game has a number of objects assigned during running that you’d need to redefine in the IDE to avoid errors, and your IDE won’t export to the XML format that in-engine files use anyways. At best, it’ll help you to get a feel for what functions are valid and what sort of input they expect or output they give.

Realistically, I should probably set up a wiki that documents the functions in ScriptVarsIntegrator and other common scripting functions, if nothing else; the documentation for the engine in general is pretty sparse and ‘look at other events’ is the best advice that can usually be offered. Unfortunately that’s a rather time-consuming undertaking and I really haven’t had any motivation to work on Fetish Master related stuff recently.

Lastly, since I have a penchant for over-complicating things, I like to recommend setting up Git inside your game folder if you’re going to be modding. Even if you’re not using it for version control, a simple git init inside a folder makes it so much easier to track when files have been added or modified inside that folder. This will hopefully make it a lot easier to pick and choose files later, whether you’re ready to release or just want to move your mod out of a sandbox into another modded install, rather than just copying the entire gamedata folder.

4 Likes

Thanks, thats already a lot of help. my main focus would lay more on economy changes then more events and such stuff, different types of contracts, a few production chains like making food and then feed it to other contractors etc., and because i never really saw people modificating such things, i am unsure how deep i actually want to modify the game. i already looked a bit into the events and experiemented a bit, but usually because i wanted to know what i have actually to do lol. i guess i just download your version and just dig a bit into it so i get a deeper understand of the engine and know what i exactly want to do.

2 Likes

i noticed that the code seems to contain code from netbeans… a liberary called “package org.netbeans.lib.awtextra”

Yeah, that’s something I didn’t really consider… h.coder used NetBeans as their primary IDE, and I never really bothered to change because it would complicate the build process. A lot of the GUI stuff was auto-generated in NetBeans and I have no idea how that’s going to react if you try tweaking it through other IDEs.

1 Like

at the moment the compiler is only complaining about that the libarary is missing, but i am unsure what to do. probably i dont even need it, because i can just change the files who arent the core of the game, but lets say, i would need it: can i import the libarary from somewhere (i am not sure how to google it to be honest because some websites seem suspicious)? and if no, should i temporary migrate to netbeans just for this project?

Edit: i just download netbeans i guess

Edit: ok maybe i should try to get the librarys instead.

At the moment I’d recommend installing and using NetBeans - to be honest, I don’t really know if just installing it would be enough for IntelliJ to locate and use the necessary libraries. Any startup or import errors NetBeans throws can usually be resolved by its built-in troubleshooter.

Keep in mind that compiling the project shouldn’t really be necessary unless you plan on modifying the engine directly; for standard modding the in-game tools should do the trick. Understanding how the game engine works and how to compile it is certainly handy, but it’s not a hard requirement.

1 Like

ok, just one problem… it seems like i cannot open the version of the game who is my project directly, only with the IDE. i have a other who is openable, but the version who is in my github project isnt. (i admit that my experience with coding came never beyond a really finished programm to be honest). seems like something (the dist folder) is missing or i didnt copied your version correctly.
Screenshot (834)_cr
Screenshot (835)_cr

I mentioned it briefly in my first post, but IntelliJ’s default ‘Build’ option doesn’t actually run the full build script, it just compiles the classes. IntelliJ should’ve given you the option to import ANT scripts when you opened the project; if you’ve done so, then under the Build menu in the toolbar there should be another submenu called FetishMaster, and from there you can choose the ‘jar’ option. This should compile the game, create a JAR file, and place the JAR and necessary libraries in the dist folder, allowing you to run the game from the start scripts.

EDIT: Also, if you’ve just downloaded the source code from git, you’ll need to have compiled it at least once for the game to run. The git versions are just the source code; the compiled JAR files that the start scripts look for isn’t actually included.

1 Like

ok, i compilered your version, but it seems like something is missing.
Output from Netbeans if i start it: “Problem: The project uses a class library called “beans-binding”, but this class library was not found.”
it is possible to compilere and start the game, but it has a error right at the start.

(ps: should i set up a discord server for better communication?)

NetBeans should’ve handled this automatically, but if it didn’t:

  • Right-click on FetishMaster in the Projects tab
  • Click on Properties at the bottom of the menu to open the Properties window.
  • Select Libraries from the menu on the left, make sure the Compile tab is selected, and click the + button next to Classpath on the right and select Add Library
  • beans-binding should show up in the Add Libraries menu under Global Libraries - select it and click Add.
  • If it didn’t appear under Global Libraries, click Create and choose to create a new Class Library; don’t bother adding anything when the Customize Library window shows up, just click OK. beans-binding should now show up under global libraries, and you can use the Add Library function to add it. It’s empty, but for the purposes of compiling the existing code it shouldn’t make a difference.

If the game compiles properly, it should be copied to the dist folder, and you should be able to run the game from the start.bat or start_dev.bat file without needing to do anything else. If the game errors out at launch or when starting/loading a game, I can’t really help diagnose the issue without the error log from the console window; if the console window vanishes before you can read the error, try opening a cmd or PowerShell window from inside the folder with the start file, and then launch the start command from there.

1 Like

ok, now i am a bit out of ideas to be honest. i made some progress, but now
I want to program something that isn’t anywhere else in the code. I would like to program a task in which the creature uses items from the inventory of the house (house storage), more precisely, eats. I just don’t know how to interact with the house inventory from within a task. I got it with “player.inventory.removeItem(“cream_eclair”,1);” tried, but doesn’t work.

That’s actually very close to being correct, and it’s easy to get that idea if you look at commands that add or remove money. But the addItem and removeItem commands should be run on a character or creature, not their inventory. Additionally, the removeItem command only removes a single item at a time, so the second argument of 1 would be invalid. The valid command would be player.removeItem("cream_eclair");

In this case that task script should be pretty simple, and you can quickly modify the existing ‘eat eclair’ task to do it. Where the old code would contain

if (isTaskFirstHour())
{
  res = self.useItem("cream_eclair");
}

the new version would look more like

if (isTaskFirstHour())
{
  player.removeItem("cream_eclair");
  self.addItem("cream_eclair");
  res = self.useItem("cream_eclair");
}

You would also want to update the Conditions portion of the task to check if the player inventory has the correct item, rather than the inventory of the proxy fulfilling the task.

1 Like

ok, the feeding task works now. the thing is, it works at the moment only with one item and i think i am now at a point where i need a bit more complex features then i am using at the moment. lets say, i want to create a list of items who have a certian category and work all pretty much the same, like, for example, food. in a normal java program, i would make a extention of the item class named food with additional properties. as far as i know, such a thing is not possible in fetish master at the moment, so the best solution here would be a list of items who are counting as eatable items. and, to be honest, i dont have enough experience with fm to know how to do that exactly.

Unfortunately the simplest solution is to manually create a list of anything that could be considered a food item, and then use that list. For example, the following script creates a list of the file names of a number of common food items, iterates through that list, and prints the name of each item to the game window while adding one copy of each to the player’s inventory:

printMe = "";
list = ["cream_eclair", "cream_latte", "filter_coffee", "pancakes", "regular_milk", "breast_milk", "espresso"];
for (i = 0; i < list.size(); i++) 
    {
        printMe = printMe + list[i] + "\n";
        self.addItem(list[i]);
    }
printMe;

Because list is a temporary variable, it would be safest to redefine it in each event or task it’s used in, or else risk getting an undefined error if it’s been cleared out of memory or hasn’t been initialized yet. You can technically store the list as a text flag, but this casts it to a string - casting it back into a list of strings when reading it from the stored flag would be a tad more difficult.

1 Like

well, better than nothing, i guess.

I eagerly await this mod! I’ve been waiting for new content for this game for ages :smiley:

1 Like

:sweat_smile:
The thing is, i tend to start much and finish less… so please dont be too disapointed if i am not finishing it. i will try, but i am a bit slow. also fetish master is, as you probably seen in this topic, a bit hard to code. and i am unsure how deep i want to mod the game to be honest. i am only a hobby programmer at the moment. i am thinking about maybe adding kind of a crafting system, but that would be more a thing for @jimbobvii s mod who upgrades the game in general with new features.

No worries! I’m the same way when it comes to finishing personal projects. I just got excited because of how much I love the game and wish for a flourishing community revolving around it.

TLDR don’t feel pressured and just do whatever you want. :+1:t2:

1 Like

ok, i am facing another problem, but this time it gets really complicated. the thing is, i want to use a alternative version of the abdomen organ, written by @Juxtaterrestrial , because i am personally more in favor of a system where the food a person can eat is limited, instead of a puking system, mainly because i dont like puking and because of other plans i have. the problem is, it seems like the way @Juxtaterrestrial implemented it cannot be copied 1:1 to your custom build, and i guess that has to do with the organs and genes system as well as the fact that @Juxtaterrestrial changed a few variable names because of how unintuitve the names were before. i guess now i pretty messed up some things and now i dont know what to do to be honest. the thing is, he solves the problem by modificating the items who are suppossed to be food with the following code:
self.doAction("test_fullness"); if(self.getStat("stomach.full") <1) { self.addStat("generic.health", 10); self.subStat("generic.tiredness", 20); self.addStat("generic.calories", 1000); self.addStat("generic.food", 100); self.addStat("generic.arousal", 10); self.doAction("eat"); ""; } else { false; }
but in my game, it just doesnt work, i guess. my characters can eat as much as they want, and i dont know what to do against it.