Idea: Avoid Zone

Started by InfinityKage, January 15, 2015, 07:23:23 PM

Previous topic - Next topic

InfinityKage

Basically just add the ability to designate a zone where your colonist will not go.

ZehAngrySwede

This would be quite handy!

Idlemind79

+1
So simple it's genius. I really like the idea. I hope it actually gets built into the game at some point, it's a quintessential concept in a game like this.

-zone out cryptochambers so your colonists don't happen to be passing through them when a squirrel goes nuts (hah)
-zone out popular raid arrival maps so your colonists stay clear of that area
-zone out passage ways to block off sections off the map from your colonists
-zone out crops if you want them left alone but don't want to delete the growing zone and add it back in later or fiddle with priorities
-zone out a block of resources so you have a reserve that won't be touched (forbid does this already though)
-temporarily zone out areas during fights to prevent undrafted colonists walking through a fire fight (running up to an enemy to repair something for example).

Maybe the path finding is setup though that it can't distinguish between colonists and npc's? Obviously raiders and visitors aren't going to care about your avoid zones.

Gaesatae

Last night I couldn't sleep so I was messing around with this idea and here it is what I found, for anyone is interested in trying.

You can't modify the pathfinder, so the only workaround was to make the pathfinder think that a pawn can't reach a cell marked as avoid. Which thing ingame behaves like that? Doors! So the general idea is to:

-Create a building with the Etype and code of a door. It won't be edifice nor selectable and give it an empty texture.
-In the new building code, reduce the timetoopen so the pawn won't even know there is a door there, change the check conditions for blockspawn to faction.ofcolony and for willopenfor to !blockspawn.
-Create a new designator, grid and layer to spawn, despawn and save the avoid zone cells.
-Make sure the spawned buildings wont tick.

I gave it a rushed try and, in theory, it works. But I'm sure I missed something along the way because I was getting some weird exceptions on building spawn related to the room/region creation.

Right now I won't continue working on this idea because I have other priorities. If you look into it and find a way to make it work, please let me know  :)

Idlemind79

You're doing gods work young person.

Quote from: Gaesatae on January 18, 2015, 10:42:29 AM
Last night I couldn't sleep so I was messing around with this idea and here it is what I found, for anyone is interested in trying.

You can't modify the pathfinder, so the only workaround was to make the pathfinder think that a pawn can't reach a cell marked as avoid. Which thing ingame behaves like that? Doors! So the general idea is to:

-Create a building with the Etype and code of a door. It won't be edifice nor selectable and give it an empty texture.
-In the new building code, reduce the timetoopen so the pawn won't even know there is a door there, change the check conditions for blockspawn to faction.ofcolony and for willopenfor to !blockspawn.
-Create a new designator, grid and layer to spawn, despawn and save the avoid zone cells.
-Make sure the spawned buildings wont tick.

I gave it a rushed try and, in theory, it works. But I'm sure I missed something along the way because I was getting some weird exceptions on building spawn related to the room/region creation.

Right now I won't continue working on this idea because I have other priorities. If you look into it and find a way to make it work, please let me know  :)

Khaosius789

+1, tired of colonists wandering into the sieging enemy.

InfinityKage


InfinityKage

Quote from: Idlemind79 on January 19, 2015, 09:45:00 PM
You're doing gods work young person.

Quote from: Gaesatae on January 18, 2015, 10:42:29 AM
Last night I couldn't sleep so I was messing around with this idea and here it is what I found, for anyone is interested in trying.

You can't modify the pathfinder, so the only workaround was to make the pathfinder think that a pawn can't reach a cell marked as avoid. Which thing ingame behaves like that? Doors! So the general idea is to:

-Create a building with the Etype and code of a door. It won't be edifice nor selectable and give it an empty texture.
-In the new building code, reduce the timetoopen so the pawn won't even know there is a door there, change the check conditions for blockspawn to faction.ofcolony and for willopenfor to !blockspawn.
-Create a new designator, grid and layer to spawn, despawn and save the avoid zone cells.
-Make sure the spawned buildings wont tick.

I gave it a rushed try and, in theory, it works. But I'm sure I missed something along the way because I was getting some weird exceptions on building spawn related to the room/region creation.

Right now I won't continue working on this idea because I have other priorities. If you look into it and find a way to make it work, please let me know  :)

I 2nd the notion.

DaggettBeaver

An avoid-zone would be really great for the game. Especially since you can maybe go even further and install temporary avoid zones between your colonists and the target they aim for so your colonists don't run into your crossfire all the time... may be hard to code, but that would probably be one of the most-wanted features at the moment...

skullywag

hmm new designator class, sets path cost astrononically high for all selected cells for colonist faction only....would that work....hmm...ill have a nose tonight.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

JoeysLucky22

Quote from: skullywag on January 26, 2015, 03:19:31 AM
hmm new designator class, sets path cost astrononically high for all selected cells for colonist faction only....would that work....hmm...ill have a nose tonight.

I believe in you skullywag! A "fobridden zone" is something I'd love to see added / modded into this game

Gaesatae

Quote from: skullywag on January 26, 2015, 03:19:31 AM
hmm new designator class, sets path cost astrononically high for all selected cells for colonist faction only....would that work....hmm...ill have a nose tonight.
Interesting... I didn't thought that as an option. ¿How is it going?

Sion

Quote from: Gaesatae on January 18, 2015, 10:42:29 AM
Last night I couldn't sleep so I was messing around with this idea and here it is what I found, for anyone is interested in trying.

You can't modify the pathfinder, so the only workaround was to make the pathfinder think that a pawn can't reach a cell marked as avoid. Which thing ingame behaves like that? Doors! So the general idea is to:

-Create a building with the Etype and code of a door. It won't be edifice nor selectable and give it an empty texture.
-In the new building code, reduce the timetoopen so the pawn won't even know there is a door there, change the check conditions for blockspawn to faction.ofcolony and for willopenfor to !blockspawn.
-Create a new designator, grid and layer to spawn, despawn and save the avoid zone cells.
-Make sure the spawned buildings wont tick.

I gave it a rushed try and, in theory, it works. But I'm sure I missed something along the way because I was getting some weird exceptions on building spawn related to the room/region creation.

Right now I won't continue working on this idea because I have other priorities. If you look into it and find a way to make it work, please let me know  :)

Would it be possible to "build"/"spawn in" an invisible square of locked doors around the forbidden area?
Maybe only locked for colonists, oh... and it also can't be allowed to construct a roof.
So many ideas... so little time...
Silence is the worst answer.

Arctic Wolf

Path cost probably wouldnt work sinvce if you click inside the zone it will go there since its the only possible way.

I might have a look at this, sounds useful enough :P

Sion

Quote from: Arctic Wolf on February 03, 2015, 06:48:35 PM
... if you click inside the zone it will go there since its the only possible way...

Not if the doors are locked, right?
So many ideas... so little time...
Silence is the worst answer.