[A16] Modding for the Research Tree? (reserve X/Y?)

Started by Thundercraft, December 20, 2016, 07:36:53 AM

Previous topic - Next topic

Thundercraft

With the introduction of the research tree, there are now <researchViewX> and <researchViewY> tags for <ResearchProjectDef>. (See the ResearchProjects_Tier?_Misc.xml files.)

In the Alpha 16 unstable branch feedback topic, this post grabbed my attention:
Quote from: ChJees on December 15, 2016, 12:01:07 AM
Discussing with people in a Rimworld Discord channel #a16-discussion channel we came to the conclusion that the current way the Research tree is setup makes it extremely troublesome for mods that add their own research to play nice with both the Core mod and other mods.

Our proposed solution for this perceived problem is to make each mod add their own research either up or down from the Core research. It would only have to take up as much space as it needs in order to work well...

As someone who has created a few mods and is working on more, this concerns me.

Q1: What happens to a mod in A16 if it adds new research, yet it lacks <researchViewX> and <researchViewY> tags?

Q2: How would modders make sure that they don't - figuratively speaking - step on the toes of other modders when deciding where to place their mods' research in the research tree?

Should we start a thread and reserve specific <researchViewX> and <researchViewY> values? Should each modder reserve their own <researchViewY> for all of their mods? (This concept is not entirely new to me. In modding process for certain other games it is sometimes necessary to publicly reserve a certain range of limited game resources.)

RawCode

remove tags from noted xml and run game, post result
roll backup, set offsets of all techs to 1, run game, post result

not very hard, i don't see reasons why you ask someone else to test it for you.

Adalah217

#2
Okay so I initially came to this board to see if anyone else was working on a research screen scroll bar. Turns out, lots of people are.

The biggest question is: How can you get a research tab to display all research supplied by mods? As Tynan has suggested in another thread, there needs to be an algorithm. It may or may not come in A16B after the holidays. For now, we have an X/Y coordinate system.

Without further discussion of what you already know, here are my discoveries.
                                                         

It's possible to have too many techs and have them display below where they can selected. In this image, Machining should lead to Mortars and Advanced Machining. Advanced Machining cannot be selected here.

http://i.imgur.com/i1p1zl3.jpg

As you can see, I have plenty of mods which require research, and thus some will not be visible on the tree. In particular, I want to focus on the medieval mod.

                                                         

What happens when two pieces of research share the same coordinate?

The medieval mod adds 10 new tech. Two pieces of tech use the same X and Y coordinate already: MedievalTailoring (2,4) and ImprovedMedievalSmithing (2,4).
What is the result? Well, as you can see in the previous image, both still display. MedievalTailoring was pushed ahead. Why? ¯\_(ツ)_/¯   It might have something to do with how the ImprovedMedievalSmithing is tied to so many other pieces of research later.

TL;DR: It's possible to have the same coordinates, and even in the same mod. One tech just gets pushed up 0.5 (maybe less).
                                                         

What happens when a piece of research is not given coordinates?

I first erased the coordinates of the most essential piece of medieval tech's research. MedTimes_MedievalTechnologies originally had a position of (0,4). After erasing this position, here is the result:
http://i.imgur.com/r6LlQJd.jpg
If you were to compare to before, the tech has moved to the top left of the screen. I'm guessing it means without coordinates, research will just fill in the gaps.

Let's see what happens when all of medieval tech has no coordinates:
http://i.imgur.com/r6LlQJd.jpg
Just a mess. Or at least worse than before. It's unclear which comes first. However, note that it is possible to see Advanced Machining now.

                                                         

Conclusion: X and Y coordinates are not needed. In fact, using them might result in your tech getting bumped off the tree and unselectable. However, it will make the entire tree a mess.

Edit: Modders should not use Y-values greater than 5 for their techs. This is the main reason their techs are being hidden when used with other mods.
Before (note Advanced Machining is hidden):
http://i.imgur.com/i1p1zl3.jpg

After changing Y-values to 5 for DTC's weapons mods:
http://i.imgur.com/AvQvB61.jpg