1
$\begingroup$

I am building a strategy game where units can interact with each other.

As input I am getting a list of actions. I need to output a scheduler, that will tell when to start each action. The goal is to find the shortest time combination of all the actions.

Action is defined as interaction between two users or user with him self, it build from 4 parts:

  1. performing unit - the unit that performs the action
  2. receiving unit(optional) - the unit on witch the action is applied
  3. supported actions - A list of actions that the receiving unit can perform while applying this action on him.
  4. action time - how long does it takes to execute the action

Rules:

  1. Units can only perform one action in a time
  2. Units may have to perform more than one action

The best solution will be: Is to run all those actions in parallel. There are two things that stops me from doing it.

If more than one action have the same performing unit, they cannot start simultaneously as units can perform only one action in a time.(Rull 1)

The other problem is actions with receiving unit. I need to make sure that the receiving unit is currently performing one of the supported actions(defined in action part 4), if it's not, this actions cannot be started.

In case of actions without receiving unit, they can all be started simultaneously. How ever I need to make sure that I am not left with action that have a receiving unit, that cannot be started as the receiving unit already performed all his actions.(So supported action will never be started)

$\endgroup$

closed as unclear what you're asking by D.W., lPlant, FrankW, David Richerby, Raphael Jul 15 '14 at 12:34

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ What scheduling algorithms have you looked at? Also, Is there a necessary sequence of actions, does one have to be done before the other or can they be done whenever, also what exactly do you mean by associated with? $\endgroup$ – lPlant Jul 14 '14 at 19:43
  • 1
    $\begingroup$ I don't know whether it's a good idea to post two separate different versions of the same question. The problem is that rather than fixing the problems in the older one (the problems that made it vague and unclear), you left it around in a problematic state. It might be better to edit your previous question into an acceptable state. The purpose of this site is to build an archive of high-quality questions and answers that will be useful to others beyond merely yourself, so leaving around old questions in a bad state is not ideal. It might be better to curate your old questions. $\endgroup$ – D.W. Jul 14 '14 at 23:54
  • 1
    $\begingroup$ Also, I find this question unclear. What do you mean by "can be associated with"? Is it a symmetric relation? What exactly are the constraints on what actions can be performed simultaneously? If actions 1 and 2 can be associated with each other, is it illegal to perform them simultaneously? legal? does it depend upon some other criteria? (if so, what?) Please try to articulate exactly which sequences of actions are allowed, based upon the properties of the actions; don't force us to infer it. Finally, are there any "happens-before" constraints, where action i must occur before action j? $\endgroup$ – D.W. Jul 15 '14 at 0:05
  • 1
    $\begingroup$ Please don't edit your question by just adding "Edit: some extra stuff that should have been in the original question" to the end. We have revision control, and all revisions are accessible by clicking on the link under your question; you don't need to mark your edits. Instead, re-write your question to be a well-posed question that is as clear as possible, for someone who has never seen it before, without detritus from previous edits. $\endgroup$ – D.W. Jul 15 '14 at 0:42
  • 1
    $\begingroup$ I still don't see a clear, precise specification of which sequences of actions are allowed or not. (Example: you say "When one unit is attacking the other unit need to take damage." So what? How does this affect where that action can appear in the sequence? The question doesn't say; we are forced to guess.) "look as real and logical as possible" is not a well-defined goal. Also, please try to abstract the question. What kind of constraints do you have? "Action x must occur before action y"? (happens-before) "Action x cannot occur in parallel with action y"? (not-simultaneous) Something else? $\endgroup$ – D.W. Jul 15 '14 at 0:44
2
$\begingroup$

Your set of rules is self-conflicting. You require

Same unit cannot perform two actions in parallel

but also

When unit perform attack, the interacting unit must perform take damage [...] during the attack-action time of the performing unit.

and

Multiple units can attack single unit at once

In other words, you require that multiple take damage actions be performed simultaneously while demanding that that may not happen.

$\endgroup$
  • $\begingroup$ I understand that multiple take damages can be merged together. And probably the same for miss. $\endgroup$ – Apiwat Chantawibul Jul 15 '14 at 11:47
  • $\begingroup$ I don't see the conflict here, unit a attacks unit b, while unit b perform take damage. The performing unit a doing one action while the interacting unit b doing one action. The restriction is on the SAME unit. Unit a cannot perform attack and move in the same time. Units a and b can simultaneously attack unit c iff unit c perform take damage. In the same time unit e can attack unit f. Please look again on the definition of performing and interacting units, do I need to edit it? $\endgroup$ – Ilya Gazman Jul 15 '14 at 12:37
  • $\begingroup$ I think that you answer should be a comment, you are pointing on halls of the question rather than answering it. $\endgroup$ – Ilya Gazman Jul 15 '14 at 12:40
  • 1
    $\begingroup$ @Ilya_Gazman The answer is "it's not possible". (I think you mean "hole"?) This may be because of a fundamental issue with your model, or maybe just because your description of it is lacking. How can we tell? $\endgroup$ – Raphael Jul 15 '14 at 13:08
  • $\begingroup$ @Raphael You can tell by asking me in a comment. But can you reply for my first comment. I don't understand the conflict. $\endgroup$ – Ilya Gazman Jul 15 '14 at 13:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.