[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

Beta 0.1.10
Change log:

  • Performance optimizations (the Field of View is calculated in ~30% less time).
  • Fixed some bugs.

Steam page
Zip to manually install here

Luka Kama

Quote from: ArthoriusBalen on January 24, 2017, 09:52:42 PM
how this mod work with Realistic Darkness and Enlighten? Any compatibility problem i should worry about? Best mod ever, congrets, cant play without it any more!  ;D

I took a look at the mod, and they seem compatible.

Luka Kama

Beta 0.1.11

This affect only new adopters of the mod, I didn't noticed it was broken.

Change log:

  • Fixed a bug affecting old saves made without the mod.

Steam page
Zip to manually install here

Grizzlyadamz

How does this effect sieges?

And would it be as unbalanced/incompatible with Combat Realism as I'd assume? (very long-range weapons)

Techgenius

This mod sounds awesome, but lacks something important, maybe disabling raid messages and the like so we can get caught by surprise, offguard, like it would be irl

zzz1000

#50
Less shortsighted pawns with combatrealism(if they are) is not "imbalance" but in the spirit of general CR design, working right. It can be CR  unbalanced because of too short mod view distance, CR firefights have  different scale than vanilla.

But so far mod distance feels ok, maybe 30% increase can be better. Or even better "base view distance multiplier" and "overlay opacity"(for explored but not visible shade intensity) cosmetic option. Something, maybe Hugs Lib provide possibility for "mod options". Or just some xml
I personally never appreciate games shortsightedness (even if it needed for gameplay  not be able to see person standing in the middle of road twenty meters away never make sense )

Maybe it be intresting to experiment with obstacles(maybe reduction based on stoping chance can create intresting results) so jungle and desert have different feel. If it not perfomace hungry
Another thing is lighted tiles must use day distance rules if you understand what I mean ( http://imgur.com/a/HrEsJ )

One sort of incombatibles I noticed is manned turrets are seems like shoot to "hiden" targets(targets at the fog), I suppose it's because RFoW do not understand such animal so do nothing with them or maybe it something else
Another thing is I have siege(and this was scary) but shortly after arrival they are "started assault colony"(like when you start killing them) instead of making siege camp, It can be related or not to that mod because I have no idea what they did in the fog and my game have sometimes  troubles with sieges even without fog, I find their meals not far from map border but nothing else and do not know what happened(can mod prevent placing building blueprints in the fog for them?). need some transparent fog debug mode.

Other than that In my short test all works well, looks like robust system you have(intresting effect is CR binoculars work as binoculars :D) And have intresting feel
I only worry about performance or possible unexpected problems because of my overmoded install. But I definitely will play it more on separate save


Luka Kama

Beta 0.1.12

Change log:

  • Environmental info are hidden when pointing an unknown area (but info overlay radius will includes unknown cells when pointing the know area perimeter... the vanilla code isn't easy to patch... this is the best the mod can do)
  • More performance improvements

Steam page
Zip to manually install here

Luka Kama

Quote from: zzz1000 on February 04, 2017, 07:26:23 AM
But so far mod distance feels ok, maybe 30% increase can be better. Or even better "base view distance multiplier" and "overlay opacity"(for explored but not visible shade intensity) cosmetic option. Something, maybe Hugs Lib provide possibility for "mod options". Or just some xml
I personally never appreciate games shortsightedness (even if it needed for gameplay  not be able to see person standing in the middle of road twenty meters away never make sense )

Maybe it be intresting to experiment with obstacles(maybe reduction based on stoping chance can create intresting results) so jungle and desert have different feel. If it not perfomace hungry
Another thing is lighted tiles must use day distance rules if you understand what I mean ( http://imgur.com/a/HrEsJ )

Actually, greater is the view range, heavier is the performance impact (it grows exponentially), so the view range "cut off" is more a performance constraint, as actually the mod is already CPU hungry with its simple FoV algorithm :( .

Instead, a way to customize some graphic options is already in my to-do list (I have some "link to an option" placeholder in the code here and there).


Quote from: zzz1000 on February 04, 2017, 07:26:23 AM
One sort of incombatibles I noticed is manned turrets are seems like shoot to "hiden" targets(targets at the fog), I suppose it's because RFoW do not understand such animal so do nothing with them or maybe it something else

It is an intended behavior: on lower game difficulties, turrets participate to the player FoW, but on higher difficulties their field of view is kept private (the turret see and can acquire targets in its view range, but the player can't see it).


Quote from: zzz1000 on February 04, 2017, 07:26:23 AM
Another thing is I have siege(and this was scary) but shortly after arrival they are "started assault colony"(like when you start killing them) instead of making siege camp, It can be related or not to that mod because I have no idea what they did in the fog and my game have sometimes  troubles with sieges even without fog, I find their meals not far from map border but nothing else and do not know what happened(can mod prevent placing building blueprints in the fog for them?). need some transparent fog debug mode.

Thanks for the report, I just identified and fixed the bug. I will release a new update with the fix ASAP.

Luka Kama

Beta 0.1.13

Change log:

  • Fixed a bug causing sieges to not be able to place constructions in undiscovered areas and immediately assaulting the player's colony.
  • Fixed a bug preventing designators to be patched (this is why Allows Tools mod was working...)
  • [Compatibility] Handled Allows Tools designators injecting method.

Steam page
Zip to manually install here

Luka Kama

#54
Quote from: Luka Kama on February 12, 2017, 10:16:46 AM
Quote from: zzz1000 on February 04, 2017, 07:26:23 AM
One sort of incombatibles I noticed is manned turrets are seems like shoot to "hiden" targets(targets at the fog), I suppose it's because RFoW do not understand such animal so do nothing with them or maybe it something else

It is an intended behavior: on lower game difficulties, turrets participate to the player FoW, but on higher difficulties their field of view is kept private (the turret see and can acquire targets in its view range, but the player can't see it).

Sorry, I missed the "manned" word... I need to check how manned turrets are handled by CR mod to see if there is a way to distinguish them from automatic ones. It would be needed also to apply the same view range increase mechanic used for long range weapons.

Luka Kama

Well... it seems that exactly today skyarkhangel decided to dismiss the Combat Realism mod (the mod's thread has been closed and its GitHub project has been inhibited, I don't know if simply hidden or completely removed), so I can't access the mod to perform needed checks, sorry.

NoImageAvailable

Quote from: Luka Kama on February 13, 2017, 08:02:36 AM
Quote from: Luka Kama on February 12, 2017, 10:16:46 AM
Quote from: zzz1000 on February 04, 2017, 07:26:23 AM
One sort of incombatibles I noticed is manned turrets are seems like shoot to "hiden" targets(targets at the fog), I suppose it's because RFoW do not understand such animal so do nothing with them or maybe it something else

It is an intended behavior: on lower game difficulties, turrets participate to the player FoW, but on higher difficulties their field of view is kept private (the turret see and can acquire targets in its view range, but the player can't see it).

Sorry, I missed the "manned" word... I need to check how manned turrets are handled by CR mod to see if there is a way to distinguish them from automatic ones. It would be needed also to apply the same view range increase mechanic used for long range weapons.

You can distinguish manned turrets by checking for compMannable.

Very interesting project you have going. Have you ever considered going with more of a Wargame approach to visibility? Something like giving pawns a vision stat and then adding a visibility stat to Things and comparing those gives you the distance at which something can be spotted. The advantages would be that visibility could be modified by things such as worn clothing and environment (e.g. ghillie suit in the woods), it would produce more natural results (you can spot an elephant from further away than a squirrel) and might save on processing power (don't know where the CPU hogs are in your system).
"The power of friendship destroyed the jellyfish."

Luka Kama

Beta 0.1.14

Change log:

  • More performance improvements.
  • Applied a possible fix for NullReferenceException when patching designators.
  • Thing rotation is now considered when updating the visibility versus the player visible areas (should mainly affect centipedes)

Steam page
Zip to manually install here

Luka Kama

#58
Quote from: NoImageAvailable on February 18, 2017, 06:42:36 AM
You can distinguish manned turrets by checking for compMannable.

Right, the mod already perform some checks on compMannable, but it is only used to exclude mortars from FoW contribution. I will improve the mod to consider it for both the "can fire" logic and colonist vision contribution. I will use "More Vanilla Turrets" as test mod (its manned turrets should work like CR ones).


Quote from: NoImageAvailable on February 18, 2017, 06:42:36 AM
Very interesting project you have going. Have you ever considered going with more of a Wargame approach to visibility? Something like giving pawns a vision stat and then adding a visibility stat to Things and comparing those gives you the distance at which something can be spotted. The advantages would be that visibility could be modified by things such as worn clothing and environment (e.g. ghillie suit in the woods), it would produce more natural results (you can spot an elephant from further away than a squirrel) and might save on processing power (don't know where the CPU hogs are in your system).

It is a nice approach, but I have the fear that it would require a lot of computation power (and/or would requires a lot of work and optimizations): the visibility should be calculated every needed time between every faction components VS every non faction ones (every colonist vs every animal, then every enemy, etc) in order to check the nearest visibile one.
The "non player" vision could be computed only when needed, like only when a pirate look for a target in its weapon range, but the player vision should be calculated constantly to keep graphics and interactions updated.


At the moment, the mod keeps a simple visibility grid for each faction, tracking which cell on the map can or can't be seen by them, updating it when a FoW participant moves, spawn, de-spawn or one of its relevant stats change, by calculating its field of view.
This update, for a single FoW participant with a vision radius of 32 cells, on my PC is computed in about 0.2ms, so you must multiply it for every updating FoW participant in every game map (every colonist, pirate, etc). Also, the time required to calculate the field of view is proportional to the vision range and depends also on the distribution of view-blocking elements in the vision area.
This means that once there are more than about 80 concurrently updating FoW participant in the game world (well... much less considering the time required by the vanilla game to perform its own calculations), a single game update will exceeds 16.67ms to be computed and game FPS will starts to drop below 60 (at 33.34ms, FPS drops to 30, end so on..).


Also, when a player's faction visibility cell change, from visible to not or vice-versa, the mod updates all non player's thing in that cell to be shown or hidden. Again, when a non player's thing moves, its visibility is updated checking its occupied region vs the player's faction visibility grid. (This phase takes very little CPU time)


Then, every "can hit", "can be seen" or "has been discovered" calculation is performed versus this grids, and are almost instantly computed.

The only exception is the fire position lookup, calculated when something attacks something else out of his range, which requires a field of view calculation for every cell around the target, but it is done only when needed, so it doesn't have heavy CPU impacts.

NoImageAvailable

#59
I think you overestimate the amount of processing power required for this.

Let's assume for the sake of argument that the vision and visibility stats are set up such that the maximum distance you can spot something is vision - visibility. Your code might look something like this:

float distance = (pawn1.Position - pawn2.Position).Length(); // Euclidean distance is very easy to calculate
if(pawn1.vision - pawn2.visibility <= distance)
{
if(pawn1.HasLineOfSightTo(pawn2)) // You can use your cached data here
{
cachedListOfVisiblePawns.Add(pawn2);
if(pawn2.vision - pawn1.visibility <= distance)
{
cachedListOfVisiblePawns.Add(pawn1) // Since you already checked positively for LOS you can save CPU cycles by calculating the other way round immediately
}
RegisterForNoLOSCheck(pawn1, pawn2) // We already know whether pawn2 can see pawn1 and don't need to calculate that anymore
}
}
else
{
if(pawn2.vision - pawn1.visibility <= distance)
{
... // Since we already calculated distance we can save a few cycles by running the LOS check for pawn2->pawn1 straight away
}
}


The only real addition here would be calculating the stats and the euclidean distance between two pawns, neither of which is very CPU intensive. For terrain features like trees and walls you could just skip the calculation entirely and assume they're visible from any distance.
"The power of friendship destroyed the jellyfish."