Discord server for the Knights Province

I’ve been asked about making a Discord server for the Knights Province.
So here it is: https://discord.gg/tqDCZzx

Feel free to come in and say Hi! 🙂

Posted in News, Sidenotes | Leave a comment

No SKU?

Suddenly all site links got broken and started leading to an empty page with lone “No SKU!” text. I was afraid site got hacked. An hour of troubleshooting lead to the solution – Just go to Settings-Permalinks and hit “Save ” button – miraculously cured!

Posted in Sidenotes | 2 Comments

Fixing Delphi project compilation time

TL;DR: When compilation time goes out of hand – prune “uses” sections.

Over the time the game`s EXE compilation time grew longer and longer. Today it clocked at 70sec! Of course codebase has also increased (~350kLoc now), but still it was weird, given that 330kLoc compiled in 12 or so seconds just a few months ago. Such long times are very counter-productive, given that project has to be compiled and tested every now and then during active development.

Delphi is known for it’s super-fast compiler. So I had to check what’s going on.

Thanks to Source-Code-Versioning (which is SVN for the project) I was able to roll-back to older versions and find the one that increased the compile-time from 15 to 68sec. It was made a month ago. Why did it make such a big change – I can’t say. There was nothing special in it, apart from shuffling several files between folder and changing a few bits in “uses” sections. This was a good lead though – I started to check what will affect compilation time between this and previous versions. It seemed like moving files between “uses” sections was the answer. So I did a quick optimization – removing unused units and demoting them wherever possible from “interface” to “implementation” sections. This was the answer! With 10 min refactoring sprints the time dropped down to 36 sec, then to 26 sec, then to 18 sec. I was on the right track.

Now I have returned to the latest version and started optimizing  .. An hour later I’m happy to have project compilation time back at lightning-fast 8.5 sec! Praise the fast Delphi compiler! 🙂

P.S. All times are given full rebuild from SSD drive. Every time I did several builds in a row – times were very consistent.

Posted in How things work, Sidenotes | Leave a comment

Setting up AI army plans

Here’s a post mainly intended for mapmakers:

For the game I’m looking into setting AI army plans in a more convenient way.

Typical aim is 75min session where AI gets an army of a few hundreds
That’s roughly starting at 1 warrior per minute and ending with 10.
Let’s average that to 5.

Now there are roughly 10 warrior types which could be trained
So on high end we might have requirements of 8 melee per min. On low end we could have 1 siege per 20 min

– Higher numbers naturally feel like more (instead of EquipRate which goes in reverse)
– It’s more intuitive to set this in an integer format

So my proposed plan is:
– set army demand in form of “WarriorType per hour” for each warrior type
– allow to change this from dynamic script

This way AI could be set to train exact army proportions (e.g. a lot of swordsman and bows, or all in into militia and a couple of catapults, or just a few pikemen for remote villages)

What do you think about this feature?

P.S. Forum discussion.

Posted in Ideas | Leave a comment

Alpha 9 plans

I’m planning following major features for Alpha 9:

  • agressive animals (e.g. boars, wolves, bears)
  • early army to fight those animals (e.g. militia hireable from School)
  • warriors morale to prevent rushes (e.g. militia in enemy town is weakened by a factor of 6)

All these features are aimed at making early game more engaging.

Posted in Ideas, News, Sidenotes | 15 Comments

Alpha 8.2

New Alpha 8.2 has just one critical bugfix. In Alpha 8.1 the game would crash upon warriors death. This has been fixed now.

Download links:

Knights Province Alpha 8.2 (7z package)

 

Discussion forum:

http://www.knightsandmerchants.net/forum/viewforum.php?f=35

Posted in Downloads, News | 2 Comments

Alpha 8.1

Fixed bugs:
+ Having selected a neutral unit that is about to be dead (killed) causes a crash
+ Camera changes height too noticeable on panning across mountains
+ Camera does not move smoothly when dragging over minimap
+ Desert 1v1 lacks stone deposits
+ Recruits are not shown on statistics
+ When creating new map, terrian selected in menu does not match the terrain in MapEd
+ Updated and renamed Desert to DustyDay
+ MapEditor won’t load developers SP maps for editing from main menu
+ Gameplay key shortcuts in readme.html needs to be updated to include new spacebar function that rotates house construction blueprints
+ Serf should be able to “give” building materials to building Towers from any side
+ Game crashes if log gets deleted midplay
+ Game crashes when serf does delivery to a house that is destroyed meanwhile
+ Game crashes when unit walks into destroying house
+ Game crashes when serf tries to take ware from destroying house
+ Game crashes when fort with training orders is being destroyed
+ BadNeighbours and TheIronWolf maps did not allow to build Cottages
+ Deleting groups in MapEd does not work

Download links:

Knights Province Alpha 8.1 (7z package)

 

Discussion forum:

http://www.knightsandmerchants.net/forum/viewforum.php?f=35

Posted in Downloads, News | 2 Comments

Bugfixing Alpha 8

It has been almost 2 weeks since Alpha 8 release. There are many bugreports and suggestions – thank you for that!

Bugfixing goes on. I’m also using a nice little tool called Runner, which runs the game without display (e.g. 45min of 4 player skirmish on Crossing takes just 9sec). Recently I have added several more modes to it, which includes killing of random unit and houses. This unearthed another good source of bugs.

Following bugs have been reported, found and fixed and will be included in Alpha 8.1:

+ Having selected a neutral unit that is about to be dead (killed) causes a crash
+ Camera changes height too noticeable on panning across mountains
+ Camera does not move smoothly when dragging over minimap
+ Desert 1v1 lacks stone deposits
+ Recruits are not shown on statistics
+ When creating new map, terrian selected in menu does not match the terrain in MapEd
+ Updated and renamed Desert to DustyDay
+ MapEditor won’t load developers SP maps for editing from main menu
+ Gameplay key shortcuts in readme.html needs to be updated to include new spacebar function that rotates house construction blueprints
+ Serf should be able to “give” building materials to building Towers from any side
+ Game crashes if log gets deleted midplay
+ Game crashes when serf does delivery to a house that is destroyed meanwhile
+ Game crashes when unit walks into destroying house
+ Game crashes when serf tries to take ware from destroying house
+ Game crashes when fort with training orders is being destroyed
+ BadNeighbours and TheIronWolf maps did not allow to build Cottages

Posted in Live progress, Sidenotes | 2 Comments

Alpha 8 is ready!

Alpha 8 is ready!

 

Change list is quite big:

Gameplay mechanics:

  • Rigged Cottages to spawn Blank units
  • Units get trained from Blanks now
  • Wool/Cloth/Recruits removed
  • Warriors take small time to train now
  • Units can be stacked in training queues now
  • Stockpiles
  • Story messages instantiated from dynamic script

Visual mechanics:

  • Rotate houses to face South or West (using spacebar)
  • Set default view from South-West
  • Revised viewport controls and added Q/E to change heading angle
  • Rotate minimap on camera heading change
  • Distinct Units/Houses sight radiuses though fog of war
  • Fog of war GPU optimizations

Map Editing:

  • Automation tools in MapEd (forest, mountains, stone)
  • Choice of terrain type when creating a new map
  • Terrain painting has area of effect now (ground, mountains, water)

Game content:

  • New skirmish 8 players map – “Wheel”
  • 2 new campaign maps – “Citizens” and “Army”
  • 2 new single-player maps by Petr – “Desert” and “Minicampaign”
  • Baker and Carpenter 3D models (not animated yet)
  • Placeholder Axefighter model from Militia model
  • Placeholder mounted units
  • New terrain objects (birch tree, log)
  • Minimap alerts (beacon, attacked, hungry troops)
  • House notifications with icons (no worker, no road, no fish, no ore, no trees)
  • Group orders icons

Other improvements:

  • Fixed forms snapping in GUI
  • Replay button glyphs
  • Large-scale texture variations on terrain
  • FadeIn FadeOut effects on hints
  • Fixed “unlimited” button in workshops
  • Improved Iron/Gold mines wire outlines when placing their plans
  • Slightly rotate houses on placement to break the monotony
  • Allowed to rename players through dynamic script
  • Story missions show description text from libx in menu
  • Fixed jittery warriors animations
  • Added tips to loading screen

As usual – this is still Alpha, there are likely a lot of bugs, flaws, incomplete features, broken mechanics and such. Please report them and also your thoughts on what should be different and why.

Download links:

Knights Province Alpha 8 (7z package)

 

Discussion forum:

http://www.knightsandmerchants.net/forum/viewforum.php?f=35

Posted in Downloads, News | 16 Comments

A dozen of ways to loose a unit

I’ve been categorizing and refactoring unit deaths in the game. Made this comment block in the code. Might be interesting for you to see it too:

// Killing of a unit is done in 4 big steps
// 1. KillUnit - unit is doomed to die (could be next tick, if unit is doing exchange).
// - Fire event
// - Register statistic
// 2. KillInternally - we can kill it now (exchange interactions are done)
// - Abandon old tasks
// - Create and execute Die task (exits house, shows animation, takes ~20 ticks)
// 3. KillFinalize - erase all unit data and hide it from further access
// 4. Delete - when unit has no pointers left

// KillUnit usages
//
// A L - gic_TempKillUnit (kills any selected unit)
// S G - UnitOwnerChange (from script, or capturing a wagon. Kills old and creates new)
// A/S L - ScriptingActions.UnitKill (kills any unit)
// S L - CheckAnimalIsStuck (kills any stuck unit)
// A L - Unit.HitPointsDecrease (killed by enemy)
// A L - fCondition <= 0 (any unit could die of hunger any time. training units get their condition topped manually, yet script can reset any condition back to 0)
// S - - TrainingCancel (kill wip unit)
// S U - UnitTrainingEnd (kill Blank unit)
// S L - FindPlaceForUnit fail (extra units get killed when house is destroyed)
// S L - DeleteUnit (by MapEd)
// S - - TKMUnitTaskDie (final result of Die task)
// S C - TKMUnitTaskWagonGoHouse (wagon entering house)

// A - animated death
// S - silent kill

// L - Lost
// U - Upgraded
// G - GivenAway
// C - Consumed

Posted in How things work, Sidenotes | Leave a comment