January 18, 2011

Dev Update : Police, combat and stuff

So, as you can see in this screenshot, the police forces and a basic combat system have been implemented. Members of the police faction are now patrolling the streets and will chase the player if he does something illegal (like here, assaulting one of them with an automatic rifle). You can also notice in the game log that the combat and the general logging have improved.When selecting or changing your target, a quick description of the NPC is displayed. 

The following part of this article explains the changelog into more details.

I. NPC AI

When a NPC's need reach the "Alert" level, repeat job until it has decreased to the "Safe" level. So, basically when a NPC is sleeping, he will continue until satisfied even if another need become higher than 'sleepiness'. In other word they don't go for a quick snack every X turns in the middle of the night. They also understand two new useful orders: Patrol and Attack.

Patrol : Policemen and Gangsters are patrolling NPC. They are paid by their faction (well, currently out of thin air, but hey :p) to walk around the streets of a specified sector and look for enemies. If the NPC is member of the police he will look for people who committed a crime recently. If his is member of an illegal faction he will simply look for hostiles. When a potential target is detected, the NPC will switch to Attack mode.

Attack : Note this is a first rudimentary method that doesn't take cover opportunities, running, and burst fire into account. This is currently a basic chase algorithm : If the NPC is in range of his target, he will shoot, otherwise he will try to close-in. They reload, too.

A 'Flee' order still needs to be implemented. Also, when shot, the general population doesn't react yet. Policemen are the only ones who do, because you 'broke the law'. when firing at them.

II. NPC Jobs


The Patrol job (police officers) has been implemented. The officer is told to go to random zone or position (here, a park) and patrol here for 30 turns. He gets paid for every patrol. When a target is found, patrol switch to attack and we get this:


When the target is killed, the patrol / kill will be registered as a success and the NPC will either continue working or change activity (eating, sleeping, looking for medical help). 

III. The Law

A basic Police Meter has been implemented. There's now one law in Random-City:
" Shooting people is bad and killing them even worst. But you can get away with it "
When that rule was first applied, cops began to shoot at each. So an amendment was added : 
" Cops can do whatever they want."
But for the common folks like you, shooting, hitting, and killing increase the police meter by different amounts. As long as your stealth skill is superior to your police meter value, cops won't see you as a criminal, also the meter decrease by one point per turn no matter what. So by both avoiding doing too much carnage and the cops, you can stay safe as other people can't tell on you yet.

The next step will probably be : "Don't Steal Stuff"

IV. Smart Terrain

Ownership of objects is now handled correctly. Containers, and work bench (item production) are next. I also need to implement hospital zones and health related objects. It would be nice to implement a first production chain here. Hospitals could produce 'health packs' that are bought by doctors (Trader job). Doctors would sell these at their office. Also, I need to implement a way to link "shop" objects  (and any other object) to their owner, so bumping into a shop keeper would open the trade menu.

I'm also thinking about adding effect to specific zone types. e.g. When a wounded NPC is in a hospital he is healed. It could also be used later by Bars, Night Clubs, and other leisure locations to reduce Stress, Food or both.

V. Misc Changes

You can look at the various NPC and read their description. The placement of the various furniture when creating houses, shops and other buildings has been improved, and is much less likely to cause pathfinding issues (yeah). And NPC Templates built in the editor are now used ingame, at least those for the currently implemented jobs (police, office worker and weapon trader).

That's about all for this update.


A little more polish is still needed before releasing the test build. A place to heal first, as the shotgun equipped cops can be really deadly when you're not careful enough (and the lack of such place causes AI glitches anyway). A little less problematic, dead cops don't drop weaponry yet. Also, "Burst Shot". 

No comments:

Post a Comment