Tuesday, 21 May 2013

Evolution of the code #12

Inventory system bug fixes
Since the inventory system has been remade from scratch, it was bound to have problems which were supposed to be fixed later on. One new feature I added was to make sure that multiple items of the same type stack each other instead of creating new entries into the inventory list. The (sort of) problematic issue here was that, each entry in the list was associated with a certain item in the inventory. So, if multiple items were found, an existing entry was updated with the most recent count of the items.

If the user would drag at least two stacked items of the same type on the primary and secondary slots, then new visual entries pointing to existing instances would have to be created. This was resolved by storing all of the "unreferenced" items in the inventory into a separate list and when needed to create a new entry simply get the first entry of that item type from there.

Combat Manager finally working, some AI tweaks
Indeed it's finally working... I hope :D There was nothing special to do here except create a new entity each time combat was started (so that the combat status could be saved along with everything else in the map) that would freeze everyone in his place and take care of the turn based rules. Weapons are finally working as well (unarmed and the pistol) and don't crash the game anymore. Each weapon now has action modes which are define by entries like the one below:

actionPoints = 4
useText = SINGLE
command = firearms
damage = 6
useDistanceRange = 0 40
playSound = Sounds\weapons\9mm\fire.wav
betweenFireTime = 0.3
actionPoints = 6
useText = BURST
useDistanceRange = 0 35
command = burst
actionPoints = 2
useText = RELOAD
command = reload
playSound = Sounds\weapons\9mm\reload.wav

As it can be noticed, the unarmed attacks have been implemented as weapons as well. This was done for easier implementation of unique characters. For example if we would want a raider to have a very powerful melee attack, we would simply have to add that as default item in his definition file instead of extra scripting.

Since i always avoided having to do AI I am trying to keep it as simple as possible. Right now the opponents have the basic intelligence of attacking, following and switching to better weapons in their inventory if any is available and has ammo in them.

One more change that I felt was necessary was now the characters walks to an object before he interacts with it. Until now picking up a weapon or talking to a person was done without checking the distance between the characters or any other requirement. This was fixed and now the player must walk to the object before interacting with it. (yay!)

Plans for the next updates

  • Separate the interface items such as the log, combat interface, weapon holders, etc for a more modern look
  • Further bug fixing
  • Implementation of SIMPLE rules and character system 
  • Implementation of visual resources; its time to get rid of those placeholder models and make way for something better
  • Next milestone: complete implementation of the Tibbets prison level to act as a demo
Please note that help is still needed. A few people replied but it never went past the email stage.

No comments:

Post a Comment