Jump to content

Patrol #1720


Recommended Posts

Hey guys,

I'd like to implement a patrol movement http://trac.wildfiregames.com/ticket/1720

But I think a small discussion about implementation details could be useful.

I know that you can already queue movements/tasks for a unit by pressing the shift key.

Hence, it should be not so elaborate to implement a patrol movement.

I guess every unit has a FIFO queue as a data structure for planned movements!?

So my suggestion is that a small piece of code checks whether the first (next) entry of the queue is equal to the last on.

If yes, we have a patrol movement and the first entry should be appended to the end when this point is reached.

Does somebody knows where that queue is implemented (before I spend too much time with searching :D).

_______

Additionally, I suggest visualising the entries of the queue in a different task. Otherwise, it would be very complicated to hit the first position again

(probably a small tolerance range must be implemented to simply hitting the begin)

  • Like 1
Link to comment
Share on other sites

Hey guys,

I was thinking about the right usability of a patrol. I have not played so many different games, so I am not sure which is a nice key + mouse combination for commanding a patrol.

@Initial situation: A (group of) unit(s) is selected

@Possibility 1:

Just a simple patrol between 2 waypoints.

control: press a hotkey or a gui button and select the second waypoint with a right click

the first waypoint would be the current position

advantage: simple usability

disadvantage: very limited

@Possibility 2:

like 1, but you must select 2 waypoints for a patrol

thus a bit more flexible

@Possibility 3:

Multi-point patrol

I think it will be complicated to control it with a gui button because you have to uncheck it after finishing choosing patrol.

But it would be easier just by using a hotkey. If the hotkey and the mouse button is pressed, the selected waypoint will be added to the queue

Therefore, it is possible to create multi-waypoint patrol and also add additional points to the same patrol later

What do you think? Do you have any nice experience with other games?

Link to comment
Share on other sites

Is dificult answer this in technical forum, because here only the programmer talk about coding, etc.

No, this is the development forum ;) not the programming forum ;)

As for the topic itself, I would say do like most things. I.e. have a single order, but allow the player to queue more orders with the shift-key. That should work both with the keyboard shortcut and the GUI button. It might take some work on the programming side as the first order needs to be put back on the end of the queue.

Link to comment
Share on other sites

So a patrol starts always from the current wayposition if the unit is not moving.

If the unit is moving, the patrol starts at the end of the move.

Both has the same implementation -> put it at the end of the queue!?

EDIT: the Y key is used yet? I won't use P because it's on the other side of the keyboard :D

And then shift+Y for queuing.

But there will be no queuing by GUI button, because I don't know a good handling!?

Edited by svott
Link to comment
Share on other sites

Use case:

The user sends a unit (or a group of units) to a start point p1 of a patrol.

While the unit(s) is moving, the user presses the patrol hotkey (or GUI button) to order a patrol between p1 and another point p2

When the unit reaches p1, it will automatically start with the patrol between p1 and p2

Also, a multi-point patrol can be ordered by pressing shift additionally.

______

That would be in my eyes pretty useful.

Link to comment
Share on other sites

Actually, thinking about it again, scratch what I said :P That doesn't make much sense. What should be done imho is to have one patrol order, but allow for queuing of waypoints during that one order (which I guess is one way to interpret what I wrote, but not if you take it literally (which would mean first patrol between a-b, then move back to b to be able to do a patrol from b-c, etc etc :P ) so it's better that I rewrite things =) ).

  • Like 1
Link to comment
Share on other sites

new implementation:

// A-B-A-B-..:
// if the user only commands one patrol order, the patrol will be between
// last position and the defined waypoint
// A-B-C-..-A-B-..:
// otherwise, the patrol is only between the given patrol commands and the
// last position (position of the unit at the time of the first order) is
// not included
// -- this is a design decision because the order queue can be extended at
// any time and this makes it difficult to estimate last walk back to the
// origin position
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...