Hi All,

I am trying to get my head around real time battles and get them working properly in my scene.

Currently I have a simple scene with 2 combatants, Player and Enemy. The enemy is spawned from the Real Time Battle object and that seems to work ok when my player enters the area.

The problem I have though is that as soon as the enemy is spawned, it seems everything slows down, as in if I walk and try and turn the whole system lags. If I stay still and turn it is fine. The other thing I notice is that my enemy turns when my player turns, but it's a directional turn, so if my player is facing left then the enemy also faces left and changes if my player changes.

I am using a third party character and camera controller which work fine when not in a battle.

So I guess what I am looking for is does anyone have a simple step by step on how to setup real time battles correctly? Most of the tutorials are geared towards turn based battles with just a short section on real time battles...

I'm not interested in any abilities or statuses or anything like that at this stage, just the basics..

I'm not even sure that there can be a simple answer :)

Thanks
Dean
  • Which third party controller and camera are you using? It sounds like you've got it set up such that both the player and enemy are responding to player input. If that's the case then they might both be trying to set the camera position as well.

    Usually you'll set up AI controlled characters a bit differently; for example they may use a NavMeshAgent instead of a character controller that responds to input.
  • Hi Keldryn,

    yep, ok, the simple things you overlook when your looking too hard... that was exactly it. Had the character controller assigned to the enemy as well which in turn was messing with the camera...

    Thanks
  • Also, make sure that your AI controlled combatants have a Timeout defined in their AI action settings. Otherwise they'll spam actions one after the other - especially if they're not yet animated this can lead to strange looking behaviours (e.g. instantly killing the player due to using 100 attacks per second).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks @gamingislove, yep, got that...

    Ok, the bit I am struggling with is getting the third party controller (Opsive) to talk to Ork in relation to the Control Maps and Input Keys, I am thinking that because I am using a third party controller that the Control Maps and Input keys are irrelevant? is that right?

    I believe I have everything setup right in terms of a weapon and my character, I can equip a weapon and the character is holding it but I can't seem to get it to actually use it.

    Please excuse my ignorance but should this part be handled by Ork or by Opsive?

    It's hard to get my simple brain around this :)

    Thanks
    Dean
  • edited May 2016
    @dharry, you can take a few different approaches to this.

    1. Let ORK manage everything You can have the TPC essentially just respond to movement input (including climbing, jumping, etc) and let ORK handle the input for any discrete action (attack, cast spell, etc). So you would configure your Input Keys in ORK, associate them with ORK Abilities through Control Maps, and then play any animations via the Battle Event for that ORK Ability. In many cases (such as attack), you will probably end up activating a TPC Ability on the controller. You won't be using any of TPC's weapons and combat systems here, just ORK's.

    To put that in simpler terms (perhaps), instead of having the various TPC Abilities being directly activated by player input, ORK would be checking for player input and then directing TPC to activate the appropriate ability.

    2. Let TPC manage everything You can let TPC handle all player input and use TPC's combat and weapon systems. You would then need to write some custom scripts to have TPC's combat system use ORK's status values and formulas instead of using the basic combat stats provided by Opsive. TPC's combat system uses raycasts to determine if a target was hit, while ORK's uses colliders (with damage dealers and damage zones), so there would be a fair bit of work involved in reconciling the two; most likely you would end up keeping TPC's combat system and pulling data from ORK to use for calculating damage.

    3. A hybrid approach As in #1, you let TPC respond to movement input, as it excels at that and ORK's included character controller is rather basic. I have tried an approach similar to #1 using ootii's Motion Controller, and I found that there was always a slight but noticeable degree of latency when attacking (I assume due to the sequence of pressing a key -> use ability -> activate an event -> activate a motion on the MC). MC and TPC have a lot of similar design principles; TPC's Abilities and MC's Motions are conceptually equivalent.

    So in this hybrid approach, you let TPC handle what it is good at and ORK handle what it is good at. If timing of attacks is an important aspect of gameplay (such as stringing together combos), then you may want to let TPC handle those. You can let TPC handle player input for attacks, so that it can activate the appropriate ability and animation. But instead of using TPC's weapons and combat system, you can still use ORK's (damage dealers and zones, etc). This involves writing your own custom TPC Abilities and having them activate the corresponding ORK Abilities via script. More or less the opposite of the usual ORK approach (where you use the Ability and then its Battle Event plays an animation or calls an ability on another component).

    You'll need to experiment to see what works best for you. #1 is going to be the easiest method, as there is less back-and-forth communication between ORK and TPC and the logic flow is easier to keep track of. It also requires the least amount of scripting, if you're not really into that sort of thing.

    #3 is likely to require the most amount of work, but will give you the most control over the end product. You don't have to make as many compromises here, as you use each asset to do what it is best at. But it requires a lot of scripting and keeping the logical flow easy to follow can be a challenge.

    I did a quick prototype of #3 using ORK and TPC, but it was with TPC 1.2, before the big overhaul of melee weapons in v1.3. It worked reasonably well, but there are a lot of features in 1.3 that would be nice to take advantage of. I haven't spent long enough looking at the 1.3 source code to get much of an idea as to how I would go about integrating it with ORK.

    Post edited by Keldryn on
  • edited May 2016
    @Keldryn,

    Awesome reply!! Thanks for the detailed reply :) I much more akin to option 1 due to less coding involved... not that I shy away from coding (I do it all day every day for my day job) but i'm trying to do as little as possible in Unity... and besides, I quite like the Ork inventory, equipment and battle setup.

    I've got everything setup, well I thought I had but I am missing some crucial piece somewhere as I just can't get a battle action to run... go to battle area, enemy spawns, walk to enemy but can't seem to attack.

    I'll go back over everything and double check.

    One assumption I have made is that a real time battle is setup pretty much the same as a turn based battle but you just change the timeout on the AI combatants.

    "To put that in simpler terms (perhaps), instead of having the various TPC Abilities being directly activated by player input, ORK would be checking for player input and then directing TPC to activate the appropriate ability."

    Ok, feeling a little dumb at this point but how exactly would you do that?

    Thanks
    Dean

    Post edited by dharry on
  • @dharry, I'll respond in full later today when I get the chance, but check out these two links:

    Calling a TPC Ability from an ORK event: http://forum.orkframework.com/discussion/3108/calling-a-harvest-animation-from-tpc-character

    Your basic set up for real-time attacks should look something like this: http://forum.orkframework.com/discussion/comment/17837/#Comment_17837

    Obviously you'd sub a call to activating the TPC Ability instead of playing animations through the ORK battle event.

Sign In or Register to comment.