I need to write a camera system for a fighting game, e.g. a camera that floats between the 2 fighters, always keeping both on screen at the same time.
I know I can do this with a custom camera on the player, but wanted to ask if it would be better to write a custom camera manager to handle all the camera for the mode.
For example, the camera between the two fighters, intro/outro cams, mid-fight cutscenes, etc.
Would I be overcomplicating things for myself? Should I just keep it straightforward and stick with the normal implementation?
Thank you for the welcome and the advice. Alright, then I’ll go ahead using the normal camera.
Mostly, I was just curious if it might be useful to separate the system from the player’s actor since the perspective is based on the position of both. I thought it also might make it easier to do any special cam work, like fighter intro-esque cutscenes camera switches.
Big fan of easy here; easier is not always better, though. And what’s easy now may become a maintenance nightmare later. As mentioned above, really depends on the feature set you’e after. You may need to go as far as dynamically spawned components that affect a stand alone camera actor behaviour.
The Camera Manager allows you to override what the camera is doing:
Consider decoupling the camera from the fighters. Have a separate camera actor (I usually use a pawn in case it needs to be possessed), and have it talk to the Camera Manager class (which is hooked to the player controller) in cases where you want to produce unorthodox behaviours. The Camera Target is the actor the player controller is looking through - also referred to as View Target across the engine.
Thank you also for the great suggestion.
Yep, this is exactly why I wanted to consider it. I get that it’s a non-standard way of handling the camera, but wanted to really consider the whole system for the sake of my sanity down the road. “Measure twice, cut once,” etc etc.
One solution I saw recently that handles this case somewhat similar to what you’re suggesting- they made an actual camera manager pawn, independent of everything else. In my case, this pawn would be a child of the mode and get refs to the important actors during initialization for the later handling of different cameras.
As I considered it more, though, I’m still unsure if this actually will save me any time or implementation down the road. A possible benefit would be that I could potentially centralize all the behavior for the camera work in this special manager and import the pawn in all modes, which I could use to then freely switch between via different “modes”, e.g.
a “menu” mode for following the player’s cursor in a menu
an “adventure” mode for focusing only on the player pawn
a “fight” mode where the cam hovers between two fighter pawns, etc.
…But I could also just do that with a custom manager class on the pawn, so I don’t actually know if I’m making my life easier, haha.