Development Pt.3

Development Pt.3

I’ve done a lot of changes in the past month, so this post will be a bit longer. First thing is to make all items/inventory system more localized, especially if I’m planning to implement crafting system. It is much easier to work with one file that includes all information, than scrolling through hundreds of items and looking for specific item. For this purpose I’m going to use DataTables. So first DataTable, “dt_items” is basically collection of items and uses same structure as ItemInfo “strut” file. Parent item bluprint can be also changed, so all information will be fed from dt_items data tbale.

Adding new item is now as simple as creating new row in dt_items data table. Row name is then used to set variables in item blueprint.
So all I need to do when creating new item blueprint, is to set item index corresponding to row name in dt_items. i.e. – I want to create a sword. Let’s say Sword is saved in 51st row in dt_items data table. All I need to do now, is set item index in item blueprint to 51, and all information is automatically extracted from row named “51” in dt_items, and used to set all variables inside item blueprint.

This will be especially usefull when implementing crafting system at later stage. But first I’ve decided to fix visual errors with inventory, so I can close whole “inventory episode” and focus on other things. Main issue with inventory system right now is that it is not showing correct icons for empty slots. I was able to identify cause of this error quite fast.

At first, I used “itemType” variable to check if there’s item of any type, to set icon in inventory…etc. Issue is that “itemType” variable is carried by item. That means if there’s not any item in the slot, “itemType” variable does not exist, what forces engine to use default button settings. So I’ve changed it to simply check if there’s something of any valid class in the slot. If yes, it will extract icon, text…etc. and use it to set variables in inventory window, if not, it will use empty slot icon.

Now, when all inventory visual errors are fixed, I’m going to add few more widgets to inventory window. I just really want to close this inventory part. One thing I miss in inventory is description of the items. For this purpose I’m going to use “OnHovered” and “OnUnhovered” functions inside inventory button widget blueprint.

If mouse cursor hover over slot, it will simply extract “description” variable from an item and use it to set text in description window. When mouse cursor unhover, text is set to NULL. Just a basic function, but it helps to create smoother gameplay experience.

Part of the inventory systemis also equipment window, so if I want to finish inventory system, I need to add some more functionality to equipment window as well. One thing I miss right now is showing some more information about equipped items to player, which is important especially in RPG games, where player needs to equip proper equipment to fight different types of enemies. i.e. – I’m going to fight a boss which uses blunt attacks and also does magic damage, so I’m not going to use plate armour which is vulnerable to blunt attacks and has no protection against magic…etc. For this purpose, I’m going to create few more variables inside player character bluprint, corresponding to variables in “enemyType” enum. Currently having 6 different enemy types, I’m going to create “attack” and “defense” variable for each enemy type, plus armour and damage variables.

Latern, I can check towards these variables when applying damage to the player or to the enemy. I’m also going to use these variables to show some more information about equipment in equipment window, so player could actually see his/her weaknesses and strengths, and could properly prepare to fight different types of enemies. These variables could also be later used to apply temporary boost after drinking a potion, or apply debufs when injured by enemy…etc.

Crafting System

So now, when inventory and equipment system is finally done (there probably will be some visual changes later, but I’m talking about functionality now), I can finally focus on other aspects of gameplay. for crafting system I’m going to use similar system as is used for inventory. All recipes will be fed from data table with simple structure. Structure should define what items in what amount player need to craft chosen item. I want to keep it simple so I’m going to use maximum of 3 different items to be required to craft item. Now it is time to thing how chosen game design affect this element of the game itself. A lot of games use crafting time when crafting items, so player need to wait specific amount of time for item to be crafted. But I’m not planning to use crafting time, for simple reason. In multiplayer survival games, players need to rely on how fast they can gather resources and craft items, so they can compete with other players, but since this game is single player only, crafting time would just create unnecessary frustration for the player. Making player to wait for something, when there’s nobody to compete with, is not a good idea. So no crafting time in this game. I also don’t like idea of player character carying 1500 wooden logs, 500 iron bars and 3000 stones, so no items stacking.

Simple recipes data table, which will contain all existing recipes when game is finished. Resource1,2,3 variables defines which resources are required to craft an item (these variables are basically a name of the row in the dt_items data table). Amount1,2,3 defines how many of these items are required. Result variable defines which item is crafted (this variable is also a name of the row in the dt_items data table).

There needs to be some system for learning recipes first. Now, it’s time to talk about game design once again. In some games, every recipe stops spawning as soon as player will learn it, in other games same recipe is being spawned regardless if player has learned it or not. Once again, it depends on game design. In multiplayer games, second method is better choice, since you want to all players to be able to learn all recipes, and moslty, to make game more competitive, by making player to spend great amount of time to find all recipes. On other hand, in single player games, it would be frustrating for a player to spend hours looking for the specific recipe. For this purpose, I’m going to use 2 arrays, “recipes” (to store all recipes from dt_recipes) and “unlockedRecipes” (to store all learned recipes), and I’m going to create one more actor for recipe. Recipe function is simple. Once recipe is spawned, it will pick random integer in range 0 -> recipes arrayLength, and store this variable. When new recipe is learned, item is moved to unlockedRecipes array and removed from recipes array. This way, player won’t be frustrated by finding already learned recipe over and over again.

Simple function for generating random recipes from “recipes” array. “unlockRecipe” variable is basically a row name from “dt_recipes” data table. Oncle player click on recipe in inventory, this variable ise moved to “unlockedRecipes” array and removed from “recipes” array.

Now, I need to think about actual crafting function. I wanted to keep this game as simple as possible, but I really don’t want to use one table to craft all items, so I will need something that will idetify different table types. Most logical option (at least from my point of view) is to use enumeration. Simple enum where you can pick type crafting table (armorer, weaponsmith, smelter…etc.). Now it’s a good time to rhink about game design again. What items I need player to be able to craft, based on defined design? Armours and weapons is must be. It’s also partially fantasy themed game, so probably some potions and amulets. I’m also planning to implement simple building upgrade system, where player can upgrade his/her house, so I can also add carpenter and mason table…etc.

Final “ETableType” enum. Both, crafting table as well as recipe are carriers of this enum.
When player interact with crafting table, it will simply check it’s type (ETableType), and compare this variable to all items in “unlockedRecipes” array. If “table type” == “recipe type”, recipe is added to table recipes inventory, so armorsmith table will show only recipes tagged as “armorsmith”, smelter table only recipes tagged as “smelter”…etc.

Last part I need to do (in terms of crafting functionality) is to create a function that would check table inventory for items required for crafting.

Checking table inventory for items required to craft specific item is done simply by comparing items class. As long as items in recipe and inventory are same class, this check will pass. Items of other clasees will be ignored. Issue is that if I need, let’s say, 2 iron bars to craft a sword, and I have 5 iron bars in inventory, all 5 iron bars will be added to “itemsToRemove” array. So I’m going to add another check, that will stop function as soon as required amount of items is equal to variable defined in “dt_recipes” data table. This way only 2 iron bars will be added to “itemsToRemove” array.
Logic behind deleting items from table inventory, which is executed if items required for crafting item are present in table inventory (if previous check passes). “itemsAmount” variable needs to be reset to 0 and “itemsToRemove” array also needs to be cleared before crafting another item.

Now just create UI for crafting table and all is set and ready for testing. So let’s recapitulate whole process of recipes learning and crafting. So, once recipe is spawned, it will check “recipes” array and pick random index. When player learn recipes, variable stored under this index in array is moved to “learnedRecipes” array and removed from “recipes” array (to prevent player from finding already known recipes and thus creating unnecessary frustration). When player interact with crafting table of any type, table type enum variable “ECraftingTableType” is checked against same enum variable stored in recipe. If table type == recipe type, recipe is added to the crafting table, so player can craft specific items on specific crafting tables only (i.e. armours on armorsmith table, weapons on weaponsmith table…etc.). If crafting an item, it will check if all required items are in inventory in required amount (fed from “dt_recipes” data table). If not, do nothing, if yes, craft an item, remove used resources from table inventory, then add crafted item to the table inventory. In regards of crafting table UI, I’m going to add one more widget that will show requirements for crafting an item when mouse cursor is hovered over the recipe button in crafting table UI. So, that’s should be all for crafting functionality, from now on, every item added to the “dt_items” data table will be present in game and every recipe added to the “dt_recipes” data tabe will be used in game as well. Let’s test it.

Everything seems to work properly. (for now).

So, at first I’ve fixed visual errors in inventory window. Icons in inventory are being updated correctly now. Description widget was also added to show description of items when mouse cursos hover over an item in inventory. Each equipped item (armour or weapon) now updates Attack/Defense values against specific enemy types, which is also shown in equipment window. Crafting tables and recipes were also added to the game as well as crafting functionality. Everything works for now, but that’s just a part of the game creation. Another challenge will be to balance everything at later stages of dvelopment, to create smooth gameplay experience. I don’t want player to know all recipes after 1 hour of gameplay, but on other side, I don’t want player to spend weeks to find recipe or to craft first item. Everything needs to be balanced in regards of player’s character development. Crafting strongest weapons while meeting low-level enemies would make game too easy and boring, while fighting high-level enemies with “wooden training sword” would create great amount of frustration. That’s where testers come into action. I will need someone to test gameplay, after prototype and few test leves are finished. Easiest and cheapest way is to ask friends, but mind that friend’s feedback is not always honest feedback.

Footnotes

  • Localization – A lot of information could be also fed from external files, like CSV, which is more suitable to store text information. Feeding data tables from CSV files will make it easier to create localization to other languages. i.e. – If selected language = english, feed DataTable from english.csv, if selected language = spanish, feed DataTable from spanish.csv. CSV file could be simply sent to someone else for translation. How many languages game will include, depends on how much money will be pledged on Kickstarter.
  • Enemies grouping – to make fighting enemies a bit more interesting, I’m planning to create enemy rosters, where enemies could be spawned in a way that they could help each other. i.e. – werewolf, which is “beast” type of enemy, could be sometimes spawned together with some other enemy that gives debuf to “beastDefense” stat…etc.
  • Enemies attack patterns – a lot of games uses specific patterns for enemy attacks (i.e. – after attack1, there’s going to be attack2, then attack3…etc.), which allows player to easily adapt and learn these patterns. I’want to experiment with random attack patterns, where each continous attack is picked randomly from an array. This way player would need to rely more on skills and perception, rather than smashing buttons in specific order. Speed of enemy attack animations could be multiplied by variable that depends on chosen game difficulty.
  • Blocking – to make combat system even more interesting, I want to try implement blockng system similar to the one in Kingdom Come: Deliverance video game, where player need to press “block button” and move mouse in direction of incoming attack, to successfuly block attack. Block animation could be also multiplied by “blockingSpeed” variable. Each succesfull block will add some value to the blocking speed, to imitate learning and training, rather than simply rely on unlocking skills in skill tree. Blocking speed variable could be also split in 3 different variables, based on EAttackType enum (swing, blunt and pierce – i.e. – blocking with swords, maces, spears…etc.). I could also possibly use same system for attacking, delivering succefull blows will increase attack speed with specific weapon type. Just thinking that I wanted to keep this game simple…
  • Game difficulty – I’ve been thinking about something different for difficulty options for this game. As we can usualy see in many games, higher difficulty means more hit points and higher damage for enemies. That’s really not what I want to do. I’ve been thinking about something more sophisticated. As mentioned in this Footnotes, I want player to learn how to use weapons by fighting…etc. So enemies could possibly do the same. I can use difficulty setting as a variable (i.e. EASY = 0.8, NORMAL = 1, HARD = 1.2). Enemy animations then can be multiplied by this variable, so on hard difficulty enemies would have higher attack speed…etc (i.e. “attack1” animation speed = difficultySetting). That would force player to train and fight more, to attack faster and to deal higher damage. It would also force player to use greater amount of perception and concentration when fighting enemies (i.e. player will need to focus more and react faster when blocking incoming attacks…etc.).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑