One more cup of SW coffee...

How it looks (for you/plural)

And a video link…This text will be hidden

How it works (for me)

UENUM()
enum class EDieType : uint8
{
	Invalid = 0x0,
	d2 = 0x2,
	d3 = 0x3,
	d4 = 0x4,
	d6 = 0x6,
	d8 = 0x8,
	d10 = 0xA,
	d12 = 0xC,
	d20 = 0x14,
	d100 = 0x64,
};

and

static FORCEINLINE int32 RollDice(EDieType DieType, int32 Roll = 1)
{
	check(DieType!=EDieType::Invalid);

	int32 dice = 0;

	for (int i = 1; i <= Roll; ++i)
	{
		dice += rand() % static_cast<int>(DieType) + 1;
	}

	return dice;
}

Some extra info, no tl;dr
An average programmer, want to study some C++ in Unreal via a remake of sorts (KotOR in particular), so an omelet was one way, with random ingredients. Not an artist but I heard about projection matrices. Just added a shiny new DnD dice roll method.

1 Like

a how it looks for you/plural


with a video link here

a how it works for me, no CMC, just interp on tick

SetActorLocation(FMath::VInterpConstantTo(GetActorLocation(), EndLocation, DeltaTime, MovementSpeed * SpeedModifier));
1 Like

Greetings @JohnSmithrd3, I hope you’re having a great Monday! Welcome to the UE community; we appreciate you sharing your work with us in the forums. :grin:

Is there a “Star Wars Journeys” out there, since you’re working on “Star Wars Journeys 2”? :sweat_smile:

I think there was an Iphone app ~10 years ago. This project is for my learning Unreal C++ mainly, so the name is kinda random, but as it has a spaceship journeying on the galaxy map, I assumed Journeys 2 is appropriate

1 Like

how it looks for you/plural, a Character Creation example

how it works for me

UENUM()
enum class ECharacterRace : uint8
{
    Invalid,
    Chiss,
    Cyborg,
    Human,
    Miraluka,
    Mirialan,
    Rattataki,
    SithPureblood,
    Twilek,
    Zabrak,
    Cathar,
    Togruta,
    Nautolan
};

and

UENUM()
enum class ECharacterClass : uint8
{
    Invalid,
    Soldier,
    Scout,
    Scoundrel,
    JediGuardian,
    JediConsular,
    JediSentinel,
    CombatDroid,
    ExpertDroid,
    Minion,
    TechSpecialist,
    BountyHunter,
    JediWeaponmaster,
    JediMaster,
    JediWatchman,
    SithMarauder,
    SithLord,
    SithAssassin
};

and

Chargen_ApplyRaceAttributeModifiers(Character, static_cast<ECharacterRace>(Character->GetCharacterVars()["Race"]));
    Chargen_ApplyClassAttributeModifiers(Character, static_cast<ECharacterClass>(Character->GetCharacterVars()["Class"]));
    Chargen_ApplyClassStatModifiers(Character, static_cast<ECharacterClass>(Character->GetCharacterVars()["Class"]));
    Chargen_ApplyClassAbilities(Character, static_cast<ECharacterClass>(Character->GetCharacterVars()["Class"]));
1 Like

a how it looks for you


with a video link

a how it works for me, the most beautiful thing in the world, weak lambda

        FTimerDelegate delayedCallback;
        delayedCallback.BindWeakLambda(GetWorld(), [this]
        {
            HandleCombatRound(bIsDone);
        });
        FTimerHandle unusedHandle;
        GetWorld()->GetTimerManager().SetTimer(unusedHandle, delayedCallback, fDelay, false);
1 Like

Ah, I see. Thank you for the explanation! I bet this project is gratifying to work on. However, that may be my biased showing (I love anything Star Wars-related :laughing:).

I will continue to enjoy the screenshots and videos you share as you develop. Happy developing! :grin:

how it looks character sheet

how it works, fetching values from a plaintext file, e.g. CSV instead of a traditional Unreal DataTable (I like either, but plain text is just easier to read than binary)

FString URPGGameInstance::GetTableValue(FName sTableName, FName sColumn, FName sRow)
{
	//this returns a FString to be converted to other types, e.g. float, int32, etc.
	FString sString = "NA";

	std::string line;
	const FString sData = FPaths::ProjectDir() + GetPathForData(sTableName);

	std::ifstream inData;
	inData.open(TCHAR_TO_UTF8(*sData));

	if (inData.fail())
	{
		UE_LOG(LogTemp, Error, TEXT("%s"), *FString::Printf(TEXT("ERROR: Couldn't find '%s'"), *sTableName.ToString()));
		inData.close();
	}

	FString sHeader = "";
	TArray<FString> RowArray;
	TArray<FString> HeaderArray;
	int32 nColumnIndex = INT_MAX;

	while (getline(inData, line))
	{
		const FString sLine = line.c_str();

		check(sLine.Contains(","));

		if (sHeader.IsEmpty())
		{
			sHeader = sLine;
			const TCHAR* delim = L",";

			sHeader.ParseIntoArray(HeaderArray, delim);
			for (int32 i = 0; i < HeaderArray.Num(); ++i)
			{
				if (HeaderArray[i] == sColumn.ToString())
				{
					nColumnIndex = i;
					break;
				}
			}

			check(nColumnIndex!=INT_MAX);
		}

		FString sKey;
		FString sValue;

		sLine.Split(TEXT(","), &sKey, &sValue);

		if (sKey == sRow.ToString())
		{
			const TCHAR* delim = L",";

			sLine.ParseIntoArray(RowArray, delim);
			sString = RowArray[nColumnIndex];
			break;
		}
	}

	check(sString!="NA");

	UE_LOG(LogTemp, Log, TEXT("%f %s"), UGameplayStatics::GetTimeSeconds(GetWorld()), *FString::Printf(TEXT("Done '%s'"), *FString(__FUNCTION__)));

	return sString;
}
1 Like

how it looks: Combat layout Darkest Dungeon like (actually Circus Electrique, it’s an Unreal game :D)

how it works, a simple Initiative sort for the list on top of the screen above, the initiative is a 1D20 roll

//sort ascending
    CombatInitiativeList.Sort(
        [&](ARPGCombatAvatar& a1, ARPGCombatAvatar& a2)
        {
            return (a1.GetCharacterVars()[INITIATIVE] > a2.GetCharacterVars()[INITIATIVE]);
        });
2 Likes