Procedurally Generated Combat Framework Plugin for Unreal Engine¶
High-Level Design Document¶
Overview¶
The plugin aims to provide a system where abilities, skills, and effects in a game are procedurally generated and evolve based on player usage. This framework will allow developers to create dynamic combat experiences where abilities can change in shape, damage, effects, and other parameters. Players can reinforce abilities they favor, saving their current state and variations as a reference for future use.
Core Components¶
- UAbilityGenerator
- UAbility
- UEffect
- UMesh
- UAbilityReinforcer
- UAbilityManager
- APlayerCharacter
Class and Data Structure Definitions¶
1. UAbilityGenerator¶
Generates new abilities with initial parameters and evolves them based on player usage.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "Ability.h"
#include "AbilityGenerator.generated.h"
UCLASS()
class MYGAME_API UAbilityGenerator : public UObject
{
GENERATED_BODY()
public:
UAbility* GenerateAbility();
UAbility* EvolveAbility(UAbility* Ability);
private:
FShape GenerateShape();
FDamage GenerateDamage();
FType GenerateType();
UEffect* GenerateEffect();
};
2. UAbility¶
Represents an ability in the game, with properties that can evolve.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "Effect.h"
#include "Ability.generated.h"
UCLASS()
class MYGAME_API UAbility : public UObject
{
GENERATED_BODY()
public:
FShape Shape;
FDamage Damage;
FType Type;
UEffect* Effect;
FString ID;
void Evolve();
FString SaveState();
void LoadState(const FString& State);
private:
void Mutate();
};
3. UEffect¶
Represents various effects an ability can have, such as visual effects, damage types, etc.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "Effect.generated.h"
UCLASS()
class MYGAME_API UEffect : public UObject
{
GENERATED_BODY()
public:
int32 Speed;
FString Color;
int32 SpawnAmount;
void Randomize();
};
4. UMesh¶
Represents the visual representation of an ability.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "Mesh.generated.h"
UCLASS()
class MYGAME_API UMesh : public UObject
{
GENERATED_BODY()
public:
FString Shape;
void ChangeShape(const FString& NewShape);
};
5. UAbilityReinforcer¶
Handles saving and loading the state of abilities.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "AbilityReinforcer.generated.h"
UCLASS()
class MYGAME_API UAbilityReinforcer : public UObject
{
GENERATED_BODY()
public:
FString SaveAbilityState(UAbility* Ability);
void LoadAbilityState(UAbility* Ability, const FString& State);
};
6. UAbilityManager¶
Manages abilities, their creation, evolution, and reinforcement.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "AbilityManager.generated.h"
UCLASS()
class MYGAME_API UAbilityManager : public UObject
{
GENERATED_BODY()
public:
UAbility* CreateAbility();
void UseAbility(UAbility* Ability);
void ReinforceAbility(UAbility* Ability);
private:
UAbilityGenerator* Generator;
UAbilityReinforcer* Reinforcer;
};
7. APlayerCharacter¶
Represents the player and their interactions with abilities.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "AbilityManager.h"
#include "PlayerCharacter.generated.h"
UCLASS()
class MYGAME_API APlayerCharacter : public ACharacter
{
GENERATED_BODY()
public:
void UseAbility(UAbility* Ability);
void ReinforceAbility(UAbility* Ability);
private:
UPROPERTY()
UAbilityManager* AbilityManager;
};
Data Structures¶
FShape¶
Defines the shape of an ability.
#pragma once
#include "Shape.generated.h"
USTRUCT(BlueprintType)
struct MYGAME_API FShape
{
GENERATED_BODY()
UPROPERTY(BlueprintReadWrite)
FString Type; // e.g., "Sphere", "Cone"
UPROPERTY(BlueprintReadWrite)
float Size;
};
FDamage¶
Defines the damage characteristics of an ability.
#pragma once
#include "Damage.generated.h"
USTRUCT(BlueprintType)
struct MYGAME_API FDamage
{
GENERATED_BODY()
UPROPERTY(BlueprintReadWrite)
int32 BaseDamage;
UPROPERTY(BlueprintReadWrite)
float Multiplier;
};
FType¶
Defines the type of an ability.
#pragma once
#include "Type.generated.h"
USTRUCT(BlueprintType)
struct MYGAME_API FType
{
GENERATED_BODY()
UPROPERTY(BlueprintReadWrite)
FString Category; // e.g., "Fire", "Ice"
};
Methods and Responsibilities¶
UAbilityGenerator Methods¶
- GenerateAbility(): Creates a new ability with randomized initial parameters.
- EvolveAbility(UAbility* Ability): Evolves an existing ability based on its current state.
UAbility Methods¶
- Evolve(): Evolves the ability by modifying its properties.
- SaveState(): Saves the current state of the ability as a string.
- LoadState(const FString& State): Loads the ability state from a string.
- Mutate(): Randomly changes some properties of the ability.
UEffect Methods¶
- Randomize(): Randomizes the effect parameters such as speed, color, and spawn amount.
UMesh Methods¶
- ChangeShape(const FString& NewShape): Changes the shape of the mesh.
UAbilityReinforcer Methods¶
- SaveAbilityState(UAbility* Ability): Saves the ability state to a string.
- LoadAbilityState(UAbility* Ability, const FString& State): Loads the ability state from a string.
UAbilityManager Methods¶
- CreateAbility(): Uses the generator to create a new ability.
- UseAbility(UAbility* Ability): Applies the ability in the game, allowing it to evolve.
- ReinforceAbility(UAbility* Ability): Saves the current state of the ability for future use.
APlayerCharacter Methods¶
- UseAbility(UAbility* Ability): Allows the player to use an ability.
- ReinforceAbility(UAbility* Ability): Allows the player to reinforce an ability, saving its current state.
Example Workflow¶
- Creation: Player creates a new ability using
UAbilityManager::CreateAbility()
. - Usage: Player uses the ability in the game, which evolves it based on usage (
UAbility::Evolve()
). - Reinforcement: Player reinforces the ability when they find a favorable state using
UAbilityManager::ReinforceAbility()
. - Saving and Loading: The ability's state is saved and can be loaded for future use with
UAbilityReinforcer
.
This high-level design provides a structured approach to developing a procedurally generated combat framework plugin in Unreal Engine. The classes and methods outlined here serve as a reference for implementation and can be expanded based on specific game requirements.