Skip to content

TopDown voxel game inspired by Minecraft: Dungeon, combined with lots of RPG elements

License

Notifications You must be signed in to change notification settings

Caishangqi/CharmingCraft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CharmingCraft: Journey (Unreal Build)

project_title

A Pixel Low poly top-down RPG game implement by Unreal Engine 5.3

CodeFactor Lines of code Lines of code GitHub branch checks state GitHub code size in bytes

Introduction

This project build based on Unreal Engine 5.3 to create a Top-Down low poly RPG game. It draws inspiration from Minecraft, such as its inventory system and artistic style, as well as the Top-Down view, combat system, and isometric indoor scene design of the game Minecraft: Dungeon. CharmingCraft aims to offer a more relaxed gameplay experience, where players can freely explore the map, gather resources to craft weapons, complete quests, and more...

Wiki

The game project's wiki contains documentation related to game mechanics and game content, you can find them here. It is currently in Chinese, I will update it to English in the future

Feature

Inventory system (Reformated version)

Inventory System

  • Quick hotbar allow player siwtch different modes (Z battle, X Inventory hotbar, C Building, V Team)
  • The complete inventory system includes merging items, using items, drop items, transferring items, and more.
  • Detailed item pannel show item attributes and large preview.
  • Quickly close and open container, support player open inventory when moving.
  • Auto open player inventory when open any container, close both pannel when player inventory is opened by container not by player. (else close only container)
  • 10 Equipment slot with equip model binding.

Build system

Build System

  • When switching game modes, automatically load ContextMapping layouts according to the mode to prevent key conflicts.
  • Supports building, rotation (using Q and E keys), build specification preview, collision highlighting, destruction, and other functions (press F to switch between Build / Destroy mode).
  • In build mode, automatically disable the interaction between players and interactive objects.
  • Supports filters that only allow building in appropriate areas, such as preventing players from building in mining areas.

Chunk System (Refactory of Biome Actor)

chunk-system

  • The Chunk system allows the game map to be divided into several cubes of the size 10 x 10 x 10. A single Chunk can be activated as needed, conserving system resources.

  • A single Chunk Tile calculates the grid it occupies in the Construction Script based on the chunk's size (snapped to 100). These grid points (Blue in graph), stored inside the Chunk, play a significant role in resource generation.

  • The Chunk system has integrated the previously Biome box area Actors. Now, it's only necessary to allocate Biome data within a single Chunk, eliminating the need to create Biome boxes and adjust their sizes. After adjusting the Biome and world resource data, the Chunk will randomly generate resources upon activation.

  • Because a Chunk records all the grid points it occupies upon creation, these snap-to-grid points can be easily used for ray tracing.

chunk-system

The new version of the Chunk system integrates the Biome Box Actor to manage and generate natural resources in Chunk units.

Resource Collision Enhance

  • To avoid resource collisions or parts being suspended in air within a Chunk, the four corners of the bottom face of the box are used for pre-generation judgment.

  • First, a point is randomly selected from the GridPoints pre-stored in the Chunk for pre-generation.

  • The four corner coordinates of the bottom face of the resource Actor's HitBox are used as starting points for ray tracing downwards. If the Z values of the HitResult's return are the same, it can preliminarily be judged as a plane.

  • If the randomly selected point for ray tracing is not obstructed or is the expected terrain, then the Resource Actor can be generated.

Farming System

farming-cycle

  • The farming system, in conjunction with the resource gathering system and Chunk system, allows players to find crop seeds for planting within naturally generated brush.
  • However, before planting, players need to use a hoe to dig and till the land. The hoe uses the building system's construction indicator to inform players whether the current grid is valid.
  • The growth rate of each crop depends on the current soil medium. Different crops have different growth cycles and stage texture models. Players can also configure the drops of crops at different stages (In the future, crop growth timers will count in "game days" rather than seconds).
  • Each crop has its own health. When the health reaches zero, the crop drops items. Different weapons and tools cause different damage to crops (for example, the hoe has higher agricultural damage).

Item Action/Ability System

item-ability-system

The Item Ability System is an expansion and decoupling based on the Game Ability System (GAS), allowing items and equipment in the game to have skill effects. The types of item skills include USE, SHIFT, SHIFT_INTERACT, RIGHT_CLICK, HOTBAR_CAST, INTERACT, PASSIVE, ON_HIT, ON_ATTACK, with specific keys and game events triggering the above skill callbacks.

  • An item can have multiple skills of different types, but only one skill per type can be activated. For example, a bow can have four types of right-click shooting skills, but the player can only activate one. The same applies to other types of skills.
  • If the player's inventory contains skills of the same type, they are executed in priority order.
  • The skill selected and activated by the player is stored in the ItemMeta. The number and type of activatable skills in an item are based on the initial set of skills + material skills of the item + special skills (level, talents, profession, etc.).
  • When a player equips an item, the skills within the item are loaded into the Action Components and are unloaded from the Action Components upon unequipping.

Detailed Action Callback

Callback Name Trigger Condition Related Component
USE Triggers when a player clicks the "use" button while viewing the item's detailed interface. Item Detail Pannel
SHIFT Activated when the player presses Shift. Controller
SHIFT_INTERACT Activated when the player presses Shift + Interact button (usually the left mouse button). Controller
RIGHT_CLICK The skill is triggered by pressing the right mouse button (e.g., the button used for bows in skill demonstrations). Controller
HOTBAR_CAST The skill is executed based on the specified binding key when the player performs an action from the skill hot-bar. Skill Hotbar Widget
INTERACT Activated by pressing the interact key (usually the left mouse button). Controller, Interact Component
PASSIVE A continuously active aura effect when the item is equipped in the inventory. Buff Handler
ON_HIT A skill executed when the item hits a target, including OnHit in the item's skill. Action Component
ON_ATTACK A callback skill executed after any OnHit, similar to attack effects. Action Component

Structure diagram

Equipment assembly

equip-assemble.mov
  • Just like how people make weapons, you can use any material to create different weapon parts and assemble them together

Smart enemy AI

creature-ai.mov
  • Many enemies will interact with the scene and they will use their best advantage to try to defeat you
  • Current enemies: Slime, Skeleton, Skeleton Shaman

Flexible action system

action-system-click.mov
  • Although it is a TopDown perspective game, you can click on the target to attack or hold down shift to attack to specify the click direction.
  • Different weapons have different attack animations, and the speed of these attack animations depends on your character and equipment attributes.

Scene switching

scene-switching.mov
  • When you walk into the room from the outside, the scene switching will be smooth and stylized.

GAS, Buff and RPG elements

  • Use the chain of responsibility design pattern to handle multiple types of damage. The damage is packaged into HitData by struct.
  • Use BuffInfo, BuffData, BuffHandler to callback BuffModels implement Buff System.
  • Magic, arcane, and some weird stuff...

The skill binding RPG HUD

2024-01-22 22-13-31

Current Skills

Skill Name Can Level Up Resource Cost CoolDown Basic Damage Description
Parry Yes None 2 Depends on Projectile Parry and Reflect the ranged attack
Sword Draw Slash Yes Mana 20 5 Depends on Weapon Draw weapon forward and perform a long-range slash, dealing 1.5 times weapon's hit damage.
Sneak Yes Mana 50 5 110% Critic Damage Causing the enemy to lose their target, ensuring a critical hit on the next attack.
Sprint Yes None 3 None Dash a distance, and become immune to some damage during the dash.
Arcane Endowment Yes Mana 75 10 Depends on Buff Randomly select 3 (+)buffs from the Buff pool, lasting for 30 seconds
Enhanced Arcane Missiles Yes Mana 150 2 30% Magic Damage launch arcane missiles toward the mouse pointer direction, with increased damage for each shot, castable up to 3 times, with the third shot causing AOE damage and stunning.

Buff System

  • Support Stack Buff, Forever Buff.
  • User could customize buff atttributes through Duration, Tick time, or pass a TMap contain internal Data.
  • 3 Buff time update choices: Add, Replace, and Keep.
  • 2 Buff remove Stack choices: Clear and Reduce.
  • 7 Customize Buff Callback: On Create, On Remove, On Tick, On Hit, On Be Hit, On Kill, and On Be Killed.
  • User could implements different Callback to customize buff behaviour.

BuffSystem

Buff Name Icon Allow Stack Default Duration / Tick Default Max Stack Description
Burning Yes 10 / 1 5 Inflicts magic damage over time on the tick unit and reduces the unit's life regeneration.
Damage Enhance No 10 / 0 1 Increases the bearer's attack power.
Stealth No 20 / 1 1 Cannot be detected by enemies; becomes ineffective after the bearer attacks.
Spawn Down Yes 30 / 0 5 Reduce Nearby Enemy Spawn Rate
Negative Resistance No 60 / 0 1 Immune to Negative Effects, Excluding Control
Frozen Yes 10 / 1 5 Slow the bearer, freeze the bearer when the maximum stacks are reached. If damaged by physical attacks while frozen, it inflicts a percentage of maximum health as magic damage.

Player Select Menu (Ring DLL)

game-save-menu-select-ui.mp4
  • Use Ring Structure Double link list to manipulate player save slot and Update preview render.
  • Support player create, delete, select, and switch.

Ring Double Link List

Render Ring DLL

Save Slot Structure

  • SaveGames
    • save - uuid
      • LevelData.sav
      • PlayerData.sav
      • ProgressData.sav
      • RealmData.sav

Resource Gathering System

The Resource Gathering System enables players to collect various resources in the game by inheriting from ResourceEntityActor to define resource entities that appear in the game. Additionally, the game's Biome system will refresh resources within a specified area over a period of time, ensuring a certain quantity is maintained. Structure See here.

Resource Gathering System

Levels

Spawn

Realm - Build using blender and Unreal Cube grid tool

085b835d6aa2bbfdfa9b2f7ca4df50b8

Pub Interior - Build using blender and Unreal Cube grid tool, Design reference γ€ŠUnpacking》

image

Loford - A town with houses and npcs, Build using blender and Unreal Cube grid tool

Progress

Stability: 🟩 Stable / 🟨 Unstable / ❔ Not Test / πŸŸ₯ Failed

  • Implementation of chests and keys using GameTags 🟩
  • Material highlight and glow upon impact 🟩
  • Interactive item highlight and player obstruction glow 🟩
  • Inventory system and item prototypes 🟩
  • Armor forging station 🟩
  • Rendering 3D items in 2D 🟩
  • Item assembly mechanism, crafting items from different materials 🟩
  • Weapon assembly, assembling different types and materials of parts for various weapon parts ❔
  • Attack animations and ranges based on different weapon types 🟩
  • Dota-style mouse movement attack system, including character rotation and new stationary attacks 🟨
  • Damage number animations based on player's attack direction 🟩
  • Comprehensive AI system, including EQS, Behavior Trees, Decorators, and Services 🟩
  • Buff System Include BuffData, BuffInfo, BuffHandler, and BuffModel (Callback) 🟩
  • Game Start UI and World Select UI 🟩
  • Game Serialization System (Json, FString) to UObject ❔
  • Game resource system with regenerated resource 🟩
  • Resource fracture mechanism implement by Chaos Destruction system 🟩
  • GameMode system that support key mapping base on different ganemodes 🟩
  • Build system and visual enhancement support place, rotate and break 🟩
  • Chunk Based Resource Generation 🟩
  • Level Instance streaming load levels and travel player 🟩
  • Map Travel system combined with level loaded and unloaded 🟩
  • Crafting system that support multiple input and output 🟩

Content and Mechanism

Coming Soon / TODO

Context Priority State
Game context serialization Highest βœ…
Complete attribute UI Normal βœ…
Per Item Ability System Normal βœ…
Quest system with related NPCs Normal πŸ“
PCG Random dungeons Normal πŸ“Œ
Animals and monster iteration Normal πŸ“
Crafting System and RecipeRegistry Normal βœ…
Time system: Ingame Date and Days Normal πŸ“
Resource collection system, ores, trees, farmland Normal βœ…
Biome: Respawn of monsters, resources, creatures Low βœ…
Developing an engaging storyline Lowest πŸ“Œ
Reset inventory UI and drag method Lowest βœ…

Awaiting Improvement

  • If the player cancels the interaction, ray tracing will still be performed, causing widespread resource actror damage.
  • Fixing stuck and jittery issues when interacting with items on high ground (Fixed)
  • Correct movement behind buildings when obstructed (Ray Tracing)
  • Dynamic pathfinding improvements, refreshing available routes when players destroy blocks or interact with items (Fixed)
  • Changing item dropping from generation to a throwing action
  • Rendering 3D items into 2D images requires manual placement of RenderTargetActor in the world, otherwise it fails (Fixed)
  • The OnHit() method of weapons is determined by the weapon type, consider passing in a weapon class template for the interaction component to execute the template class method for HitData transmission (Fixed)
  • Combind ItemAbility System to part of Build Module, allow Ability data structure contained visual enhancement object.

Project Structure

Asset Structure

  • Assets
    • models
    • textures

Code Structure

  • Source
    • Core (Game Logic and Mechanism)
      • Attribute (RPG attribute system)
      • Buff (RPG buff system)
      • Builds (Build System and Block)
      • Container (Widget and Container hold itemstack)
      • Damage (RPG Damage system)
      • Decoration (Decoration system)
      • Craft (Craft system)
      • Entity (Drop Entity and Creatures template)
      • GameMode (Gamemode for different cases)
      • Interact (Interact system)
      • Item (Item system and Inventory)
      • Log (Log system and naming)
      • Save (Save system and Seriliazation)
      • Skill (RPG skill system)
      • UI (UI handler and UI template)
      • World (World system)
      • Resource (Resource System)
    • Controller (Different Controller)
    • Camera (Different Camera)
    • Content (Content that Extend from Core Mechanism)

Concepts, Design Patterns, and Implementation Principles

The following content is written based on the technology used in the project. It does not cover all aspects of Unreal Engine. Unfinished records are not displayed on the main README but are shown in the project's Wiki.

Implementation Principles

Errors and Solutions

WorkFlow

Animation Assets

Resource

About

TopDown voxel game inspired by Minecraft: Dungeon, combined with lots of RPG elements

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published