Modding in a New "Invisible" Resource

This one’s mainly for @Daniel, though if others have an idea, feel free to respond.

I understand that creating new resources in any real sense is not really possible at the current stage of the game, based on a few posts. Would it be theoretically possible to create a “faux” resource that doesn’t need to show up in the UI, but could be tracked and used in the background by other scripts? I’m having a few ideas about something I’d like to try, but want to check to see whether it’s even feasible before I start getting too ambitious. (@Loikas, feel free to laugh your butt off at the idea of me trying to do complex scripting after watching me struggle like I did to make simple modifications of the code you wrote for me… :rofl:)

Hahaha :smile:
It would be difficult because the way it is set up now is hard coded in and very difficult to change.
And i think that if you are able to add a new resource, it is also not that hard to add the UI :smile:

Haha :smiley:

Yeah, adding resources isn’t easy at the moment.
Since we now have Harmony integration, it’s technically possible, but it’s hard.

What are you trying to do?
Maybe there is a different way to achieve what you want.
If the resource is invisible, not tradable, not craftable, and not to be used for crafting, maybe we can just use a variable in your mod? Or something similar?

I’ve got some ideas around pretty completely changing the research system in the game. Basic ideas are as follows:

  • Things like farming and all basic structures unlocked from game start, because it seems crazy to me that colonists going to a new land would have to figure out how to farm once they got there by analyzing magical crystals

  • Then make crystals really as magical as they appear in game, and completely rework the research tree to be essentially the discovery of NEW technologies/magic based on crystals, which are by my new imagined lore unique to the islands in this part of the world and therefore unknown to the colonists. For example, “crystal mulch soil” for farming which is no longer susceptible to bug infestations, but requires a large investment of crystals to build, crystal weapons and tools, “power armor,” crystal towers which output happy feelings and increase everyone’s mood in a radius, automatic defense towers based on crystal tech, and the like. Long term, maybe even build a bit of lore, try to have destroying crystals for the creation of such items have consequences with the local goblins, who see them as sacred, so you lose relation with all goblins over time if you destroy too many of the crystals…

It’s a wildly, probably stupidly ambitious idea that would take me a long time to be able to even begin implementing, and I didn’t want to start trying anything unless I know that the basic foundation, separating research from crystals, is possible. I was trying to imagine how I might create an invisible “research” resource that could be tracked and spent in the background. I realized, though, that I can probably accomplish the base of what I want in a much easier way, by just balancing the costs of research differently, and making scrolls craftable at a new research and development table. All basic research just requires scrolls, which is just a matter of time (or expense buying them from traders.) But upper level research, involving “crystal tech,” would require crystals as well. And I think I’ll try to make crystals only effectively mineable with iron tools, or maybe even a new “crystal extractor” tool which is gated behind mid-tier research, to make them essentially an end game resource…

The wheels are turning in my mind. Anyway, that’s the crazy, stupidly overambitious stuff I’m dreaming about. I’m good at big ideas and bad at practically implementing them, but I’m going to try to learn in order to create this mod, because I think it would be a really fun twist on the world and game you’ve made.

Haha, that’s some creative world building right there!

You’re right, it’s very ambitious. That’s why I recommend to take it step by step. Cut out some part of your grand vision that’s small and can stand on its own legs. That way you have something to release and for people to play and check out way earlier. And player feedback might lead to better choices down the road and to a better mod overall - we’re doing the same for Founders’ Fortune, as you know.

About the technical stuff:
All the limitations seem to be in the research tree - it only supports crystalCost and scrollCost . What you actually use to fulfill these costs, is up to you (check out the productionDescription in bookStand in furniture.json ).

  • Crystal mulch seems doable
  • Crystal weapons and tools are easy
  • Mood towers require some programming, but shouldn’t be too hard
  • Making scrolls craftable and removing crystals from research seems to be good first step. You can always introduce some other non-crystal research resource later on.

FYI about the PM: I understand the reason. In general though I like keeping posts public because other people sometimes have similar questions and they may get value out of the discussion :slight_smile:

Thanks for the advice.

I can definitely see that the research tree is going to be my biggest issue. Actually modifying what research branches are available and what they do clearly isn’t something that’s going to be easy to mod. Is it at least theoretically possible, though, to essentially build a new research tree from scratch and plug it into the game?

Contrary to your expectation, that should actually be totally possible!

The research tree is fully defined in research.json
Other than that, you may want to heavily edit furniture.json and equipment.json to use the new names for research and provide localizations.

Touche.

However, I’d like research to be able to do some things beyond unlocking new furniture and the like. Would it be possible, for example, for create a research project that, upon completion, made all plants grow 25% faster? That’s the kind of thing I’d be most interested in doing, long term.

I see. Yes and no.

Accessing the research in your own scripts is super easy. It’s as simple as

ResearchManager.IsUnlocked("someTechName")

Changing behavior of the game requires more work depending on what you want to change, but is possible. You’re going to need dnSpy, maybe Harmony, and enough patience to dig through the FF code to find what you’re looking for. Check out the scripting tutorials for these tools.

If it’s theoretically possible, then I’ll give it a shot. For now, though, I’ll put that on the backburner and start with a few smaller, more achievable goals.

Thanks for all your help and advice, @Daniel.

1 Like

Just to make sure I’m understanding something correctly:

To edit or delete an existing research project, I’d use patch.json. To create a new one, I’d define its parameters in a special research.json that would be packaged with the mod, much as the small furniture.json package defining the laser sword workbench in the example mod, yes?

I just checked and it turns out research.json reading is not supported yet (but it’s easy, so I’ll deliver it with the next small update).

In the meantime, replaceOperations should be able to do the job, even though you’re not really replacing something, but creating new tech. Just try it :smiley:

Surrounded by water, think fishing for pearls would be out of the question?