1
DF Suggestions / Swimming ideas
« on: January 25, 2009, 04:27:42 am »
At the moment, water completely cuts off access to areas if it's deep enough, we need a water pathing system.
First of all, water is dangerous and pathing through water is complex, most likely eating up more cpu cycles. There should be a toggle option in the 'o'rders like "Dwarves can swim/Dwarves stay out of water."
Now on to how I think the pathing would work. There's several factors: how much air the dwarf has, how much energy it has to swim, and air pockets. When a dwarf has to path through water, the pathfinding system would first make a direct path to the job site, and then map out air pockets on the way there and turning them into "checkpoints." The dwarves would traverse between these checkpoints and stop for air or to rest on the way to the job site, without canceling their current task. This would work something like this: When a dwarf gets low on air/energy it would start to get nervous and would decide if it can make it to the checkpoint or if it should turn back. The dwarves would only get nervous when they have just enough air to go back. A nervous dwarf would go back to the previous air pocket, cancel the job, and path out of the water to get to whatever else they need to be doing. If a dwarf thinks it has enough air to get to the next checkpoint when it's nervous, it would go ahead and go on to the next checkpoint. The dwarf would repeat the process until it gets to the job site or gives up at a certain checkpoint.
Novice swimmers should be able to know if a part they path through will make them panic and refuse to path through it. If there was a sudden change in water level or anything else that interferes with it's ability to safely path somewhere, it should cancel the current task and attempt to find the nearest air-pocket. IOW the water pathing system should adapt to changes in the environment in a similar way to the land pathing system when a door that is required to access an area is suddenly locked.
Also, I think certain jobs should actually be able to be completed under water. I can't imagine why the hell you'd want to complete a workshop job underwater rather than building a workshop on the surface, but what game are we playing again? DWARF FORTRESS! So, ahem, I'll go into that. Some jobs, like forging, definitely can't be done underwater so this could be a problem. IIRC all items that can be created are already in the RAWS so there could be a [DOABLE_WATER] token to define workshop jobs that can be completed under water. Like when swimming to the next checkpoint, dwarves could get nervous while attempting an underwater job, and if they didn't have enough air to complete it, would give up. Besides workshop jobs, I'm certain most other tasks like construction and deconstruction could easily be accomplished underwater, with the possible exception of mining/carving stone, and woodcutting, due to the friction underwater. WHY do you have underwater trees anyway?!
Currently a way to train swimming isn't even officially implemented. I'm not entirely sure how it could, but I'm thinking of something like designating a meeting hall over water. Your dwarves would swim around in it in their spare time. If the water level is higher than 4 though, non-swimmers would refuse to get in as they'd panic. And then there's the possibility of a dwarf absolutely hating water, but I won't get into that.
First of all, water is dangerous and pathing through water is complex, most likely eating up more cpu cycles. There should be a toggle option in the 'o'rders like "Dwarves can swim/Dwarves stay out of water."
Now on to how I think the pathing would work. There's several factors: how much air the dwarf has, how much energy it has to swim, and air pockets. When a dwarf has to path through water, the pathfinding system would first make a direct path to the job site, and then map out air pockets on the way there and turning them into "checkpoints." The dwarves would traverse between these checkpoints and stop for air or to rest on the way to the job site, without canceling their current task. This would work something like this: When a dwarf gets low on air/energy it would start to get nervous and would decide if it can make it to the checkpoint or if it should turn back. The dwarves would only get nervous when they have just enough air to go back. A nervous dwarf would go back to the previous air pocket, cancel the job, and path out of the water to get to whatever else they need to be doing. If a dwarf thinks it has enough air to get to the next checkpoint when it's nervous, it would go ahead and go on to the next checkpoint. The dwarf would repeat the process until it gets to the job site or gives up at a certain checkpoint.
Novice swimmers should be able to know if a part they path through will make them panic and refuse to path through it. If there was a sudden change in water level or anything else that interferes with it's ability to safely path somewhere, it should cancel the current task and attempt to find the nearest air-pocket. IOW the water pathing system should adapt to changes in the environment in a similar way to the land pathing system when a door that is required to access an area is suddenly locked.
Also, I think certain jobs should actually be able to be completed under water. I can't imagine why the hell you'd want to complete a workshop job underwater rather than building a workshop on the surface, but what game are we playing again? DWARF FORTRESS! So, ahem, I'll go into that. Some jobs, like forging, definitely can't be done underwater so this could be a problem. IIRC all items that can be created are already in the RAWS so there could be a [DOABLE_WATER] token to define workshop jobs that can be completed under water. Like when swimming to the next checkpoint, dwarves could get nervous while attempting an underwater job, and if they didn't have enough air to complete it, would give up. Besides workshop jobs, I'm certain most other tasks like construction and deconstruction could easily be accomplished underwater, with the possible exception of mining/carving stone, and woodcutting, due to the friction underwater. WHY do you have underwater trees anyway?!
Currently a way to train swimming isn't even officially implemented. I'm not entirely sure how it could, but I'm thinking of something like designating a meeting hall over water. Your dwarves would swim around in it in their spare time. If the water level is higher than 4 though, non-swimmers would refuse to get in as they'd panic. And then there's the possibility of a dwarf absolutely hating water, but I won't get into that.