Teaching Movement | DevLog_002

This week we took a closer look at Interpolation as it pertains to animation and more specifically, how we can leverage it in our own games. We did this by thinking more theoretically about real life (or video game) examples where this takes place. For example, when a car is accelerating, or a bouncing ball, or when a character pulls tensely on a bow, to then release an arrow at a large velocity. It’s a crucial part of how games look and feel, and more generally how users react to computer interfaces. The reactiveness of a certain icon when hovering over it can have a massive impact on how useable a GUI is and how accessible it is for a wide range of users.              

From a mathematical perspective…

“Interpolation is a method of deriving a simple function from the given discrete data set such that the function passes through the provided data points.”

https://byjus.com/maths/interpolation/

Another way of looking at this from an animation perspective is as follows: We know where something starts and where that something should end up (our bounds), but how does it get there? Does it trudge along steadily at a constant rate (a linear function), or does it start off slowly, then increase its velocity when it is closer to reaching its endpoint (an exponential function). Having control of and setting these data points between the start and end can drastically change how this data is perceived. More importantly, the user-experience on a whole. A reactive framework that is intuitive for the user to use and interact with is ultimately a more successful one. That goes for games and general computer applications.

Dynamic animations I found very interesting as a concept. How it is not pre-determined and relies on user input for the output. This means that the output can be different in every instance. This is what games are as a medium, right? Save for the static animations in cutscenes, games are built on the idea of a player interacting with a computer, in order to receive the outcome that is unique for them. That is why although many of us know the best routes in Super Mario Bros. by now, that first playthrough is different for everyone because the game is only outputting when and where we tell it to output. Where Mario jumps, how far he jumps, where some of us died, and how fast we were able to traverse the level.

Something I was struggling with when first trying to implement these functions is when and where to put them. Because the animations were time-based, the functions remained the same, while the variables fed into them changed. I decided to add more dynamic variables to help the easing process, but I’m wondering if this is inefficient. Perhaps the actual function needs to be reworked to better suit the dataset.

Javascript Function to Emulate Ball bouncing on screen

This is a simple function using two easing functions (Ease-In and Ease-Out) while dynamically changing a the variables to simulate how a ball would decrease in velocity as the bounces got smaller.

This is a simple function using two easing functions (Ease-In and Ease-Out) while dynamically changing the variables to simulate how a ball would decrease in velocity as the bounces got smaller.

Another week of learning a new language. This time, I think I like it? Going from one C-style language to another is very nice. This week while working on the animations in JavaScript, I felt more and more comfortable using the language and easily finding documentation online for different functions I needed. With the addition of Phaser next week, I am excited to digging into more. Especially after seeing the way JavaScript can be used more as an object-oriented language.

Reading this week

I am finishing the book I started last week: Playing Smart. It is a very interesting read that sparks more inspiration for side-projects than I initially thought. The book asks so many questions about what intelligence is, that it becomes more of a self-assessment of how we interact with computers in general. That relationship is the design philosophy behind games themselves. Sometimes what we play feels like it was made personally for us, because each interaction feels so unique.

Side work

I decided to do a little experiment within Unity this week after my time with Playing Smart. The basis of the experiment, can we have more meaningful interactions with AI within games? The book talks about algorithms learning to play games, and this being a measure of intelligence. Instead of just knowing that the best chess AI software out there will wreck me in a game of chess, can that be used in a more engaging experience.

The idea is starting out as a player with several movement mechanics: jump, sprint, slide, attack, block, and parry. Using these inputs, I am creating a simple data set to store into the AI script. An individual’s play style can be learned by an AI and essentially used to create a more unique experience for them. If a player is fast and aggressive, sprinting and sliding and slicing through enemies, can we use those inputs and leverage them to make the AI more methodical. Staying back and waiting for the player, then parrying their aggressive attacks to break their pace, having them re-think how to traverse through certain levels. Or if a player is parry-God, can the AI learn to use more long-ranged attacks such as a player would?

I think the seeds of an idea are here and I need to continue collecting and testing those data sets because…

  1. Is that fun? To get essentially outplayed by a machine.
  2. Can it be balanced to a point that is rewarding, while not breaking the pace of a player’s experience.
  3. What kind of game would this be useful in? Perhaps a fighting game, or a boss battle system. Or a roguelike that typically has players dash and slice through at blinding pace.
  4. The effect narratively. If the game NPCs were truly learning from the user’s inputs, the narrative would have to reflect that, otherwise it would
not the first one to think of this…

Of course, after 3.5 seconds of googling I saw other games doing this exact thing with varying levels of success. Modern examples include Hello Neighbor and Metal Gear Solid 5.

Most stealth games must walk this line of what is considered AI? Pre-determined AI is where the action of the NPC is hard coded before the player even moves. It is just so complex and “random” that it seems as it is smart. A true learned algorithm would determine where it was going as a result of the aggregate user’s inputs. This balance seems though. There seems to be a tug-of-war between what is an interesting concept and what is fun to play.              

I saw many instances online speaking of Alien: Isolation’s dynamic AI for the xenomorph. How it will indeed change its behavior slightly based on the repeated actions of the player. Guess I’ll have to play it for research…

Leave a comment

Your email address will not be published. Required fields are marked *