strategy/pattern to create working chain -
i need pattern/strategie solve problem. know book or read up?
my problem (all theory): have kind of game , there have 2 npcs. workers, have repair stuff. need different materials depending on error. when error comes in calculate npc fastest. calculate each npc every move npc have take (walking, waiting,...). workers occupied time task, have consider in calculation.
now thoght use same code (with little modification) let npc walk after decided 1 fit best task, in eyes that's huge redundancy , avoid that. have stop tasks midway , let npc go work somewhere else. don't think easy handle way.
so second thought create working chain. in time calculation decide npc have to/where walk. could, @ point, add writes action list. loop execute actions , easy stop @ point. (of course have 2 lists after each calculation, 1 each npc. fastest used.)
if there pattern or alike came with, appreciate if point me source.
or there better way solve that?
-regards
edit:
the time calculated in different ways, e.g. when worker has walk somewhere, time (distance/speed) calculated. different waiting times there different values different occasions. in end sum of times returned. whole method more adding different times. times right, looks best routes depending on position of worker. actions order can different each time ... actions methods, walk(start, dest) or wait(seconds). thought, when method looks best order of actions calculation right, store in kind of list use in actual animation ... store actions in array entries are: number stands method use , rest parameters
Comments
Post a Comment