turn processing discussed in PBM Design group (yahoo groups) From: "samayel" <nospam@domain.ext> Date: Thu, 07 Mar 2002 18:10:40 +0000 Recently in the PBMDesign group on yahoo, someone asked for suggestions on how orders should be processed in a turn. Here is one answer: ---------------------------------------------------------------------------- ------ well.... here is one way you could accomplish this... if you are on a big XYZ grid, (i.e. a multilevel dungeon) you could process orders cell by cell... with adjustments made for neighboring cells. for example: (use a fixed width font for this) ############################## #.............#..............# #..x..####....#..#####..x....# #.....#...3......#.x.+....x..# #...###..2..x.#..#####...x...# #.1...........#.........4.5..# ######..##############\####### #.................#..........# #.................#..x.x.x...# #......6..$..7....#.x.x8x.x..# #.................+..x.x.x...# ############################## Assume: numbers represent characters you can give orders x represents monsters, controlled by the game # = walls . = floor + = door, closed \ = door, open $ = gold or money here goes... The turn engine would process the FIRST order of a persons turn, going cell by cell, left to right & top to bottom until it hits a cell containing a character. (Technically the first to act would be the x at position 4,3 but lets keep it simple for now.) In this case the first one would be character 3 (located at 11,4). Depending on what character 3 wants to do, you would check surround cells for order conflicts. If 3 wants to attack x then check the status of x and any other characters or monsters within a certain area of effect (maybe determined by line of sight). In this example you would also check player 2. If 2 is faster than 3, see what his orders are in case they would affect the outcome of 2's orders. If they do (i.e. he attacks faster, or he attacks player 3...) then execute his orders, and flag him so you dont execute them twice. If all he is doing is moving in the other direction, then disregard him and process hi s order when it is appropriate. The next character up is player 2. If we already processed his turn, then ignore him, otherwise process it just like player 3. Check for conflicts, and then evaluate. Next is player 1 (we're ignoring the monsters for now... remember) he doesn't need to check for conflicts with any other players, as none are in line of sight (his area of effect), well 2 might be, but we'll say he is out of effect range. Player 1 advances one step forward. Next is player 4. Next to him, and definitely in his area of effect, is player 5. They both want to attack x. This would be a conflicting order, because there is a chance that 5 might kill x before 4 even swings (if 5 is faster) so we compare stats (speed?) and see who actually goes first. Remember if 5 were just walking away we wouldnt have to bother with the comparison. so 5 is gonna attack, and he's faster, so he goes BEFORE 4. He wounds x, but doesnt kill it. so then 4 goes, and then 5 is skipped because he already went. Next up is character 6, he wants to grab the gold, so he advances 1 cell to the right. Then character 7 (who also wants the gold) advances one square to the left. These aren't conflicting orders YET. so they process as normal, but once they get to the point where they are actually trying to pick up the gold, THEN its a conflict so the faster character would get it. and of course you could always add a small element of randomness to that so it wouldnt be TOO formulaic. and yes, poor player 8 is practically screwed. I'll let you figure out how he would be processed.... lets just hope the monsters are slow. once everyone's first order has been processed, start over with the next order, etc... until all orders for the turn have run for all players. What about monsters, you ask? Well... technically they should be processed just like the players, except instead of following orders, you would have to analyze the environment and then make a determination on how to act. Factors to consider would be: anger, fear, hunger, health, intelligence, and speed (I'm sure there are others but you get the idea). I hope this helps, obviously the examples are slanted towards fantasy rpg style since thats what I'm into, but the concepts are sound I think. ---------------------------------------------------------------------------- ------ If this holds any interest, come by and check out the PBMDesign group on Yahoo if you haven't already... we can always use more opinions, questions, answers, etc. Chris Williams Moderator PBM Design Group Referenced By Up