Reynard Devlog #10 – Merchants Update (0.8.1)

It’s been a while since I’ve posted a devlog in this form… Reynard has hit an early access stage and it’s available on itch.io and this is first content update which brings Merchants to the game!

Merchants

Until now, if you discovered hidden stairs, you could only reach library which offered different relics in exchange for different payment types. For an example: You could get relic which boosts your health regeneration in an exchange for consumables or score reset… The Merchants update brings 4 merchants which offer various goods! These merchants are:

  • Izak (Weapons)
  • Pepe (Armors)
  • Abdul (Runes)
  • Bubba (Potions)

Merchants unlike statues, libraries and other “mini shops” take only gold! So gold is getting another use case in the game and it’s not used only for building turrets anymore. Each of the merchants offer more items and set the price semi-randomly based on its quality.

Other Changes

  • If the description of the item is long, the description window slowly starts scrolling down so you can read more.
  • Fixed the “Throwing Acid Spear”.
  • Added experience bar at the “End of run” screen instead of using only numbers.
  • Fixed multiple typos in item descriptions
  • Removed “+” signs in item descriptions. Now only “-” is displayed.
  • Bats now collide with buildings and can hurt them.

Giveaway

We have also decided to create a giveaway! We’re giving away 3 keys for Reynard! You can enter the giveaway here.

PS: Sharing is caring 😀

devlog giveaway merchant merchants reynard update

Reynard

Story

When Hammlet’s wife Prascilla goes missing, Reynard immediately grabs his high-tech gauntlet and goes on an adventure. In order to rescue Prascilla from becoming “Goulash” and his home island Foen from an invasion, he has to defeat many vicious creatures and villains.

Gameplay

Reynard is a mixture of procedurally generated action RPG and a Tower Defense genre with roguelike elements. It has been influenced by classics such as Legend of Zelda and an indie classic – Binding of Isaac. It contains features such as:Countless proceduraly generated dungeons, TD maps and runes!

  • More than 200 different items!
  • Fast paced action against challenging enemies and bosses!
  • Progression through perk and blueprint system!
  • Simple yet cool crafting system!
  • Lovely story and companions!

Minimum Requirements

  • Gamepad is extremely recommended, but keyboard also works.
  • Intel Celeron p6100 @2.0 GHz
  • 4GB DDR3 RAM
  • Windows 7, 8 , 10 64bit
  • Integrated graphics cards should suffice

Official website

Shops

game game dev indie dev reynard unity3D

Reynard Devlog #9 – Inventory, HUD Update, Areas

In previous post, we’ve showcased the weapons and the runes… And now, after couple of weeks I’m able to show you the inventory which brings the ability
to swap those runes!

Slimes and Health bars

You can also see that we’ve replaced the Slime’s sprites… When these slimes get attacked and if they get hurt, they’ll display a health bar. The health bar’s color is dependent on the health type of the monster. The purple slime has “water” type health, which gives it a “blue” color. Because it’s health is water based it can’t get hurt by fire attacks… which also means that it can’t catch fire and spread it all over the place.

Additionally if we kill these slimes… they can drop loot… Ok… In the game you’ll probably never see a slime dropping 5 swords like in the video, but we wanted to show you the point 😀

HUD improvements

I’ve also replaced the HUD’s graphics. I think that it looks way better now than a classical black and white window. HUD now has the ability to show you if the weapon is on cooldown. You can see the cooldown in action in the video below.

The “stamina” bar’s color is now also changed to more greenish color – because we all know that blue usually stands for mana.

Inventory

The biggest thing in this devlog is inventory which is split on 3 parts:

  • Left part is for consumables, runes, usables etc…
  • Middle part is strictly reserved for the equipment and it’s rune slots
  • Right part is dedicated for the item’s descriptions, stats etc.

I can say that inventory is already functional but I’m sure that I will update it as soon as I’ll add more different items, such as consumables etc. Besides the inventory I’m planning on adding “Stats” tab, where player will be able to see all of the Reynard’s “important” stats… Such as on weapon swing damage etc.. I tried to add all this info in the item’s description but I wasn’t able to fit everything in such a small window… That’s the reason why I’m thinking of implementing “Stats” tab.

This time in video I’ve decided that I’ll rather talk… I don’t feel comfortable talking 😀 but it’s really easier to say things while playing the game than editing text pieces with video fragments. I think that I’ve also improved the video’s quality… The pixels look better now!

 

Reynard Inventory Concept 1

This was one of the first inventory concepts in the game.

Reynard Inventory Concept 2

Some more inventory experiments…

 

 

 

 

 

 

PS:

If you have any recommendations or opinions please express the in the comments down below!

Regards,

Filip

devlog health bars inventory reynard runes

Reynard Devlog #8 – Rune System

We have a working rune system!

Feature update

For couple of weeks I’ve been working on how different systems interact with each other. The reason I’ve spent so much time on this task is because I really wanted to make it as modular as possible. Modularity of the systems will significantly increase the speed of how fast we can create weapons, enemies, items and other stuff (even in other upcoming games).

One of the game’s core design is that Reynard can carry only 3 weapons at the same time. And these weapons have to be different by type such as:

  • Melee (swords, axes, hammers…).
  • Ranged (shurikens, arrows, boomerangs…).
  • Special (bombs, magic cloaks, summon rings…).

To keep things interesting and to increase the game’s replayability we’ve decided to add a rune system. For example: Weapons can have “Weapon runes”, armors can have “Armor runes” and so on. Primarily these past weeks I’ve focused on Weapon runes which can:

  • Deal different or random amount of damage.
  • Deal different types of damage (normal, blunt, electric, fire, holy, ice, pierce, poison…).
  • Add stamina penalty (if you have runes that are powerful, you’ll be draining Reynard’s stamina faster with each attack).
  • Have a chance of missing or knocking an enemy.
  • Have different effects (Damage over time, slow over time)… These effects can:
    • Be stackable (same effect applied multiple times to same enemy).
    • Be spreadable (fire, ice) etc.
    • Have different power and duration.

To make everything work as intended I also had to implemented weakness tables and so on. Did I mention that we’ve added BOOOOOMBS? Enough with the words here comes the video:

 

PS: I can’t wait to show you our next creations next week! Stay tuned!

Regards,

Filip

bombs devlog reynard rune system runes

Pariah: Anton – Generated grass biomes [screenshots]

I still didn’t find the time to write the whole progress report about Pariah, but I can say that in the evenings I’ve been practicing pixel art and during the daytime, I’ve been programming! Because Žiga was late with his art work, I’ve imported my own creations to the generator and it produced couple of cool looking grass biomes 😀

 

Huge story teaser

Vegetation is pink because of the Artimoon.

We’ve also had a poll about which style would the players prefer to see in the  released version of the game. Majority of people we asked… where n = 6, 4 said that they prefer the art style on the right (picture below).

Pariah tree art style

 

 

 

 

PS: I’m the author of the style of the “left” tree – which was used in the current biome generation and Žiga modified it to his style on the “right”. I Will show the next screenshots with the modified style as soon as they are available 😀

Till then,  stay pixely and if you’re interested in updates about our upcoming game Pariah, subscribe to our newsletter and check out our social media.

Cheers,

Filip

 

 

art pariah screenshots

Loot drop table implementation in Unity3D (C#)

Many games like Diablo, World of Warcraft and Final Fantasy use loot drop tables for… well… amm… loot drops and stuff 😀

Currently in Pariah I’m facing random generation. Even though it’s gonna be “randomly” generated world, I still want to have some kind of control over the quantity of spawned items, randomly picked backgrounds, vegetation, resources etc.

I’m not saying that the way I’m doing it, is the best way to implement control over randomness, but I found out that using loot drop table (LDT) can really help me out in multiple situations.

Example of usage

For example we can use loot drop tables in biomes when we want to generate ground. Ground can be made out of different tiles, but we still want to pick the tile with the most grass in it and use it more frequently than other tiles… and that’s where we can harness the power of loot drop tables.

We can create a treasure chest script, that has chances of dropping rare, frequent or maybe legendary loot.

We can use loot drop tables for all sorts of stuff. Before diving into the code and further explanation, I’d really recommend reading this awesome article about loot drop tables on Gamasutra.

The case, tutorial and our goal

I know that i’m gonna use loot drop tables multiple times for different scenarios and that’s the reason why I decided to write two simple generic classes that implement basic loot drop tables and loot drop items (LDI) on which we can extend and build more complex systems.

Goal

In Unity we want to have a “GameObject” or a “ScriptableObject” whose script can contain a loot drop table type property. Loot drop table will give us the ability to add items to it’s list, assign item’s probability and randomly pick them based on their weight.

For example, loot drop item can be an enemy that will be spawned in certain area, a rare or a common sword which the player can acquire from treasure chest, an integer which represents the tile id in our tilemap… or whatever we want it to be.

Also we want to have a control over probability of this item being picked by our loot drop table script and here’s the reason we want to assign a weight to each item separately. Weight in our case is nothing else but an integer. Higher the integer, higher the chances of item being picked.

We’re gonna create a “treasure chest” which will “spawn” different items each time we start the game. We will have the ability to assign which item can spawn and what is it’s probability / weight.

About logic in our loot drop table

Our LDT script combines items to a list, ads up items weights and based on weight’s sum, sets the ranges to which the item belongs. LDT script then picks a random number from “0 – sum of all item weights” and based on that randomly selected number, picks the item.

Example

Total weight of 2 items is 120. Weight of first item is 50 and weight of second item is 70. Based on their weights, LDT assigns that the first item belongs to a range 0-50 and the second item belongs to a range 50-120. Based on these numbers, LDT then picks a random number between 0 and 120. If it picked a number which is for example “76”, it means that the second item was picked. Now that we know which item was picked, we can do whatever we want with it.

Unlimited power - loot drop table

For better understanding what’s happening, check out the video above.

So in the end we want to create 2 abstract classes (genericLootDropItem.cs and genericLootDropTable.cs) which can represent different value types. Then we can inherit different variations of LDTs and LDIs by passing them a type. In our case, we’re gonna create an GameObject variation of LDT and LDI.

Because they can represent different values, I saw a solution in using generics. If you aren’t familiar with generics, you can check out this cool tutorial about generics made by Brackeys.

The code

When writing “nested” generic code, the biggest “problem” I’ve encountered was the inablity to assign the items to a LDT via Unity’s inspector. In my understanding the “problem” is that unity can’t serialize generic properties which are multiple level deep.

One of the consequence is that these properties don’t show up in the inspector and we can’t assign them via inspector even if the code is without an error.

My workaround for this problem is that we create an abstract generic class for LDT and LDI from which we inherit other classes based on the type we want to use. This way we “trick” Unity in a way that it show’s up properties in the inspector and we don’t have to write a lot of code over and over again.

GenericLootDropItem script

Let’s start by writing the most basic element of our system, which is a GenericLootDropItem:

  • It holds information about the item it represents.
  • It has weight.
  • For information purposes it displays item’s chance of being picked (in percents).
  • It holds information about the range it belongs to.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// Item that can be picked by a LootDropTable.
/// </summary>
public abstract class GenericLootDropItem<T>
{   
    // Item it represents - usually GameObject, integer etc...
    public T item;

    // How many units the item takes - more units, higher chance of being picked
    public float probabilityWeight;

    // Displayed only as an information for the designer/programmer. Should not be set manually via inspector!    
    public float probabilityPercent;

    // These values are assigned via LootDropTable script. They represent from which number to which number if selected, the item will be picked.
    [HideInInspector] 
    public float probabilityRangeFrom;
    [HideInInspector] 
    public float probabilityRangeTo;    
}

After we know how our item looks like, we can continue with writing GenericLootDropTable script.

GenericLootDropTable script

It’s the brain of our loot drop table system.

  • Contains a list of LDIs.
  • Holds information about total weight of all LDIs.
  • It has a method which validates all of assigned LDIs (set’s their range from, range to, calculates percents).
  • It also has a method which returns the “randomly” picked LDI from it’s list.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// Class serves for assigning and picking loot drop items.
/// </summary>
public abstract class GenericLootDropTable<T, U> where T : GenericLootDropItem<U>
 {
	// List where we'll assign the items.
	[SerializeField]	
	public List<T> lootDropItems;

	// Sum of all weights of items.
	float probabilityTotalWeight;

	/// <summary>
	/// Calculates the percentage and asigns the probabilities how many times
	/// the items can be picked. Function used also to validate data when tweaking numbers in editor.
	/// </summary>	
	public void ValidateTable(){	

		// Prevent editor from "crying" when the item list is empty :)
		if(lootDropItems != null && lootDropItems.Count > 0){

			float currentProbabilityWeightMaximum = 0f;

			// Sets the weight ranges of the selected items.
			foreach(T lootDropItem in lootDropItems){

				if(lootDropItem.probabilityWeight < 0f){
					// Prevent usage of negative weight.
					Debug.Log("You can't have negative weight on an item. Reseting item's weight to 0.");
					lootDropItem.probabilityWeight =  0f;
				} else {
					lootDropItem.probabilityRangeFrom = currentProbabilityWeightMaximum;
					currentProbabilityWeightMaximum += lootDropItem.probabilityWeight;	
					lootDropItem.probabilityRangeTo = currentProbabilityWeightMaximum;						
				}

			}

			probabilityTotalWeight = currentProbabilityWeightMaximum;

			// Calculate percentage of item drop select rate.
			foreach(T lootDropItem in lootDropItems){
				lootDropItem.probabilityPercent = ((lootDropItem.probabilityWeight) / probabilityTotalWeight) * 100;
			}

		}		
		
	}

	/// <summary>
	/// Picks and returns the loot drop item based on it's probability.
	/// </summary>
	public T PickLootDropItem(){		

		float pickedNumber = Random.Range(0, probabilityTotalWeight);

		// Find an item whose range contains pickedNumber
		foreach (T lootDropItem in lootDropItems)
		{
			// If the picked number matches the item's range, return item
			if(pickedNumber > lootDropItem.probabilityRangeFrom && pickedNumber < lootDropItem.probabilityRangeTo){
				return lootDropItem;
			}
		}	

		// If item wasn't picked... Notify programmer via console and return the first item from the list
		Debug.LogError("Item couldn't be picked... Be sure that all of your active loot drop tables have assigned at least one item!");
		return lootDropItems[0];
	}

}

You might ask yourself why we’re not inheriting this class from MonoBehaviour and not validating the LDIs in OnValidate method. I’ll explain the reason in the lower section 🙂

Now that we have base generic classes, we can create LDT and LDI for GameObject type.

GenericLootDropItemGameObject script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// When we're inheriting we have to insert GameObject as a type to GenericLootDropItem
/// </summary>
[System.Serializable]
public class GenericLootDropItemGameObject : GenericLootDropItem<GameObject> {}

GenericLootDropTableGameObject script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// When inheriting first we have to insert GenericLootDropItemGameObject instead of T and a GameObject instead of U
/// </summary>
[System.Serializable] 
public class GenericLootDropTableGameObject : GenericLootDropTable<GenericLootDropItemGameObject, GameObject>{}

TreasureChest script

It’s the script that represents the treasure chest itself. For the tutorial’s purpose we’re gonna try to keep it as simple as possible. It’s main goal is:

  • When the game starts it picks and generates items from it’s LDT property.
  • Validates LDTs and LDIs.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// The most simple treasure chest script ever made :P basically on game start it spawns items in a straight line.
/// </summary>
[System.Serializable]
public class TreasureChest : MonoBehaviour {

	// Loot drop table that contains items that can spawn
	public GenericLootDropTableGameObject lootDropTable;
	
    // How many items treasure will spawn
	public int numItemsToDrop;

    // Runs when we start our game
	public void Start(){

		// Spawn objects in a straight line
		DropLootNearChest(numItemsToDrop);

	}
    
    void OnValidate(){

        // Validate table and notify the programmer / designer if something went wrong.
        lootDropTable.ValidateTable();
        
    }

    /// <summary>
    /// Spawning objects in horizontal line
    /// </summary>
    /// <param name="numItemsToDrop"></param>
    void DropLootNearChest(int numItemsToDrop){
        for (int i = 0; i < numItemsToDrop; i++)
        {
            GenericLootDropItemGameObject selectedItem = lootDropTable.PickLootDropItem();
            GameObject selectedItemGameObject = Instantiate(selectedItem.item);
            selectedItemGameObject.transform.position = new Vector2(i/2f, 0f);
        }
    }
}

Because this script unlike GenericLootDropTable inherits from MonoBehaviour, It also has a role for validating LDTs and LDIs. Basically it calls LDT’s ValidateTable method in OnValidate method which validates values as soon as we assign them in the inspector.

The main reason for calling LDT’s ValidateTable method inside the TreasureChest script is that if we inherit the GenericLootDropTable from MonoBehaviour we don’t see LDI’s exposed properties.

If LDT inherits from MonoBehaviour

If GenericLootDropTable inherits from MonoBehaviour

If LDT doesn't inherit from MonoBehaviour

If GenericLootDropTable doesn’t inherit from MonoBehaviour

 

 

 

 

 

 

 

 

Now that we have every script we need, we can easily recreate the demo scene from the video.

Summary

Our loot drop table belongs to more “primitive systems” out there 😀 It can be improved and modified in many ways. Here’s the link to my github repo from where you can easily download unity package and test it out yourself.

What I really like about our simple system is that for an example we could really quickly create LDT and LDI of an integer type and modify our treasure chest script in a way that besides dropping items, it would also drop golden coins or something else.

This is my first tutorial and I hope that some of you will find it helpful. If any of you fellow readers have a suggestion, or have an idea on what I could improve, or if you noticed a bug, please let me know in the comments down below.

Till next time, I wish you happy programming!

Filip

C# loot drop table random generation tutorial unity loot table unity3D