Skip to content

pam-anderson/SpiritsOfWar_2.0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Communication Protocol between the Pi and DE2:

- Pi write [Msg Type][Data]
- DE2 waits for Ready flag to be set. Pi sets ready flag when done above step.
- Pi waits for Ready to be cleared. DE2 clears ready when it is done reading.

- Messages:
    0 Update health
        Pass current health and max health + team/character (11 bits)
    1 Update screen
        Pass screen type, eg. start, end, instruction (2 bits)
    2 Move cursor
        x, y location etc (9 bits)
    3 Highlight characters
        Pass player id and characters that are alive (3 bits)
    4 Play video animation
        Pass player id (1 bit)
    5 Calibrate video
    6 Record video
        Pass player id + camera frames (25 bits)
    7 Pixel drawer
        Pass sprite type (6 bits), colour shift (2 bits), and 
        x (5 bits), y (4 bits) tile coordinates
    8 Exit menu
        Draw or clear exit menu (1 bit)
    9 Change Turn
        Team number (1 bit)
    10 Change Writer
        Current reader becomes writer, and writer becomes reader, after
        successful message.
        
        
AI Implementation 
    Preferences : 
        Attack Priorities : 
            Archer = 0 
            Mage = 1
            Warrior = 2
            
        Closer Enemies :
            Closest = 0
            Mid = 1 
            Farthest = 2
            
        If within threshhold distances & has lowest health -1 
        
        If there is a tie :
            Go for the lowest health
            If still a tie : 
                Go for the lowest defence
                
    Special Conditions : 
        If within attacking range of an opponent and your attack range is greater than the opponents
        move out of attacking range of the enemy and attack the enemy. 
        
    class ComputerPlayer
        map, self, opponent
        
        findNextAttack
            return character to move towards/attack
            
        findPath 
            return path to get to the opponent 
            
        - get closer to the opponent, at worst maintain distance. 
        
        - avoid stopping within enemy attack distance if possible. 
            DFS around each opponent to depth of threshhold, add 1 to each tile found in the DFS. 
            DFS from current character to depth of the movement in last level of search, choose 
            lowest value tile (if applicable, else go to lower level)
            
        - keep distance values, choose path w/lowest distance. 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published