what I'm looking for is advice on what I can do in the editor and what I have to do with custom code like deriving from TurnBasedBattleSystem, ORK selection/targeting classes, etc.
my game will be a sci-fi turn-based RPG in the style of CRPGs like Baldur's Gate, Divinity: Original Sin 2, Wasteland, Solasta, etc. I won't be using a grid.

my combat system is a little different than the typical. instead of executing actions as they are selected, all actions from all combatants are run at the end of the round simultaneously (using classic, dynamic options).
I won't be using the battle menu but instead use shortcuts. here is an example from BG3 (from official site) of what my UI will lean towards:

image

I have been trying to solve some of my issues individually with little progress. I was hoping more context would help.

Here is an example of typical CRPG combat mechanics:
1. combat order is determined (initiative).
2. combatants take turns in combat order.
3. action points are used. sometimes a separate move meter.
4. player’s turn starts in a "selection" type mode. examples of actions permitted (using mouse):
a. mouse over ground:
1. shows a target icon/effect on ground.
2. shows distance and AP required for move.
b. hovering over "things" (abilities, interactables, combatants, etc.): show an info UI.
c. clicking on ground moves character to that position.
d. clicking on interactable uses it (moves character to it first).
e. clicking on shortcut UI goes into target mode (if not use on self).
f. clicking on a combatant directly (not through shortcuts) uses the default attack (weapon in hand).
5. reactions/interrupts: attack of opportunity is an example.
6. player can end turn anytime.
7. if AP = 0 then the combatant’s turn ends (sometimes automatically).

here are mechanics specific to my game:
as mentioned above actions are queued up during a combatant’s turn then at end of round all combatants run through the (their?) queue simultaneously (round-robin) – same as ORK does now I think.
8. on combatant’s turn they plan what they are going to do (see waypoint system below).
9. initiative is still used but in two ways. in the combatant’s turn (planning part) the order is reversed. there is a chance (combat awareness check) that the combatant can get insight on what previous combatants have planned and use that knowledge to plan their turn. during plan execution (end of round) the original initiative order is used.
10. just using action points.
11. waypoint system:
a. click on ground: places a "waypoint" which implies a move (action automatically added).
b. click on waypoint to select it (last waypoint placed is "selected" by default):
1. add action (via shortcut UI, etc.): choose an ability, item, etc.. player then picks targets.
2. remove waypoint. any associated actions are removed.
3. remove waypoint action(s).
c. drag waypoint to reposition. affects associated actions (action points, distance, etc.). may be too complicated (more trouble than it’s worth) to implement. this may fall into the "nice to have" bucket.
d. clicking on a combatant directly adds an "attack" action to the selected waypoint if one exists. If not, a waypoint is created at the player's current position.
e. hovering over waypoint displays an "indicator" (lines, highlighting, etc.) of all the targets of associated actions.
f. hovering over waypoint action does the same but just for that action.
12. if AP = 0 then the user will need to end their turn or modify waypoints. ending turn automatically may be an option.
13. reaction system: at end of round when all combatant's actions are running game state will be monitored. depending on what happens the AI may be allowed to change (replace?) what they do next. For the player, a UI will be shown with options.

example:
combatant's target may not be in range or behind an obstacle, etc. by the time their current queued action is used.
combatant gets chance to decide to perform action or not.
scenario: AI targets player with a laser gun during planning part of turn.
at end of round (plan execute part of turn) the player goes behind an obstacle. AI has a choice to shoot or not. if the AI chooses to shoot the obstacle will be hit instead.

ORK: 3.7.0
Unity: 2021.3.9f1
turn based (classic, dynamic)
Thank you,
Mike Malone
  • I'll focus on the more complicated stuff, let me know if you need answers for other things as well :)

    Generally, you'll need a custom variant of the TurnBasedBattleSystem class, so just create a new class (in your Unity project, doesn't require changing ORK's source code) extending from TurnBasedBattleSystem.

    Override the AddCombatantAction function - this is called when a combatant selects an action and usually handles some final checks and adds the action to the battle's action list.
    In your case, you'll use it to handle your action selection/planning phase and waypoint stuff. Instead of adding the actions dirrectly to the battle's action list, you need to build a custom handling in your custom battle system implementation and only add the actions at the end of a combatant's turn (or when all combatants are finished).

    The waypoint stuff will be tricky. There isn't really a way to 'assign' an action to a waypoint like that (unless you write something for this in your custom action handling).
    Actions can be considered to be at a waypoint because they're in the list after the move to waypoint action, so you could find the selected waypoint in your custom action list and remove the actions afterwards or add a new action there ... and get any other info you need.

    The reaction system is best handled in the schematics animating your actions - since the action that's being animated is available as selected data via the key action, you can somewhat automate this, e.g. the In Use Range node can check an action from selected data with user/target to see if the targets are still in use range.
    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!
  • I'm afraid I need more help on some of the basics. I've been doing a lot of debugging and experimenting but so far, I can't even get an ability to run (from code in this case).

    assuming I can get the desired ability to my combat system and add it to my list, what is the correct way to "run" it?

    what function or event do I use that signals end of round (after everyone has ended their turn)?

    I'm also concerned about how to integrate (make best use of) my code with ORK. I'm still not clear what ORK code I should be using (should I use the action list (CombatantActions, etc.))?

    I'm outside what the docs and tutorials can help me with. I feel like I have to learn the ORK codebase (battle system related at least) to make progress. It's going to be a while before I know enough to work with the ORK code.

    If I can work out the combat system, I'm hoping I can use the rest of ORK without too much trouble.


    ORK: 3.7.0
    Unity: 2021.3.9f1
    turn based (classic, dynamic)

    Thank you,
    Mike Malone
  • Well, yeah - you'll have to learn a bit about ORK's code (at least battle system related) if you want to write a custom battle system. Since you're basing it on the turn based systems, I'd recommend to check out it's code and get familiar with.

    You'll usually add an action to a combatant via it's Actions sub-class:
    combatant.Actions.Add(action, newTurn);
    action is a BaseAction instance representing the used action (e.g. an AbilityAction or ItemAction), newTurn is a bool value (true if you want to start a new turn).

    In the battle system, you can call PerformNextAction() to start the next action - depending on the system and it's setup that'll react differently, e.g. classic turn based would keep firing the actions until all are used and start a new turn.
    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!
  • Targeting.

    I'm going to start working on waypoints. one aspect of the feature is targeting. the origin of the targeting is the last (or selected) waypoint and not the combatant.

    It looks like I can't use ORK's editor to set things up (what I expected). It's looking like I have to write custom code (what I expected).

    Is it possible to use ORK code? can you point me to code (classes, etc.) I should look at? any advice on how to approach the implementation would be welcome.

    ORK: 3.8.0
    Unity: 2021.3.11f1
    turn based (classic, dynamic)

    Thank you,
    MMalone
  • The ability's or item's target settings hold the use range.
    There is a static function to get the target settings from an action or shortcut instance: TargetSettings.Get

    The target settings has multiple functions to check if a combatant is in range or get the targets in range - however, all of this is based on combatants, not positions (due to also taking radius into account).
    So, the easiest way to handle this would probably be shortly having the combatant placed at that waypoint while getting the targets.
    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!
Sign In or Register to comment.