Developed in Unreal Engine 5 (UE5), Vector-based Decision Making works on the natural language processing principle of Word2Vec [1]. Fundamentally, words are given an nth dimensional vector representation. When a natural language processor attempts to predict the next word it forms an nth dimensional vector itself and finds the closest word to that point in space.
VDM does the exact same.
An AI is given a range of decisions it can make. These decisions are represented using an nth dimensional vector representation, where n is the number of features of the environment that might have sway over what decision the AI should take.
Using a number of predefined weights for each environment feature, the AI effectively has a nuanced "black box" (virtually impossible to read from the player's perspective) priority system where some features of the environment are worth exploiting over others, cleverly influencing which decision to make, giving the illusion of human thought. Even if the weight's aren't perfect, this method provides such a nuance that is difficult to predict.
For clarity, take for example the following scenario from our second-year game, Buckthorne:
A Shade Knight (SK) (see figure 1) NPC locks eyes with the player 30ft away. VDM fires up and picks its first course of action. It begins with a movement decision. Its potential options are: Chase, Flee, Strafe. An SK is weighted such that it wants to be in melee range - while its spells are okay, they are much more effective in 5ft melee combat. The "brain" reads the current scenario using UE5's vision system. It gauges the distance to its target, if it can actually reach its target, it reads its own health, it makes an estimate as to the player's health with a slight margin of error etc. These are the features that make up the nth dimensional vector. The brain then makes the nth dimensional vector and compares it to the potential decisions, which all have their own vector representation, finding the decision with the lowest cartesian difference, which in this case would be Chase. It only picked Chase because its health was OK, had the SK's health been mortally low it might Flee, depending on the weights. This allows for nuanced enemies which might not care about how low their health is, and might Chase anyways.
After Chase, it is now within 5ft, where it changes its decision to Strafe. Why? The system is weighted such that it does not want to be any closer than 5ft, so assuming health is still optimal, Strafe will win out over Chase.
Now consider its attacks. If you understand the principle so far, this will be quite simple to follow . Consider it has two spells for now: Fireball, a slow moving high damage projectile, and Magic Missile, a series of 5 very fast moving but rather weak projectiles that slow down the target if they hit. Firstly, as it is better in melee, the SK's weights to pick spells has been adjusted such that it will almost never cast a spell if melee combat is available - we will come back to a scenario where it might in a minute. But there are scenarios, such as when the enemy is out of range, where spells are the only attacks available. In this scenario, it does the same again, using its brain to calculate a vector.
If the enemy is far away, it will trend towards Magic Missile. This is, as you might guess, because the weights are adjusted to favour long-range engagements with Magic Missile over Fireball, as it is unlikely to actually land the slow moving fireball, but much more likely to land the faster Magic Missile.
[1] Mikolov, T. et al. (2013) ‘Efficient Estimation of Word Representations in Vector Space’. arXiv. Available at: http://arxiv.org/abs/1301.3781 (Accessed: 14 May 2024).
Figure 1: A Shade Knight, capable of powerful melee combat and versatile ranged spells.
Copyright © 2024 alfiejohnson.dev - All Rights Reserved.
We use cookies to analyze website traffic and optimize your website experience. By accepting our use of cookies, your data will be aggregated with all other user data.