Jump to content
Ninjamida

Target selection in battle

Recommended Posts

So - here's a point that came up on another website, regarding the battle system in my new project.

 

To give some background info - it is absolutely critical that with most attacks, you can choose whether to target enemies or allies. The battle system is side-view, enemies on the left, allies on the right.

 

So, initially, my thought was - have a dedicated button for changing target party, while the arrow keys (or dpad, on a gamepad) select a target within that party. But someone pointed out that they feel it'd be more natural to have left/right switch party, and up/down to select a target within the party.

 

The issue I see here - what if we have, say, a formation of two enemies, one behind the other (but at the same Y coordinate). To me, it would feel weird to be using up and down. If it's a matter of "if you're already on the furthest right enemy, pressing right again will target allies, but otherwise it targets an enemy further to the right than the currently-selected one", that could work.

 

The other question is how exactly to implement it. Yes, for a human, it's easy to see "I have this enemy selected and pushed this button, so now I should have this enemy selected instead". Implementing an algorithm for it... not so simple. This actually pushes me towards actually using the up/down thing, perhaps combined with just not creating formations that have enemies in a straight line horizontally so the oddity of using up/down to (visually) move left/right between targets never comes up.

 

What's everyone else's thoughts on this?

Share this post


Link to post
Share on other sites

I personally would use X,Y and how to implement it depends on the side view script you are using.

 

Using X and Y would feel more natural imo. Itll also make navigating between everyone in the battle faster and more fluid.

 

If you want to use X or Y, then yes, you'll have to position them so their X or Y do not match. In this case, Y is a bit better since having enemies in a horizontal line would look odd in side view but vertical lines dont.

 

Share this post


Link to post
Share on other sites

Sorry - I think you misunderstood. I'm not asking "how do I make it work with script X". More like, "what kind of formulas should I be using to determine the new target"?

 

This is in an entirely custom engine, so "what script I'm using" isn't even a valid question. :P

Share this post


Link to post
Share on other sites

My advice would be to do something a bit more freeform. Depending on how the screen is laid out it could work in several different ways, but I suggest each option should act like a node in a linked list of nodes having it's own way of choosing what node to select next based on the direction you press. If you have two rows of enemies for example, you can construct it so:

 

          3   4
          |   |
(party) - 1 - 2 - (party)
          |   |
(party) - 3 - 4 - (party)
          |   |
          1   2

 

It dosn't have to be laid out like an even square grid, all you need is a general way to tell if something is left or right, above or bellow.  You can have 2 in one row and 1 in the other, or 2 in one and three in the other, or a random mess, or whatever. As long as each node has a way to figure out what the next node to go to when you press any said direction, it can work.

Share this post


Link to post
Share on other sites

I'd start with a coord. grid of some kind and have the formula look to see if that coord. is marked as occupied and skips it if not, then have that be assigned to whatever direction/end user function applies. Of course, the coord. grid is only for placement locators and has nothing or very little to do with what the end user sees on screen.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×