top of page
Search

Log 03: Still Going, boy I did a lot...

  • Writer: Kassandra McCormack
    Kassandra McCormack
  • Sep 28, 2023
  • 2 min read

My final hurdle, and the thing I'm still currently working on is the ability to lock onto specific targets and have the camera follow them. This initially was not hard as there are tutorials online for this kind of thing. However my problem is that with dozens of enemies on the screen at the same time, the player doesn't want to lock onto or cycle through all the mooks just to lock onto the captain enemy that they want.


I had to create an ITargetable interface that certain enemies would inherit and search for that. Unfortunately this led into another problem: thus far I had been doing all this on a single character, but I needed different ones. Specifically three: Mooks, Captains, and the Sentai team that would actually be controllable by the player. So first I had to create new Character Blueprints that had had the proper parent-child hierarchy where Playable Character inherits from Targetable Character, inherits from Basic Character. This way everyone can have access to the same basic functionality but different characters can have different overrides where needed. This becomes increasingly necessary later. So now Targetable characters could inherit the ITargetable interface, and mooks would still be untargetable.


Next up was the ability to cycle targets. This one was harder to find tutorials for, and I wasn't sure how to do it. So I bought a couple of assets to see how they implemented it. The first was the Flexible Combat System, while very pricey I considered it an investment because it also does numerous other things I'm going to have to implement later, such as Companion behavior, cinematic cameras, dialogue, and objectives/quests. But their lock on didn't quite work the way I was looking for so I had to create my own targeting component and modify the code quite extensively.


While I was doing this I ran across yet another hurdle: I want both player controlled characters to be able to lock onto enemies, as well as AI controlled characters. And both of those require trace casting from very different places, such as the camera for the player controlled character and the character itself for the AI controlled ones (not to mention enemy AI Characters won't have any camera so I can't use that in the code or I'd get null reference errors).


Inheritance to the rescue once again! I made a Basic Targeting Component that had overridable methods/variables and use those for the calculations. Then I created an AI component that overrode to use the character as the base, and a Player Component that uses the camera.


Now I'm working on how to distinguish whether the character is controlled by the player or AI. As well as the fact that while only locking on changes AI's locomotion style, the player's locomotion style only changes while guarding (but that they always face the locked on target).


There we go, I think I'm caught up. If I find something else, I'll make sure to mention it in a future post.

 
 
 

Comments


bottom of page