Friday, December 24, 2010

Merry Christmas!

Thursday, December 16, 2010

Coding - It's UML Time!

Sorry folks but...


IT'S UML TIME!


Note that most classes members are omitted and method signatures simplified.
They say that UML is worth over 9000 words...
...so I'll just throw random class diagrams at you.



1. Controllers 


2. AI

NCLASS
I used NClass for this. NClass is nice for doing C# class diagrams.
http://nclass.sourceforge.net/


End of uml time.

Monday, December 13, 2010

Coding - District Map Generation

How about a coding article? It's been quite a long time, so let's have one.
Let's start with some simple.
If "recursive quad splitting" tells you something you can skip the article alltogether, as the algorithm is really only doing that. It's nothing special really.

DISTRICT MAP...
If you look at the structure of district surface maps they basically all look the same : blocks of buildings cut by straight roads. It's no coincidence, there is one algorithm that generate all the districts.

...GENERATION : Generating Blocks
How can we get  this blocky district plan?
Let's start with the whole district rectangle and nothing in it.
Mister District.
We want blocks.
How about cutting this district along two lines?
Cut
The blue lines would split the district in the middle.
That would be not very interesting for the player.
So let's deviate a bit and cut along the red lines.
We obtain 4 smaller rectangles, call them quads a, b, c, d.
a is topleft, b topright, c bottomleft and d bottomright.
Nice.
But b is a bit too small, so let's merge it with a instead.
b merges with a
Let's continue splitting shall we?
We apply the same process we did on the big district rectangle on the smaller quads (recursion).

After Cut+Merge on a,c,d.
We try to split a in 4, but the smaller quads are too small, so we merge the smaller quads and get only two quads a1 and a2. Same with c.
We find d is already too small and decide to not split it further.
We decide that's enough as there has to be an end to this madness.
From these quads we make blocks and give them numbers.

Blocks

... GENERATION : Assigning Blocks.
Looks like your average district map, with the roads and all.
Only thing, the blocks are empty.
So next for each block we decide what to do with them and fill them.

Assigned blocks
h for housing block, p for park.
Different algorithms are used to fill different block types.
Different district types will have different distribution of block types.
That's it.

THE ALGORITHM
The block generation algorithms in pseudo code (image).

MakeBlocks : Making Blocks since 1887
Start the recursion with calling MakeBlocks on the district rectangle.
Block is a class that has a rectangle property and various other content properties that are filled later.

QuadSplit is even more simple, choosing the split lines semi-randomly and doesn't split quads that would be too small ("merge"), enlarging one of the quads and marking the merged one as empty.

End of post.

Saturday, December 11, 2010

Alpha 6 release!

Check the download page.

Changes :
 ALPHA 6 CHANGES
---------------
New major concepts : personal enemies, murders and murderers, law enforcers and followers trust.
Bunch of bug fixes.
Modified how smell works.
Rebalanced skills and upgrade.
Flavor : Fun Facts, NPC emotes.
Various rebalancing, fixes and AI improvements.


FIXED BUGS
1 Zombified male was created as a zombified female instead.
2 Soldier followers bumped into generators.
3 Player could always break stuff with the break command.   
4 Dying in the sewers with a follower crashed reincarnation if option "Can Reincarnate to Sewers" is off.
5 If you spawned as a slow actor (eg: undead zm) you will not get messages for actions done by actors who get to act before you on turn 0 (eg: getting shot by cop).
6 Flawed spawn logic for undead player.
7 Follower selection menu did not work properly.
8 Looking at a live grenade crashed the game.
9 Armor now drawn on top of torso decoration; might give some funky looks (eg: armor on top of coat).
10 Policeman and male civilians were both named as "man" in post-mortems.
11 Manual : default key for city information is "i" not "m".
12 System.InvalidOperationException: killing deadGuy that is already dead.
13 Reincarnation messed up CUF script. (eg: a zombie could block the stairs forever).
14 Shoving allowed an actor to enter an otherwise unpassable tile.
15 Simulating did not check properly for events.
16 Actors with natural speed over 100% who sleeps can act right after starting to sleep.


GAMEPLAY
New: Personal Enemies!
- Read the manual.
New : Murders and Law Enforcers!
- Read the manual.
Followers
- New Order : "give me...".
- New concept : Trust. Read the manual.
Smell sense
- Smell only adjacent and center tiles (FoS/smell = 1 in old system).
- Smell rating now means lowest scent detectable as % of strongest scent possible.
  eg: 100% means will smell all scents.
       50% means will smell only scents above 50% of max value, that is quite fresh scents.
       10% will almost be "scent blind".
- This means :
  - no more "x-ray scent scan".
  - undeads with poor smell will be more susceptible to loose track of their prey.
  - undeads with poor smell rely more on the noses of ZMs/rats.
  - ...and so more packs led by ZM.
  - importance of clever use of rain & stench killer increased.
  - slightly better undead AI performance, since needs to scan only adjacent tiles.
Map Generation
- Rebalanced Housing rooms type distribution.
- Much more food in houses.
- All Shops start with shelves full of goodies.
- CHAR Offices have canned food only rather than a mix of canned food and army rations.
- Less cars.
- Hospital storage has also some canned food, all items there are full stack.
- Zombie rats in basements.
- Building zones extended to cover doors/windows (good for ai & orders).
- Walkway around buildings are zones (good for ai & orders).
- Try to spawn zombies outside (so most of the initial wave will most probably get shot by cops)
Events
- All gangs size down to 8 (was 10).
- Gangsta will show up a bit longer.
- Rebalanced and redone army supplies logic - will be less frequent and drop smaller packages.
- Rebalanced and redone refugees logic - more on city borders, less in center, default everywhere else.
- National Guard less likey to intervene.
Skills & Upgrading
- Max skill level up to 5 (was 3) - only exception is Hauler.
- Upgrade : choose from 5 skills (was 3).
- Rebalanced skills to account for the new max.
- New Skill : Charismatic - gain trust faster and get more trade offers.
- New Skill : Unsuspicious - law enforcers might ignore you.
- All living actors always upgrade each morning (was previously limited to civilians with a % chance).
Attacks
- Double potential damage when attacking a sleeping target.
Actors
- Rats NPCs can use exits (see AI).
- "Zombie" branch renamed "Shambler" to avoid confusion.
- Rebalanced undeads.
- 2 new unique actors.
Items
- Pills stacking limit increased to 20 (was 10).
- New Item : Police Radio - see all the police on the map.
Post-mortem
- Tells how many actors you murdered.
- Death reason is "murdered" if you happen to be... well murdered.
- Fun Facts.
Reincarnation
- Fun Facts.
Engine
- Optimized actor turn ordering.
- Optimized memory usage.
- New simulation algorithm - faster & more accurate.

INTERFACE & MANUAL
- New command : Make personal enemies (default Ctrl-E); designate actors as personal enemies.
- Player personal enemies are highlighted on the map :
  red    : mutual enemies.
  orange : the other actor considers the player as enemy, but the player do not.
  yellow : the player considers the other actor as enemy, but the actor do not.
- Break/Attack through exits with the wait key when asked for a direction (NumPad5 by default).
- Player or follower actor description say if made personal enemies.
- Trusting follower : light blue; Untrusting follower : dark blue.
- Follower actor description shows trust level and if trusting murders committed.
- PC cops can see number of murders in actor description.
- Yes/No prompts : ESC key also works for No.
- When simulating refresh screen only 1 time per second.
- Simulating show turns simulated per second, as a performance counter - keep in mind that lower sim rate means higher tps.
- Colored say and emotes messages so they are more noticable.
- "Barricade mode" says "Barricade/repair" - some players might have overlook that you can repair fortifications!
- New gfx for new stuff.
- Updated manual.

OPTIONS
- New option : "Aggressive Hungry Civs" - enable or disable aggressive behavior of hungry civilians (default is on).
- New option : "Event - National Guard" - how likely the NG is to show up. See the manual for exact meaning.
- New option : "Event - Supplies Drop" - how likely are supplies drop to happen. See the manual for exact meaning.

AI
- CivilianAI : hungry civilians without food will attack people for food (carrying or standing on food); followers never do this on their own.
- CivilianAI : more aggressive, now charge enemies if they want to.
- CivilianAI : don't wait for starvation to push objects/attack barricades, they start doing it when hungry.
- CivilianAI : reordered behaviors so followers close doors and windows behind them.
- ZombieAI : attack enemies blocking exits (in addition to already attacking blocking objects) - no more "sleeping on stairs" exploit.
- ZombieAI : will explore stairs/ladders more.
- ZombieAI : ZMs will more actively push objects, opening up paths for other zombies.
- RatsAI : will now follow living scents through exits - means they will leave sewers to chase livings.
- SkeletonAI : has a chance to passively wait rather than wandering.
- AI leaders try not to leave followers behind - npc groups have better cohesion.
- Bikers are not interested in trading or picking up ranged weapons - melee fighters.
- JM is free to wander and is more dangerous.
- Improved FightOrFlee and ChargeEnemy behaviors.
- Modified exploration behavior.
- Rewrote smell & tracking related AI due to rules change.
- AIs won't flee through exit if their leader is not on the destination map (eg: they won't left you behind when fleeing).
- AIs will use exits to follow someone.
- AIs warning message for sleeping friends more explicit : "wake up !" instead of "warning!".
- AIs won't warn someone if it is itself adjacent to an enemy.
- Improved skill upgrade choice.
- Improved use of pills.
- Improved large fortification build logic - will tend to make lines anchored on walls.
- AIs might emote (saying stuff or posturing) in some situations; funny and might help understanding what those retards think they are doing.
- AIs more interested in expired food.

MOD
- All actor graphics (Actors and Actors\Decoration) are now 32x32 rather than 24x24.
- Data files incompatible with previous versions due to changes : Skills.csv, Actors.csv, Items_Trackers.csv.
- Better modding readme doc.

KNOWN BUGS AND GLITCHES
- Asymetric FoV.

Have fun!
And remember, die with a smile!

End of post.

Monday, December 6, 2010

Sorry no Alpha 5.1...

...Alpha 6.0 instead.



I can't resist adding new features and fixing stuff.

Probable release by the end of the week, somewhere between friday and sunday european time.


End of post.

Friday, December 3, 2010

Alpha 5.1 - Of Murder And Trust

Major new concepts and features for 5.1. Should be renamed 6.0 honestly, didn't thought I would go this fast.
Murder, murderers, law enforcers and follower trust.
Let the annotated screenies tell the story.

NEW FEATURES IN SCREENS

A murderer and his future victim.

Designating as enemy so I can attack.

The attack.

A new career in serial killing opens for me.

Got a bodyguard,but he doesn't trust me enough yet to accept my orders.

Need to build trust over time or with other means.

...giving good gifts for instance.

...or getting him out of trouble.

He finally trust me enough to accept orders. Notice the new one.

Damn! The Internet Police!
Law enforcers have a chance to recognize an actor as a murderer when they see him.
There are various factors, all explained in the release.
They can also spot actors committing a murder.

Will he stop shouting like that!!

My mate is helping of course. We are now partners in crime.
Right after getting rid of the cop I open the door...

Will all this hate around me never ends? :(

I drop some food for him to avoid more troubles.

There. Good dog.

New features = new skills, so here they are.


Watch out folks. You can get murdered too, most likely by a starving mad civilian in your sleep. I wonder if a follower guarding you would help...
And yes, you can DISABLE the angry hungry civilian thing, it's an option on by default.

WHEN??
Soon my disturbed psychopatic children. Soon.

End of post.

Wednesday, December 1, 2010

Alpha 5.1 - "HEY! YOU!" the return

Already done some work for 5.1, fixing bugs, rebalancing stuff, adding new features.
A feature players kept craving for is coming. You will love it for the freedom it gives you... and hate it when NPCs will use it on you.

HEY! YOU!
Your friendly nextdoor civilian can get quite nasty...

i can haz ur food?

U talkin' to me?

...and that means you can get quite nasty as well.

You will be able to initiate attacks on anyone, but that will make them "personal ennemies" and, depending on who you attack, will have more consequences. Consequences will never be the same. (lulz zomg roflcopter).

End of post.