Batch of questions for anyone who can answer; (6/6 solved)

Started by Vas, July 21, 2015, 02:31:53 AM

Previous topic - Next topic

Vas

1. I noticed that some texture files have a mask file with them where parts of the file are red, the rest tends to be black.  What does the red do?  And does that area in the file it goes with have to be white?  EG, beds have the posts white.  How do we use these areas?

2. In beds, there is a green area in that same mask file, what does this green area do?  How do we use these areas?

3. Can you make an item (like the walls) 2x2 blocks in size and still use the atlas correctly?  Do you have to increase the atlas in size so that instead of 64x64 pixels per atlas piece, it would be 64*width x 64*height?

4. If I make an area transparent in the texture, how do I make it so light shines normally on it without having some weird dark area?

5. Is it possible, with the use of a mask file or some sort of path file, to make certain areas of the item walkable?

6. Is there a way to use a sort of variable or increasing percentage for areas that take integers?  Here's an example of what I mean; (I've used my mod, but removed data not relevant.)
Code (Example) Select
<?xml version="1.0" encoding="utf-8" ?>
<ThingDefs>
<!-- Start of useless annoying data -->
<ThingDef Name="BuildingBase" Abstract="True">
<category>Building</category>
<soundImpactDefault>BulletImpactMetal</soundImpactDefault>
<selectable>true</selectable>
<drawerType>MapMeshAndRealTime</drawerType>
<terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
<repairEffect>Repair</repairEffect>
<statBases>
<WorkToMake>100</WorkToMake>
<MaxHitPoints>100</MaxHitPoints>
</statBases>
<costStuffCount>10</costStuffCount>
<costList>
<Steel>5</Steel>
</costList>
<fertility>1</fertility>
<li>
<compClass>CompPowerTrader</compClass>
<basePowerConsumption>6</basePowerConsumption>
<transmitsPower>true</transmitsPower>
</li>
</comps>
</ThingDef>
<!-- End of useless annoying data -->


<!-- Modular Hydroponics, Basic, 1.2 Fertility | Tier 1 -->
<ThingDef ParentName="BuildingBase">
<defName>HydroponicsBasinModular</defName>
<label>Modular Hydroponics</label>
<statBases>
<WorkToMake>1x</WorkToMake>
<MaxHitPoints>1x</MaxHitPoints>
</statBases>
<costStuffCount>1x</costStuffCount>
<costList>
<Steel>1x</Steel>
</costList>
<fertility>1x</fertility>
<li>
<compClass>CompPowerTrader</compClass>
<basePowerConsumption>1x</basePowerConsumption>
<transmitsPower>true</transmitsPower>
</li>
</comps>
</ThingDef>


<!-- Modular Hydroponics, Rich, 1.5 Fertility | Tier 2 -->
<ThingDef ParentName="BuildingBase">
<defName>HydroponicsBasinModularRich</defName>
<label>Modular Rich Hydroponics</label>
<statBases>
<WorkToMake>1.9x</WorkToMake>
<MaxHitPoints>1.9x</MaxHitPoints>
</statBases>
<costStuffCount>2x</costStuffCount>
<costList>
<Steel>2x</Steel>
</costList>
<fertility>2x</fertility>
<li>
<compClass>CompPowerTrader</compClass>
<basePowerConsumption>2x</basePowerConsumption>
<transmitsPower>true</transmitsPower>
</li>
</comps>
</ThingDef>


<!-- Modular Hydroponics, Fertile, 1.8 Fertility | Tier 3 -->
<ThingDef ParentName="BuildingBase">
<defName>HydroponicsBasinModularFertile</defName>
<label>Modular Fertile Hydroponics</label>
<statBases>
<WorkToMake>3x</WorkToMake>
<MaxHitPoints>3x</MaxHitPoints>
</statBases>
<costStuffCount>2.8x</costStuffCount>
<costList>
<Steel>2.8x</Steel>
</costList>
<fertility>3x</fertility>
<li>
<compClass>CompPowerTrader</compClass>
<basePowerConsumption>3x</basePowerConsumption>
<transmitsPower>true</transmitsPower>
</li>
</comps>
</ThingDef>


<!-- Modular Hydroponics, Potent, 2.2 Fertility | Tier 4 -->
<ThingDef ParentName="BuildingBase">
<defName>HydroponicsBasinModularPotent</defName>
<label>Modular Potent Hydroponics</label>
<statBases>
<WorkToMake>4x</WorkToMake>
<MaxHitPoints>4x</MaxHitPoints>
</statBases>
<costStuffCount>3.6x</costStuffCount>
<costList>
<Steel>3.6x</Steel>
</costList>
<fertility>4x</fertility>
<li>
<compClass>CompPowerTrader</compClass>
<basePowerConsumption>4x</basePowerConsumption>
<transmitsPower>true</transmitsPower>
</li>
</comps>
</ThingDef>
</ThingDefs>


Basically, I want to be able to multiply the value by the base item, the one that defines all of them if a value is missing.  This is an example, I know this won't work.  This will save me a LOT of time having to manually set each and every single item.
<basePowerConsumption>4x</basePowerConsumption> = 4 times the normal value, the normal value being 6, makes this 24.
Could also be <basePowerConsumption>=4*defName</basePowerConsumption>, to be 4 times more than the basePowerConsumption of that defName.  Starting with =, could indicate you are starting a script/variable (like spreadsheets) instead of defining a set amount.  I'd prefer this more as it would let me also do "=4*defName+6", assuming the defName I gave has a value of 10, it'd come out to be 46.  (4*10=40+6=46) and maybe even use algebra with it too if you felt like, to make advanced variable type things relating to multiple factors. 

E.G. : <basePowerConsumption>=((4*defName)+IF(ResearchProjectDef"defName"==true, 0, 6))-2</basePowerConsumption> So, 4 times the value in defName's basePowerConsumption, + 0 if ResearchProjectDef named "defName" research status is true, 6 if false, minus 2.

This is more of a suggestion at this point since I know it doesn't exist, but I wondered if something close to variables existed in Rimworld yet, if not, I'll move this particular thing over to suggestions (cutting it out of the topic).
Click to see my steam. I'm a lazy modder who takes long breaks and everyone seems to hate.

mrofa

1. Mask filest specify what part of texture will get overlay from stuff like wood with brown overlay and gold with yellow overlay.
You can see that in working on hospital beds where only the middle part changes color, and legs stay the same.
Black part is no overlay
Red part not sure, but currently gray scale is working, so from white(full overlay) to black you got various levels of overlay opacity(transparency).
4. <shaderType>Transparent, and no shadows in xml.
5. no
6. Can be done but with dll only, you could even specify how much power is used for specific plant growed :P
All i do is clutter all around.

RawCode

multiple) Masks used internally to merge multiple textures into single visual object, render may take any bitcode as special mark.
This allows to implement variable rendering layer per texture, setting priority of masked areas higher or lower then unmasked areas.
"Color" of masked area does not matter, how to treat it decided by render that may have custom implementation.

As stated above, if you don't like default render - implement your own, including your own storage of textures and other stuff.
Default render cannot be changed by XML.

5) Everything is possible, but, there is no such feature shipped with game by default, you will need custom object constructor that will read custom texture and modify path find matrix in desired way when object expected to be placed in world.

6) Enumerate all database entries on loading finish and modify values in way you like.

there is no way to make things you ask by XML since each XML line must have c# implementation and there is no such features in game by default.


Vas

Quote from: mrofa on July 21, 2015, 02:51:27 AM
1. Mask filest specify what part of texture will get overlay from stuff like wood with brown overlay and gold with yellow overlay.
You can see that in working on hospital beds where only the middle part changes color, and legs stay the same.
Black part is no overlay
Red part not sure, but currently gray scale is working, so from white(full overlay) to black you got various levels of overlay opacity(transparency).

I'm still having trouble with the masks.  I have mask files in my mod, but they don't do anything.  I extracted the textures from the game, and even tried renaming my masks to fit the same, still didn't work.  I'm going to go ahead and release as is, and fix the masks later.

Link: https://ludeon.com/forums/index.php?topic=14192.msg147792#msg147792
Click to see my steam. I'm a lazy modder who takes long breaks and everyone seems to hate.

mrofa

Main Texutre          Mask Texture
               

Grayscale on the mask texture represent stuff system overlay opacity from 100% white color to 0% black color.

Namings for mask depends on <graphicClass> you use. Green letters are ones required for mask.
Graphic_Single - ComfSeat_m.png
Graphic_Mutli - ComfySeat_frontm.png, ComfySeat_backm.png,ComfySeat_sidem.png

For mask to be used by to object, XML object <graphicData> need to have
<shaderType>CutoutComplex</shaderType>

This will only work if the object is using stuff system
All i do is clutter all around.

Vas

Quote from: mrofa on July 25, 2015, 02:38:30 AMGrayscale on the mask texture represent stuff system overlay opacity from 100% white color to 0% black color.

Then why does the bed have green and red?  What's red and green do on the mask?  I've never seen a mask using grey scale.  I always thought that was on the base item texture instead.
Click to see my steam. I'm a lazy modder who takes long breaks and everyone seems to hate.

Shinzy

in the case of bed red behaves like white on mrofa's textures
the green is for the prisoner/colonist/medical sheet colours
(It's likely coloured only to make it difficult for colourblind peopl- so the game can spot the difference)
same with the mineral deposits, you notice how only the textures with more than one colour combinations are used in gets multicoloured masks

Vas

Ah.  Would be nice though, if you could have two stuffs in an item and use two different colors for the mask to indicate where one stuff is colored in at and another for the second.  Suppose it might work better with two masks.  However that would get just as annoying as DX11.  :P  Oh well.  I'll update all my masks here tomorrow and finally get them working right.
Click to see my steam. I'm a lazy modder who takes long breaks and everyone seems to hate.