DEV Community

Cover image for Today I learned about basic turn-based combat logic
Yuvraj Singh Kumpavat
Yuvraj Singh Kumpavat

Posted on

Today I learned about basic turn-based combat logic

So the way that JRPG framework make it happen is:

  • They created 4 distinctive character blueprints with both world and battle base. At first I thought why are they doing like that, but then I realized it was mostly like an oversimplified way to get and set characters in the world and then in the battle. I can't think of a better way to deal with this because this seems pretty okay for me to work on.

  • They created components and I mean a lot of Actor Components. The main combat logic is in Battle Manager. There are others like Action Manager or Character Stats, etc but I feel like they are meant to be used on specific characters to give their own stats and action events since there was a comment with main events empty to set it once they create the child blueprint of Character Battle.

  • But one thing that troubles me the most is the amount of casting. Like I have never seen something so overused in my entire time of learning about Unreal Engine. I still remember my professor, in the first year of uni or second, said to avoid casting as much as possible like not totally diminish the use of casting but try to not go overboard with numerous calls of blueprint casting. I saw a tutorial on how to use Blueprint Interface instead of casting to put some ease on the memory usage. I think this might come in handy when I try to port my game on Android since the real challenge is not making game, it is to port that said game on a low-end device.

I kind of expected the Battle Manager class to be one hell of a spaghetti blueprints but damn it is quite easy once you know what you're doing. I'm currently bogged down by errors due to me changing the whole order of variables and classes. It is an easy fix because I need to reference it properly, clearing the older links with a new ones. But I really like that one post on Reddit on explanation about turn-based combat; he said it is one giant if-else statement from a bird's eye view and I think that was probably how back in the 80s or 90s turn-based combat were programmed.

But anyway, I'm slowly making some progress, even though I can't see the game working properly because there are still a lot of blueprints pending to be rewritten to fit my data assets and variables. Once that is finished, I can finally do some proper debugging because I'm spiritually aware of the humongous amounts of bugs, especially logical ones or null character ref, will pop up. Continuing, once the base combat logic is finished then I will be left with designing UI, designing characters, making frames for that characters, environment art, making comic panels for the cutscene, making a storyboard so I could make those comic panels, making music (I will be honest, making a soundtrack for my game seems quite a heavy task. I wish someone lends me an electric guitar for a while so I could learn it and make some music)

So in conclusion:

I am grateful to make such a heavy progress in the game. Patience, discipline and determination will help me a lot in life.

Top comments (0)