Skip to content

ashcrysis/agatas-tabletop-game-toolkit

Repository files navigation

Agata's Tabletop Game Toolkit

Overview

Welcome to my little project! This project is designed to simplify and speed up the development of rpg tabletop-like games in Unity. Whether you are building a digital version of a board game or creating your own rpg experience, this toolkit provides some essential components and features.

Currently, I am developing this toolkit for my own games, not using any rpg system exactly as reference, since i want it to be able to adapt to other genres, and it’s designed as a modular code-only project. This allows easy integration into other games just by importing the toolkit. I thought it would be a good idea to open-source it, so others can benefit and contribute as well.

Feel free to contribute to the project by opening pull requests or reporting issues!

Features

  • Dice Rolling System: Roll virtual dice with customizable dice types. You can specify the number of dice, sides, and other parameters to create various rolling mechanics for your game.
  • Player Management: Handle player classes, races, stats, and attributes. Easily define and manage character classes and races with ScriptableObjects, enabling more dynamic character customization.
  • Technique System: Implement various techniques like attacks, healing, buffs, debuffs, and special abilities. This system allows you to define techniques with attributes such as mana cost, cooldown time, and class/race exclusivity.
  • TechniqueData Management: Manage the techniques available to the player, including unlocking new techniques, using them, and checking if new techniques can be learned based on the player's stats.

Installation

To get started follow these steps:

  1. Clone the Repository:

    git clone https://github.com/ashcrysis/agatas-tabletop-game-toolkit.git
  2. Open it in Unity:

    • Open Unity and load the project folder you just cloned.
  3. Make Your Changes and Open a PR:

    • If you make improvements or fixes, feel free to create a pull request. Contributions are always welcome!

Usage Example

Dice Rolling System

The Dice Rolling System allows you to roll customizable dice types. Here's an example of how you can use it in your game:

// Roll 2 6-sided dices
DiceRoller diceRoller = new DiceRoller("2d6");
var result = diceRoller.RollDice();
Debug.Log("Dice rolled: " + result.total);

Character Class

The CharacterClass is a ScriptableObject that holds information about a character's class, such as attributes, skills, and modifiers.

In the Unity Editor, you can now create new character classes from the Create menu. Example of creating a "Warrior" class:

  • ClassName: Warrior
  • Description: A strong and resilient fighter.
  • Attributes: Modify Strength and Constitution for bonuses.

Character Race

Similar to CharacterClass, CharacterRace is a ScriptableObject that defines the racial attributes and skills available to characters based on their race.

Example of creating an "Elf" race:

  • RaceName: Elf
  • Description: A graceful and intelligent race, skilled in magic.
  • Attributes: Boost Dexterity and Intelligence.

You can create new races in Unity by selecting Create > RPG > Character Race and adjusting the values in the inspector.

Technique System Documentation


Technique Class

The Technique class represents a skill or ability in the game that a player can use. This can include attacks, healing, buffs, debuffs, and special abilities. Each technique has various attributes like mana cost, stamina cost, cooldown time, dice rolls for damage/heal, and conditions for when the technique can be used (such as level, class, race, etc.), keep in mind some of them are still not being used, still are going to be implemented.

Properties
  • techniqueName (string): Name of the technique.
  • description (string): A description of what the technique does.
  • techniqueType (TechniqueType): The type of the technique (e.g., Attack, Heal).
  • damageType (damageType): Specifies the damage type (e.g., Fire, Magic, etc.).
  • requiredLevel (int): The level required to use the technique.
  • manaCost (int): The amount of mana required to use the technique.
  • staminaCost (int): The amount of stamina required to use the technique.
  • isClassExclusive (bool): Whether the technique is exclusive to a specific class.
  • classRequirement (string): The class that must be met for this technique to be used.
  • isRaceExclusive (bool): Whether the technique is exclusive to a specific race.
  • raceRequirement (string): The race that must be met for this technique to be used.
  • AttributeRoll (string): The attribute used in a dice roll to determine success.
  • SkillRoll (string): The skill used for the dice roll (if applicable).
  • diceDT (int): The minimum required roll for success.
  • cooldownTime (float): The time in seconds before the technique can be used again.
  • lastUsedTime (float): Stores the last time the technique was used.
  • dice (string): The dice format used for rolling damage or healing (e.g., 1d6, 2d8).
Methods
  • CanUse(): Returns true if the technique can be used (i.e., cooldown has elapsed).
  • SyncVariables(TechniqueData tech): Syncs the technique's variables from a TechniqueData object.
  • Setup(): Loads the TechniqueData for the technique from resources and syncs the variables.
  • Use(Character player): Performs the technique using the player's stats, rolling the required dice, and checking conditions (e.g., cooldown, attribute rolls).
  • UseSkill(Character player): A virtual method that is overridden by specific techniques to implement their unique functionality.

TechniqueData Class

The TechniqueData class holds the static data for each technique. It is used as the template from which techniques are set up and executed in the game.

Techniqueanager Class

The TechniqueManager class is responsible for managing the techniques available to the player, including unlocking new techniques, using them, and checking if new techniques can be learned.

Properties
  • knownTechniqueDatas (List): A list of techniques that the player has already learned.
  • allTechniqueDatas (List): A list of all available techniques in the game.
  • playerStats (Character): The player's character stats.
  • techniqueManager (TechniqueManager): A reference to the TechniqueManager component.
Methods
  • UnlockStartingTechniqueDatas(): Unlocks the techniques that the player can learn at the start based on their level, class, and race.
  • CanLearnTechniqueData(Technique techniqueData): Checks if a technique can be learned by the player based on their stats.
  • LearnTechniqueData(Technique techniqueData): Unlocks a technique for the player.
  • UseTechniqueData(string techniqueDataName): Uses a technique by its name.
  • CheckForNewUnlocks(): Checks if any new techniques should be unlocked based on the player's current stats.
  • UseFirstKnownTechnique(): Uses the first known technique in the knownTechniqueDatas list.

Example Technique

The ExampleTechnique class is a specific implementation of the Technique class. It overrides the UseSkill method to provide specific behavior for a technique, such as rolling damage or healing based on the dice roll.

Methods
  • UseSkill(Character player): Performs the specific logic for this technique, rolling the appropriate dice and printing the results for damage or healing.

Technique Example Implementation

Here’s an example of how a Technique might be implemented and used:

public class FireballTechnique : Technique
{
    public override void UseSkill(Character player)
    {
        var roll = player.gameObject.GetComponent<DiceRoller>().RollDice(dice);
        if (techniqueType == TechniqueType.Attack)
        {
            Debug.Log($"{player.CharacterName} used {techniqueName} and dealt {roll.total} total damage! ({roll.rollResults})");
        }
        else if (techniqueType == TechniqueType.Heal)
        {
            Debug.Log($"{player.CharacterName} used {techniqueName} and healed {roll.total} HP! ({roll.rollResults})");
        }
    }
}

In this example, the FireballTechnique extends Technique and overrides UseSkill to handle rolling dice for an attack or healing.


Contributing Guide

Thank you for your interest in contributing to Agata's Tabletop Game Toolkit! Contributions are always welcome, whether it's fixing bugs, adding new features, or improving documentation. Follow the steps below to get started.


How to Contribute

1. Fork the Repository

Before making any changes, you need to create a fork of the repository:

  • Click the Fork button on the GitHub repository page.
  • This will create a copy of the repository under your GitHub account.

2. Clone Your Fork

Once you have forked the repository, clone it to your local machine:

 git clone https://github.com/your-username/agatas-tabletop-game-toolkit.git

Replace your-username with your actual GitHub username.

Navigate to the project directory:

 cd agatas-tabletop-game-toolkit

3. Create a New Branch

Before making changes, create a new branch for your work:

 git checkout -b feature-or-bugfix-name

Example:

 git checkout -b fix-dice-rolling-bug

4. Make Changes

Make your modifications to the codebase. Be sure to follow the project’s coding style and guidelines.

5. Commit Your Changes

Once you have made your changes, commit them with a clear message:

 git add .
 git commit -m "Fix dice rolling bug that caused incorrect results"

6. Push Your Changes

Push your branch to your forked repository:

 git push origin feature-or-bugfix-name

7. Open a Pull Request (PR)

Go to the original repository on GitHub and open a Pull Request:

  • Click on New Pull Request.
  • Select your fork and branch.
  • Provide a clear title and description for your PR.
  • Click Create Pull Request.

Contribution Guidelines

✅ Do:

  • Keep your pull requests focused and concise.
  • Follow the existing coding style.
  • Provide clear commit messages.
  • Test your changes before submitting.
  • Add relevant documentation if introducing new features.

❌ Don't:

  • Submit large, unrelated changes in a single PR.
  • Modify files unrelated to your change.
  • Use vague commit messages.

Reporting Issues

If you find a bug or want to suggest an improvement, please open an issue:

  • Go to the Issues tab in the repository.
  • Click New Issue.
  • Provide a detailed description, including steps to reproduce (if applicable).

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Credits

Contact

For any questions, feel free to reach out via email or open an issue on the repository. Happy coding, and thank you for contributing! 🚀

About

Unity Tabletop Game Toolkit

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors