[A17] [RELEASED] Real Fog of War (v1.0.0 - 29-07-2017)

Started by Luka Kama, December 31, 2016, 11:03:55 AM

Previous topic - Next topic

Luka Kama


Announce:
The mod has been released: LINK TO RELEASE TOPIC

Description:

The Real Fog of War mod aims to add a new depth to RimWorld, adding a new exploration phase and increasing the strategy difficulty.

Features

  • The map is initially unrevealed and must be explored.
  • Both player's and AI's humans, animals, mechanoids and some objects have and are affected by a Field of View, shared among faction components.
  • Only things revealed by a Field of View can be attacked.
  • Field of View of humans, animals and mechanoids is adjusted to sight attribute and are affected by darkness (mechanoids are immune) and weather.
  • Animals participate to Faction Fog of War only if trained for release and with a master set.
  • Bionic eyes reduce the darkness debuff (one by half, two completely).
  • Standing and attacking humans, animals and mechanoids have a slightly increased Field of View as they "peek" in nearby spaces.
  • When attacking and not moving, the sight range is adjusted to weapon range over time (time based on weapon warm-up time and range).
  • Sleeping humans and animals have a base Field of View reduced to 20%.
  • At rough and lower difficulties player's automatic turrets extend the Field of View in their target area.
  • Added objects: surveillances cameras and watch towers.

Needs

  • Volunteers to test the mod.
  • Feedbacks & suggestions.

Compatibility
This mod override:

  • EnvironmentInspectDrawer.ShouldShow: to hide environment attribute for unrevealed areas.
  • GenMapUI.DrawThingLabel: to prevent showing labels of not visibile objects.
  • HaulAIUtility.HaulToStorageJob: to prevent hauling of not discovered objects.
  • InstallationDesignatorDatabase.NewDesignatorFor: to use a patched Designator_Install, which prevents the installations of things in non discovered areas.
  • LetterStack.ReceiveLetter and Messages.Message: To pin the arrow of the messages source to the initial location, in order to not follow raiders or pawns when moving in non discovered areas.
  • MouseoverReadout.MouseoverReadoutOnGUI: to prevent showing info of non discovered or seen objects.
  • Pawn.DrawPawnGUIOverlay: to hide the name of not seen pawns.
  • SectionLayer_ThingsGeneral.TakePrintFrom and SectionLayer_ThingsPowerGrid.TakePrintFrom: to hide not visible objects.
  • Selector.Select: to prevent the selection of not visible objects.
  • Verb.CanHitCellFromCellIgnoringRange: to apply the Fog of War in the targeting system.
  • WorkGiver_DoBill.TryFindBestBillIngredients: to prevent the using of non visible objects for bills.


Author/Mod Team
Myself (Luca De Petrillo)


Download

How to install:

  • Unzip the contents and place them in your RimWorld/Mods folder.
  • Activate the mod in the mod menu in the game.

Sources are available on GitHub.


[attachment deleted by admin due to age]

O Negative

Looks like you've already got a pretty nice foundation! :D

Having an (optional) fog of war in the game would be absolutely fantastic :)

Thirite

Looks awesome. Do you know if it will work with existing save games?

Luka Kama

#3
Yes, it works with existing save games, but in such cases the mod reset the map fog, so you will need to re-explore it.

Luka Kama

Alpha 0.0.3 for A16 - build 201701032114

Change log:

  • Performance improvements.
  • Expeditions and caravan compatible.
  • Player humans cannot attack unseen places.

Download here

Thirite

Holy cow it works well. Damn good job. I just get this error when I load a savegame- it stops spamming when I unpause the game. I have "pause on load" enabled, maybe that's causing it. (It doesn't start spamming again if I pause the game though).


Luka Kama

Quote from: Thirite on January 05, 2017, 02:16:39 AM
Holy cow it works well. Damn good job. I just get this error when I load a savegame- it stops spamming when I unpause the game. I have "pause on load" enabled, maybe that's causing it. (It doesn't start spamming again if I pause the game though).



Thanks for the report.

The bug should affects only saves made without the mod active (it has been introduced with changes made in v0.0.3). It will be fixed in next version.

Also, be aware that v0.0.3 broke the hunting system: pawns aren't able to find a valid shoot position to attack an animal when it is out of all Field of View. I'm fixing it for the next version (it will be released today).

Thirite

Oh, so that's what was causing the constant failed job giving. Thought it might have been one of my mods. You certainly are on top of things, I'll give you that. I'll gladly test the new version. One thing I'd uggest if it's not already the case: turrets shouldn't provide vision unless they're currently powered.

Luka Kama

Quote from: Thirite on January 05, 2017, 02:45:49 PM
One thing I'd uggest if it's not already the case: turrets shouldn't provide vision unless they're currently powered.

Just tested and working the way you are saying: if unpowered (due not connected, switched off, with no energy) they don't provide vision (same for lamps). If it doesn't work this way in your game, it could be a mod conflict. If possible try with a clean game and let me know.

Luka Kama

#9
Alpha 0.0.4 for A16 - build 201701052201

Change log:

  • Enemy humans, animals and mechanoids now are affected by their own and faction Field of View (this could be CPU intensive, I will rollback it if necessary).
  • Humans and Animals suffer a reduced Field of View in dark places, like roofed areas or at night time; A bionic eye reduces the debuff, two deny it.
  • Tried to patch most of the places where things could be shown over the uncertain veil.
  • Things non belonging to the player (resources, walls, rocks, others) are hidden until seen one time by the player. Once seen, they remain visible.
  • Only humans, animals, automatic turrets and glowing things provide a Field of View.
  • Fixed the error when loading a save game made without the mod.
  • Fixed a problem preventing the hunt to work.
  • Other little improvements.

Update info:
This version uses an improved logic to show or hide things. Due to this, saves with an old version could not show walls until "seen" again by a player's colonist or animal.

Download here

Thirite

I've been using it for a while now on my current game. I haven't noticed any errors yet. Hooooly cow this makes the game more difficult. Raids become a lot more of a crapshoot when you can't tell exactly where they're coming from until they're in range. One thing I noticed- my colonists can use a sniper rifle to target someone out of their FOV because the enemy is within range of the rifle's range. I'd suggest factoring in the weapon range to the FOV when drafted to simulate the use of the scope.

Luka Kama

Beta 0.1.0 for A16 - build 201701061820

For this release I spent the day trying to extract the maximum performance from the code (I'm not a .Net or a game developer, so it is highly probable that the code is not well optimized).
Anyway, I was able to get decent performance for pure FoV calculation (almost no FPS drop when watching a corner at maximum zoom).
Instead, I get a constant FPS drop at minimum zoom watching the colony auto-built using the developer tools (all assets, open-space, a lot of fog redraw), so it should be related to the fog rendering (I used as base code the vanilla fog rendering, applying a 50% alpha for revealed but unseen cells) and object hiding.

Unluckily, on 9th I will return to work and I will not have anymore the time to continue to develop the mod at these levels, so I'm stopping any performance and graphic tuning (as they are the most time consuming tasks), and I will use these remaining days to fix bugs and apply some re-balancing.
Also, probably tomorrow I will release the mod on Steam, as it is almost feature complete and stable.


Change log:

  • Fixed some graphics issues in the fog rendering (unrevealed fog wasn't soft)
  • If not roofed, weather affect the Field of View (the effect is the half of the standard accuracy modifier)
  • The darkness modifier has been increased (from -20% to -30%), and now is adjusted to the position Lit value
  • Code and performance improvements.

Download here

Luka Kama

Quote from: Thirite on January 06, 2017, 12:20:43 PM
I've been using it for a while now on my current game. I haven't noticed any errors yet. Hooooly cow this makes the game more difficult. Raids become a lot more of a crapshoot when you can't tell exactly where they're coming from until they're in range. One thing I noticed- my colonists can use a sniper rifle to target someone out of their FOV because the enemy is within range of the rifle's range. I'd suggest factoring in the weapon range to the FOV when drafted to simulate the use of the scope.

Actually, colonists (and enemies) can shoot something if it is in their or in an ally FoV, so if you were able to see the target on the map, it was normal (this way, it is possible to scout with a colonist while firing with a sniper using another colonist).
Also, currently there are some glitch that allows pawns to fire to a target that has a nearby cell visible, while the target itself is out of the faction FoV. It is hard to fix and it should be caused (not sure) by the vanilla code that consider nearby cells as shootable. However it should happens only for one distance cell.

Instead, if your colonist was able to shoot to something really far away FoV margins, then it could be a bug (or an "un-patched" vanilla code), but I need a savegame to track it. If it happens again, please make a save and send it to me.

Thirite

Hmm, I noticed this "one square away" screw up with gardening. My colonists would plant-cut one tile around a designated growing area. So I think there's something wrong in the vanilla code.

Luka Kama

Beta 0.1.1 for A16 - build 201701071719
Change log:

  • Increased darkness debuff.
  • When attacking and not moving, the sight is adjusted to weapon range over time (4 time the warmup time).
  • Fixed a bug in the initial map revealing, which didn't show walls and mountains.
  • Other possible performance optimizations.

Steam page
Zip to manually install here