Pokemon-like Type Interaction via Blueprints?

First, I’m new to the forums here & this is my first post so apologies if I’m mistakenly asking this in the wrong place, but to the point of my post.

I’m fleshing out my prototype for a sort of turn-based team battler with a type-interaction system you’d expect of any pokemon game to put it plainly. A unit can themself be one or two possible types & has a list of moves that are always one of any possible type. These types are represented by an enum, so for example I could have a Fire/Normal unit & it could use an Earth move & would have access to those exact enums.

However I’m hitting a roadblock with how to efficiently take the 3 inputs of the type of the attacking move as well as the 2 types of the defending unit. I currently have a chain of switch on state nodes that account for every possible type interaction for the first defending type then have that funnel-output into the exact same thing for the second defending type. As far as results are concerned this is working flawlessly.

But I worry it’s just too big or I’m not being efficient with my node useage.

  • I tried messing around with making a c++ function library blueprint & while I’m still open to doing that at a certain point somewhere much further down the line, the hurdles I have to jump through just to get that whole mess started is very dissuading.
  • I thought at one point the data table was exactly what I wanted but it seems that’s used more for the purpose of pulling an entire row of data not a single cell

Is there maybe a data type, node, or blueprint class that I’ve glossed over that I can use for this, or is my current switch on state actually about as clean as I can get without using c++? I’m essentially putting 1 row input & 2 column inputs into a grid & wanting the 2 intersected cells as outputs. Any help is appreciated!

Hello and welcome! Well, as far as my Pokémon knowledge goes, I suppose you need this to calculate super-effectiveness, right?

There are many approaches to this problem, and yours is as valid as any. You can also do what Game Freak does and use a hard-coded solution or even a DataAsset/DataTable solution.

In older Pokémon games, Game Freak manually checks the attack type against the target type(s). In a modern code, it would be something like this:

// Hard-coded example.
switch (Attack.Type)
{
case EType::Fire:
	if (Target.Type.Contains(EType::Bug))
		Damage *= 2
	if (Target.Type.Contains(EType::Grass))
		Damage *= 2
	if (Target.Type.Contains(EType::Water))
		Damage /= 2
	if (Target.Type.Contains(EType::Fire))
		Damage /= 2
	if (etc.)
		...
	break

case EType::Water
	...
}

PS.: Notice that the Pokémon type property is an array of Types Enum.

As you mentioned, you can also apply an edit-friendly solution, like a data table or data asset, where you list the super effective and resistance types multipliers.

Types Enumerator
image

Data Struct
image

Data Table
image

And of course, there are other approaches; it all depends on your project design; these are just the most straightforward methods.:

Also, Ryan Laley is doing a Pokémon like game series. Maybe it can help you.
Remaking Pokémon in Unreal Engine 5 LIVE - YouTube

2 Likes