Frustrating AI/behaviour and micro management

Started by Leroy76, July 31, 2016, 12:31:58 PM

Previous topic - Next topic

milon

I understand that most of you are coming from a "common sense" perspective, and I can appreciate that.

But have any of you ever coded AI?  Personally, the closest I've come is A* pathfinding, and my implementation was fairly CPU-heavy for one agent to trace one path.

RimWorld has dozens of AI agents (colonists, visitors, traders, raiders, animals, mechs...) all pathfinding simultaneously as well as doing other AI-intensive operations - job searches, locating materials, fulfilling needs, etc, etc.  RimWorld's AI is already quite impressive and streamlined.  I haven't seen the code, of course, but I doubt there's much more room for improvement (unless you want the minimum system requirements to be cutting edge PC's from 2020).

Naeem

I understand were you coming from Milon or Milion sorry I didnt see your name properly. But sometimes the survivors just act so damn stupid. It makes me mad in some sense. But I know more coding will mean more work and more lag. But cant they be some way of fixing this [NON EXPENSIVELY?]

eronaile

#17
milon, while I have not personally coded AI, I assume comparison with other similar simulations will reveal quickly enough that yes, there is still quite a bit of improvement possible without straining hardware too much.
What was talked about above can be implemented by heuristic approaches that won't be perfect in a mathematical sense but pretty much indistinguishable from any player's POV.
We are not talking about whole new action/reaction patterns here. It's mostly about smoothing the edges. Hauling is a good example, it just needs some additional checks (check area nearby / check time requirements). Other stuff like direct orders should just get some area effect so that if there are identical tasks (like fires, plants to be removed, floor to be smoothed) in the tiles next to the targeted one, pawn continues with those.
The only thing requiring actual changes in movement decision by AI would be to improve pawns so they 'see' nearby hauling or other tasks more intelligently and do not go far far away before finishing identical tasks nearby. And since distance measuring is already in place it should be very simple to make them chose nearest first.


Havan_IronOak

Quote from: milon on August 02, 2016, 02:43:17 PM
I understand that most of you are coming from a "common sense" perspective, and I can appreciate that.

But have any of you ever coded AI?  Personally, the closest I've come is A* pathfinding, and my implementation was fairly CPU-heavy for one agent to trace one path.

Tynan actually did a you tube video where he explained some of the difficulties. (though I can't find it now)

If it is still there and you watch it you may understand more about why some of the "silly behaviors" are happening.

I know that there WAS a mod updated for A13 that allowed you to crack open the priorities a bit by making things even more granular. (i.e. you could make Constructing a higher priority than deconstructing within the constructing tasks)

Personally I'd like to see folks understand more about using the ranges built into the production tables. Don't complain when your cook goes  halfway across the map to grab 5 muffalo meat (out of a stack of 75) because cooking is a #1 priority. Reduce the RANGE on the Range to a lower number. Then, if your cook has a #1 priority for cooking and a second #1 for Hauling with no higher priority intervening tasks your cook may well haul the full stack of 75 back to the freezer as you'd want them to. Course if there's other stuff that needs hauling that's closer...

Juan el Demgrafo

240 hours on Steam of this 2017-7-23.

Quote from: Shurp on July 29, 2016, 06:30:22 PM
...tell her to go stand in the corner of her bedroom, and beat her when she tires of it.

I really need to finish researching beer.

Kagemusha12

Quote from: milon on August 02, 2016, 02:43:17 PM
I understand that most of you are coming from a "common sense" perspective, and I can appreciate that.

But have any of you ever coded AI?  Personally, the closest I've come is A* pathfinding, and my implementation was fairly CPU-heavy for one agent to trace one path.

RimWorld has dozens of AI agents (colonists, visitors, traders, raiders, animals, mechs...) all pathfinding simultaneously as well as doing other AI-intensive operations - job searches, locating materials, fulfilling needs, etc, etc.  RimWorld's AI is already quite impressive and streamlined.  I haven't seen the code, of course, but I doubt there's much more room for improvement (unless you want the minimum system requirements to be cutting edge PC's from 2020).

Hypothetically, if Tynan were able to code it in a way that relies heavily on matrix manipulations, CUDA would provide a way to speed things up by a great degree (by letting the graphics card solve the calculations).
Unfortunately this would only positively affect users of Nvidia cards as ATi/AMD cards don't support it

Leroy76

#21
I just want to clear up some things:

First:

- The video was interessting, I also implemented A* several times but wouldn't dare to call that "AI". ;) And I think pathfinding works pretty good in the game.
- The range settings for producation tables are a good hint, hauling of only a few materials needed for the current task instead of a full stack is indeed another annoying thing.

Second:

I was not complaining about the priority system itself, it's actually pretty good. The problem with it is only that needs do not fit in this very well. Yes, I do use manual priorities, so usually switches and fire are priority 1 of everybody. The small issue here is, that priority 1 is green, so it would be nice to use that exclusively to mark the main task of a person instead to reserve it for emergencies. There should either be another priority level "critical" that can be used for fire or simply the option to be firefighter or not, there's no point to set priorities here. Even if there would be an action that has a higher priority like rescuing somebody this action would also be in the same "category" - emergencies. 

Back to the actual problem, the needs: If the life of the colonist is endangered, be it due to fire, an attack etc., everything else should stay back. As indicated, it makes no sense if you might die and get a nervous breakdown and actually do die only because there was no dinner or the current room is too ugly. It also can't be that one is ordered to extinguish a fire, does one tile and falls asleep on ground while the room is still burning.

As for the hauling, I see it like eronaile said, there should only be minor extensions to add at least some basic optimizations, like bringing back the stuff the colonists just mined when he wants to go home anyway. There is already a region/cell system in place as the video explains, maybe it can be used for this, like when a cell is entered and it contains things to haul and the planned path includes another cell that can accept these goods, take it. The target-check could be even removed, as the storages are usually in the main base ("home" zone) and therefore automatically nearby the point where the colonists wants to go to sleep or eat.

I think I will refine my points in a compact form a post some as suggestions.

P.S. The schedule that was mentioned here seems not to have much effect, at least my colonists take that only as recommendation at best. ;)

Juan el Demgrafo

With the personal needs, perhaps set that as an outright priority as well, or/and also make a trait for putting needs like food or sleep always above priority one jobs?
240 hours on Steam of this 2017-7-23.

Quote from: Shurp on July 29, 2016, 06:30:22 PM
...tell her to go stand in the corner of her bedroom, and beat her when she tires of it.

I really need to finish researching beer.

BigG

#23
I think if there was an area wide priority command it would address one issue. Such as drawing a box around some rocks and right clicking 'prioritise haul these' or selecting some blueprint boxes and 'prioritise build these'.

Also the 'refuses to do manual work' could be changed to 'hates manual work' and a mood debuff when made to.

Zhentar

Quote from: eronaile on August 02, 2016, 04:55:04 PM
milon, while I have not personally coded AI, I assume comparison with other similar simulations will reveal quickly enough that yes, there is still quite a bit of improvement possible without straining hardware too much.
What was talked about above can be implemented by heuristic approaches that won't be perfect in a mathematical sense but pretty much indistinguishable from any player's POV.

"Implement an efficient heuristic that is nearly indistinguishable from the ideal behavior" is generally programmer for "Spend an enormous amount of development time creating an extremely complex system that is difficult to understand and debug and creates a large ongoing maintenance burden".

That said, Tynan has said recently he would look into opportunistic hauling and maybe implement it. It wouldn't solve a lot of the annoyance but it would help with the particularly common miner heading back to base ignoring the products of their mining.


As for breakdowns in the heat of battle, what I think would be cool is if during the stressful incidents, pawns' mental break threshold was increased (that is, made less likely to break)... and then once it ends, the threshold swings in the other direction, making breaks even more likely in the already stressful post-battle environment. It would make the mental breaks a lot more realistic, without making the game easier or less prone to tales of disaster.

iamthepenthief

Yea i get alot of resources being left away from storage. Steel, wood etc chopped down or mined and then just left for days to sit away from camp not counting as available resources.

I think that either hauling should be mandatory for all or it can be tasked in the time restrict table as a specific task outside of "Work"

Like "Gather" so that no matter what for atleast afew hours they will haul in the gear left around the map.

Or allow you to order haul on steel or wood or plasteel etc not just  chunks.

Serenity

It would also help if you could prioritize individual items to be hauled. There is an A14 mod that does that, but it's not always reliable either in my experience.

delheit

I agree with most of what the OP said but I have been trying to find a way to put it into better words. A lot of this games difficulty seems to come from frustrating micro management and not always actual challenge.

One example I think illustrates it very well is ordering someone to mine and having the colonist walk up and hit the block only once then walk away to eat. Or having an animal choose to rescue a colonist from the other side of the map preventing the colonist right next to the first from doing so.

Havan_IronOak

One improvement in the AI that I'd like to see is to allow an optional "Haul After" parameter for tasks like harvesting, cutting & mining. Ideally the test would be performed if the pawn is choosing a new task that is NOT one of these.  e.g. Pawn finishes mining a compacted steel square. Checks his schedule and see's he's scheduled to sleep. Rather than leaving what he's mined, he hauls that back and THEN sleeps.

Doc Savage NDMF

Most of the AI issues can be summed up in two words: Situational Awareness.

As in they don't have much...

A game is only as good as it's basic parts, it's foundation.

The AI in this game are not that bright. They do some incredibly daft things, they are not a good foundational element and game play suffers as a result. To hear the excuses as to why the AI can't do something so simple as "Hmm, maybe I should haul that rock back to the camp instead of making Sandy come all the way out here to haul it tomorrow" doesn't hold water when compared to the complexity of other game mechanics.

To watch a pawn hunt by walking past it's prey as far away from camp as possible and then place it's back to a wall ensuring there's no escape when the animal decides the hunter looks pretty dang tasty just hurts. Watching your pawns flee INTO the threat to get shot/mauled/hurt is just mind numbing.

And then there's the whole prison yard mentality and the beating up a woman because she wouldn't put out. In the future we're all ex-cons and savages..? How did we ever cooperate enough to build the ship to get into space..? The pawns in the game would have started a turf war and burned the thing to ground long before it ever got off it...

The OP nails one thing that's indisputable: The AI are beyond selfish. They lack basic Situational Awareness. There are times when you just have to set aside your petty wants and desires and focus on surviving. Deciding your bedroom is more important than your life..? Silliness.

RimWorld is supposed to be about stories. Too many of my tales end in woe. Not the sad, wailing kind where you had to bite the bullet and make heart rending decisions... More so the "hey, why didn't you stop instead of running headlong into a stupid, totally not glorious death" kind. Too many of my colony tales involve stupid, stupid, stupid OMG I can't believe I just witnessed a level of stupidity never before imagined behaviors. That's not good story telling; that doesn't make for compelling tales of glorious defense, the things we had to do and making it out alive.

The AI has to be fixed. As it is, the AI requires the player to suspend their belief in reality and simple logic. No matter how great the rest of the game is, Stupid AI Tricks will undermine, frustrate and ultimately tarnish the game experience. I understand it will never be perfect, but the painfully obvious really should be addressed.
_