Jump to content

no-vision mode?


Recommended Posts

I don't think so, it would require changing the display calculations to exclude anywhere a dupe isn't currently present at.

There is a mod that will render everything really, really, dark any place that isn't actively lighted.  I don't remember the exact name but you can look for Perfect Darkness or Pitch Black and I think you should be able to find it.

Not exactly what you were looking for, but somewhat close in practical terms (especially if you were to automate all of your lights with dupe sensors).

Link to comment
Share on other sites

This is not as straightforward to implement as it sounds. How do you define what a dupe can see? Making the fog of war reveal reach only a tile or two is easy, but they can look down long corridors. What if there is liquid in the way, like in the oil biome, should they be able to look past that? You would have to calculate all lines of sight from every dupe, for every step they take. This is a lot of calculations and a lot of work. Would this even be playable? Not sure. But this is probably why there is no mod doing what you ask; it is hard to do, will drop the frame rate a lot, and might make the game unplayable.

Edit: Looking at the game code, fog of war is already not running every time slice, and it only has to calculate the cells in a radius from the dupe. I suppose it would only have to be re-done when a dupe digs a cell, or when mud or sand collapses. interesting idea, but I think it might require a super fast computer as the revealed map grows.

Link to comment
Share on other sites

6 minutes ago, FIXBUGFIXBUGFIX said:

There is no technical difficulty. And iIt doesn't require much CPU

The problem is, if you want to assign a job at the no-vision place, what should you do? Controlling your dupes move little by little? If you have only one dupe, OK. If you have three dupes, NOWAY.

If there is no technical difficulty, why not just go ahead and do it? I feel I might learn something from your implementation, so much so that I'd be willing to play 1000 cycles on it if the CPU load does not increase by much.

When I said it might not be playable, I was referring to the dupe management issue you point out, not the potential frame rate impact :)

Link to comment
Share on other sites

27 minutes ago, molsen234 said:

If there is no technical difficulty, why not just go ahead and do it? I feel I might learn something from your implementation, so much so that I'd be willing to play 1000 cycles on it if the CPU load does not increase by much.

When I said it might not be playable, I was referring to the dupe management issue you point out, not the potential frame rate impact :)

 

1 hour ago, molsen234 said:

This is not as straightforward to implement as it sounds. How do you define what a dupe can see? Making the fog of war reveal reach only a tile or two is easy, but they can look down long corridors. What if there is liquid in the way, like in the oil biome, should they be able to look past that? You would have to calculate all lines of sight from every dupe, for every step they take. This is a lot of calculations and a lot of work. Would this even be playable? Not sure. But this is probably why there is no mod doing what you ask; it is hard to do, will drop the frame rate a lot, and might make the game unplayable.

Edit: Looking at the game code, fog of war is already not running every time slice, and it only has to calculate the cells in a radius from the dupe. I suppose it would only have to be re-done when a dupe digs a cell, or when mud or sand collapses. interesting idea, but I think it might require a super fast computer as the revealed map grows.

I apologize I misunderstand your previous post, because it talked about lot of calculations, frame rate and fast computer. So I guessed you must be talking about frame rate.

 

Let's back to the mod itself.

You can get visable cells easily by using GetNonSolidCells. If you are not satisfied with the circular vision, see GetVisibleCells. If you want to control even more, study StationaryChoreRangeVisualizer

About FOG, see the the mod named light out or something similar. That mod updates Grid.Visible every sim200ms. If you play game at 3X speed, it means update FOG 15times/second. If you want to update FOG more frequently, ask help from SimEveryTick.

Link to comment
Share on other sites

1 minute ago, FIXBUGFIXBUGFIX said:

 

I apologize I misunderstand your previous post, because it talked about lot of calculations, frame rate and fast computer. So I guessed you must be talking about frame rate.

No need to apologize, my clarification was required. After reading my first reply it was not clear to me either :)

I had not looked at the StationaryChoreRangeVisualizer, but it actually confirms my point. It is used by the auto sweeper for example, to seek out debris to move. The instance is set with the bounding box of the building. This does not scale to a partially dug out map where a dupe might have a visible range of 100 tiles in some direction, rather than the less than 10 for auto sweepers and miners. Likewise for the Lights Out mod, it applies the very limited range of a lamp to the cell grid, and there are only a handful of tiles to possibly cast shadows.

The GetNonSolidCells does not give you visual cells. It performs a basic flood fill from the starting location, bounded by solid cells. Thus, if the cavity is non-convex, it will return cells that are not actually visible. Typical visibility checks that work the way you expect it to, will need to cast rays. There are generally two ways to achieve that, either sweep at fixed angular increments, or toe a bounding box (or bounding circle using Bresenham or similar, if visual range is essential). If you sweep at fixed angles, you need to trace distant intermediate elements back. This can be faster with some terrain types. Sweeping a bounding box means intersecting the line of sight to each bounding cell. The number of computations go up as second order of the bounding box size (side length), because the sight line gets longer, and the number of sight lines increase.

I am not saying it is impossible, I keep getting surprised at exactly how much faster computers are now, compared to when I was writing graphics software back in the early 1990's. All I am saying is that this is a lot more CPU hungry than the tiny bounding boxes used by lamps and auto sweepers. With a different structure representing the visibility, it is possible to achieve better performance. But that is far from trivial to implement in an already working game.

The fog of war is updated by writing a simple circular patch of revealed cells in the grid (in the normal game). There is provision for a cell refusing to reveal, for the POIs (and I suppose for the adjacent asteroids in the DLC map. I don't have the DLC so can't check what the code does.) It could just be me misunderstanding the code as I am having a quick look, but it seems that the cell from where the fog of war was extended (where the dupe stood) is marked as having extended FOW already, so the game doesn't constantly have to rewrite the FOW status in each cell when a dupe traverses that cell again. It's probably how I'd do it.

Come to think about it, I think the grid is limited to less than 400x400 in the default worldgen, so maybe the number of calculations is less dramatic than I imagine.

I will have a look at the lights out mod later, I don't have it installed currently (I'd like to play with it to see exactly what it does, that way I can better understand the code.) This is a very interesting conversation, and I have already learned new things. I hope I don't come across as argumentative, I am just getting excited by looking at code and thinking about what is possible. Thanks for the hints you provided, I really appreciate those!

Link to comment
Share on other sites

5 minutes ago, molsen234 said:

The GetNonSolidCells does not give you visual cells. It performs a basic flood fill from the starting location, bounded by solid cells. Thus, if the cavity is non-convex, it will return cells that are not actually visible

Damn I forget it. You are correct. Klei use GetNonSolidCells for tepilizer and space heater, which only have a very small range. And in this super small range, non-convex won't cause the problem.

But light2D and auto sweeper may give you some hint.

Link to comment
Share on other sites

4 hours ago, degr said:

I saw it, "lights out", but this mode just make screen dark, it is still possible to see surrounding.

You can configure lights out so the surround area is 0, and cannot be seen. I played this, so that the only light is what you have lit by lamps or ceiling lights - a huge challenge. It was fun.

Link to comment
Share on other sites

24 minutes ago, FIXBUGFIXBUGFIX said:

Damn I forget it. You are correct. Klei use GetNonSolidCells for tepilizer and space heater, which only have a very small range. And in this super small range, non-convex won't cause the problem.

But light2D and auto sweeper may give you some hint.

Yeah, but you are also right that the Lights Out mod does a lot more computation than I thought :)

Cairath is patching UpdateFogOfWar which the game is calling (via a whole train of methods) with a bounding box from GetVisibleExtents(), that defaults to the whole map (or asteroid in DLC).

 

But once I realized that the whole map is always less than 400x400, the CPU load seems a lot less dramatic. But at the same time, it seems a lot more tedious to implement the request in terms of all the different classes involved. Not difficult, but more involved.

Edit: The texture updater spawns threaded update tasks, so they are not actually performed on the Sim200ms() chain.

Link to comment
Share on other sites

6 hours ago, degr said:

I saw it, "lights out", but this mode just make screen dark, it is still possible to see surrounding.

I think you can configure it. At max settings it should be completely dark. BTW, it's visual only, dups get the debuff anyway.

Link to comment
Share on other sites

That's what I meant. The visual effect (darkness intensity - or rather lack of light intensity) and the debuff are unrelated, you can configure both independently. If you can see, that doesn't mean dups can see, and vice versa.

So, no matter what sort of challenge you want (you the player can't see around, but dups can, or you can still see the world but they don't, or both) the mod can do that.

Link to comment
Share on other sites

What I want to achieve - no vision for non-discovered zones, when you can't see more then 1 tile in front. No need to make only vision around dupe, just do not show surrounding until you dig it. That way game will stay bright enough and your mom will not be worry about your eyes, and in same time it would be more interesting with discover - when you dig up into water (or even lava) cavern, and your base become flooded little less then completely.

Link to comment
Share on other sites

8 hours ago, degr said:

What I want to achieve - no vision for non-discovered zones, when you can't see more then 1 tile in front. No need to make only vision around dupe, just do not show surrounding until you dig it. That way game will stay bright enough and your mom will not be worry about your eyes, and in same time it would be more interesting with discover - when you dig up into water (or even lava) cavern, and your base become flooded little less then completely.

Say you dig sideways into a larger open area, do you want to build ladders up until the ceiling before revealing it, or do you want that to be revealed because the dupe could look up and see it?

Edit: I made a test mod that lowers the FOW reveal around dupes to 3 tiles in each direction. It is interesting, because you cannot place dig or build orders on tiles that are not revealed. Since the dupes use guns to build and dig, they are not close enough to reveal more of the map, and you have to use the move tool to get them to the edge and reveal the next tiles.

I hesitate to upload it to steam, but I have attached the DLL here.

1) Go to your Documents and open the following: Klei\OxygenNotIncluded\mods\dev
2) Create a folder called ONI-NoVision
3) Put the file attached to this post in the ONI-NoVision folder
4) Start ONI and enable the ONI-NoVision mod
5) Start a new colony and suffer :)

Here is the source code:

using UnityEngine;
using Harmony;

namespace ONI_NoVisibilityMDO
{
    [HarmonyPatch(typeof(MinionConfig), "CreatePrefab")]
    class NoVisibilityMDO
    {
        static void Postfix(MinionConfig __instance, ref GameObject __result)
        {
            GridVisibility gridVisibility = __result.GetComponent<GridVisibility>();
            gridVisibility.radius = 4;
            gridVisibility.innerRadius = 4f;
        }
    }
}

 

When the map launches, the initial revealed circle is still there. I suggest you try to play for a while and see if this is really what you wanted. Then I'll try to figure a way to remove that initial reveal as well. Personally I got tired of moving dupes to the edge very quickly. The reveal radius for a dupe can be increased a bit more, but it reveals in all directions, so when they build ladders you get quite a wide column of known terrain already. I am looking to see if there is a smart way to only reveal in the direction they are building, but it doesn't look promising.

Let me know how this goes.

ONI-NoVision.dll

Link to comment
Share on other sites

On 12/31/2020 at 5:24 PM, FIXBUGFIXBUGFIX said:

But light2D and auto sweeper may give you some hint.

Mostly by accident, I discovered that MinionConfig carries around an instance of gridVisibility including radius settings. Thought you might find it entertaining how simple the solution is, after all my ranting about CPU load :D

Link to comment
Share on other sites

Ehh... I was just browsing the Steam workshop for something else, and came across this mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2257966028 (named Sight Not Included)

It claims to do exactly what you ask, and may be a lot better than the simple hack I made this far. Please do check it out!

 

Edit: I looked at the code, it patches the GridVisibility class directly instead of going via the MinionConfig like mine does. MinionConfig calls GridVisibility, so the difference is very small. They set the radius to 5, mine sets it to 4. 5 indeed helps the dupes reveal a bit more of the map, and you don't have to move the dupe manually as often, but at the same time you see more of the map of course.

Maybe making the exact range adjustable would be good. Then even people that want to reveal more than the default can use the same mod. I'll think about it, and maybe talk to the owner of the other mod.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...