Advertisement
T3RRYT3RR0R

Batch pacman AI approach

Jan 9th, 2021 (edited)
1,092
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 2.27 KB | None | 0 0
  1. Solution approach for upcoming pacman games GHOST AI's.
  2.  
  3. clone food sprite list and periodically [each n moves depending on ghost] use rng to select new ghost target tile, trimming list after evaluating the ghost current coordinates and target cells cordinates.
  4. traverse list from position, generate new list when either of the following is true:
  5.   - Ai reaches target tile
  6.   - Pacman is closer to ghost than ghost is to target tile
  7.   - ? Update list when any node is encounterd; Mantain list of nodes
  8.     - ? maintain lists for each ghost with their position relative to pacman and assess string length / value to determine the shorter path.
  9.  
  10. Food sprite list must fall within batch line limit. Original pacman grid size of 28x 36 cells should support this.
  11.  
  12.  
  13. Add refresh.sprite macro to Game_Engine.bat macro to support food trail reset
  14.   - iterate over sprite list and test cell for definition. if not defined, define using sprite list value.
  15.   - output any re-definitions to foreground file, type file.
  16. Expand refresh.sprite macro on food collection.
  17.  
  18. ? Additional Macro's for Game engine Get.Trail Follow.trail
  19. ::: [ ? Single Cell Sprites only - may be expanded for multi cell sprites ; though intent is to limit actions for efficiency ]
  20.  - Get.Trail
  21.   - Arguments:
  22.    - Object identity via substring modification
  23.    - Target Cell 0,0
  24.    - Origin Cell 0,0 [ Obj.ly;Obj.lx ]
  25.    - List Varname Containing Full Trail
  26.   - Actions:
  27.    - ? Clone Trail, Trim via substring modification retaining positions between Target Cell and Origin Cell
  28.      - Trim list to consider Relation of Target 0,0 and origin 0,0 and:
  29.       - If Target x/y GTR origin x/y 0,0 remove cells containing x/y values LSS than origin
  30.       - If Target x/y LSS origin x/y 0,0 remove cells containing x/y values GTR than origin
  31.    - Return trimmed trail to obj.path variable
  32.  - Follow.Trail
  33.   - Arguments:
  34.    - Object identity via substring modification
  35.    - Collide / Capture Args
  36.   - Actions:
  37.    - Test next cell in lists definition for collide / capture args, return values if True
  38.    - Move Object to Next cell in list
  39.    - remove cells new location from list
  40.    - Update cells definition with Objects value
  41.    - Undefine and clear cells previous position using Obj.l{X/Y} values
  42.    - Update Obj.lum{X/Y} values
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement