Skip to content

The Character Generation API is a Node.js application that can generate random RPG characters with Stats, Art, and general information about the character.

Notifications You must be signed in to change notification settings

ITsPorky/Character-Generation-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Character Generator API Documentation

Welcome to the official documentation for the Character Generator API. This API empowers you to dynamically generate distinct characters, complete with metadata and associated images. Below is an extensive guide on effectively utilising this API.

Quick Links for Testing

To generate characters, manipulate the seed value in the URL, determining the character's properties. Repeating the same seed will yield the identical character. Below are quick links for testing:

Version 1 Quick Links

Version 2 Quick Links

Note: Version 2 is currently in progress.

Getting Started

Follow these instructions to get a copy of the project up and running on your local machine.

Prerequisites

  • Node.js installed on your machine

Installing

  1. Clone the repository:

    git clone https://github.com/ITsPorky/Character-Generation-API.git
  2. Navigate to the project directory:

    cd Character-Generation-API
  3. Install dependencies:

    npm install

    OR

    npm i

Running the App

  1. Start the development server:

    npm start
  2. Open your browser and visit http://localhost:3000 to view the app.

Usage

Understanding Response Types

This API provides various response types for creating diverse characters. It includes different versions for generating distinct styles of character design:

Version 1

Character Card (format: .png)

To obtain a Character Card, use the following URL format: /v1/card/seed/{seed_value}/1x.png.

  • /v1 instructs the API to use version 1 style.
  • /card instructs the API to generate the card format.
  • /seed indicates character generation based on a given seed value.
  • {seed_value} should be a hexadecimal value (0-9 and a-f) determining the character's properties.
  • /1x.png returns the default-sized Character Card. You can adjust the size with /2x.png or other options (up to 5x.png), but note that larger images may strain the API server.

Example Response:
Seeded Characters Card

Character Sprite (format: .png)

To retrieve a Character Sprite, use the URL format: /v1/sprite/seed/{seed_value}/1x.png.

  • /v1 instructs the API to use version 1 style.
  • /sprite generates only the character sprite.
  • /seed specifies the seed value.
  • {seed_value} is the hexadecimal seed value.
  • /1x.png provides the default size of the Character Sprite, adjustable as needed (up to 10x.png).

Example Response:
Seeded Character Sprite

Weapon Sprite (format: .png)

To obtain a Weapon Sprite, use the URL format: /v1/weapon/seed/{seed_value}/1x.png.

  • /v1 instructs the API to use version 1 style.
  • /weapon generates only the weapon sprite.
  • /seed specifies the seed value.
  • {seed_value} is the hexadecimal seed value.
  • /1x.png provides the default size of the Weapon Sprite, adjustable as needed (up to 10x.png).

Example Response:
Seeded Weapon Sprite

Character Metadata (format: JSON)

To retrieve Character Metadata, use the URL format: /v1/seed/{seed_value}/metadata.

  • /v1 instructs the API to use version 1 style.
  • /seed generates character data for a given seed value.
  • {seed_value} is the seed value for character generation.
  • metadata instructs the API to return the metadata JSON.

This response includes all generated character information, such as character card URL, character sprite URL, weapon sprite URL, and additional data not displayed on the character card.

Version 2

Work in progress...

Features

This API provides numerous features for creating unique characters, including:

  • Random Character Stats (Based on RPGs like Dungeons & Dragons).
  • Stat Modifiers (Based on stat values).
  • Random Character General Information.
  • Random Character names.
  • Random Pixel Weapon Generation (Includes magic or unique weapons).
  • Weapons based on class.
  • Weapon information categorized by rarity (bronze, silver, gold, purple).
  • Character card rarity determined by character stats (bronze, silver, gold, purple).
  • Random Pixel Character Generation.
  • Random weapon modifier (Based on weapon type).
  • Random Clothes/Armor pieces (Head, Chest, Legs) with random armor class (AC contributing to character stats).

Project Overview

This section provides an overview of the key learnings and challenges encountered during the development of this project.

Key Learnings

Throughout the course of this project, I acquired valuable skills and knowledge in the following areas:

  • Proficiency in performing data exchange through URL API calls.
  • Mastery of setting up routes using node.js and express.js to efficiently handle and deliver requested data.
  • Implementation of data sanitization techniques, leveraging Regular Expressions (RegEx) to ensure the acceptance of only authorized data.
  • Enhanced skills in crafting comprehensive documentation, emphasizing the importance of documenting the project concurrently with its development to capture crucial information.
  • Utilization of SHA-256 and manipulation of big numbers for secure and efficient data handling.

Overcoming Challenges

In the pursuit of project completion, several challenges were encountered and successfully addressed:

  • Challenge 1: Node.js and API Routing

    • Overcame by dedicating time to learn and research the intricacies of node.js and the establishment of API routes. Reference to existing documentation and other APIs played a pivotal role in achieving proficiency.
  • Challenge 2: SHA-256 and Big Numbers

    • Successfully addressed by investing time in acquiring an understanding of SHA-256 and big number manipulation. Extensive research and practical application were undertaken to ensure their effective utilization in the character generation process.

I hope this documentation was helpful, feel free to try it out.

About

The Character Generation API is a Node.js application that can generate random RPG characters with Stats, Art, and general information about the character.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published