Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possessable AI #3

Open
BlastWind opened this issue Oct 7, 2021 · 1 comment
Open

Possessable AI #3

BlastWind opened this issue Oct 7, 2021 · 1 comment

Comments

@BlastWind
Copy link
Member

Movable main character

In UserView, set up camera correctly and do this:

switch(key){
 case 'W': mainCharacter.moveUp(); 
 case 'D': mainCharacter.moveRight();
 case 'S': mainCharacter.moveDown();  
 case 'A': mainCharacter.moveLeft(); 
}

Thoughts on what a possessor is and why we would make a possessor:

  1. I'm up late so sorry if these ideas become unsound in 2 days
  2. Instead of accessing an NPC or AI actor and then directly calling setPosition on it to shift position, I like using a master Possessor to take control of it and issue canonical commands. This might lead to better modulation, and we write less code when issuing several commands to the same list of actors.
    E.g.:

Instead of

ZombieActor.setPosition(lastPos - 3, lastPos - 4) 
RandomActor.setPosition(lastPos - 3, lastPos - 4) 
ZombieActor.throwTrap(x, y, fireTrap);  
RandomActor.throwTrap(x, y, fireTrap);  

We can maybe do:

Possessor.possess(ZombieActor, RandomActor); 
Posessor.issueCommandsToAll([
 { type: "throwTrap", params: { x: x, y: y, trapType: fireTrap }, 
 { type: "moveRelatively", params: { dx: -3, dy: -4 } }
])

The problem for this pattern arises when there are actors with many different methods (not enough similar commands).

In Possessor (to be made):

Possessor.possess(Actor toPossess) // possesses an actor, stop all other possessions
Possessor.addPossession(Actor toPossess) // possessor one additional an actor
Possessor.removePossess(Actor toRemovePossess) // stop possessing an actor
Possessor.refresh() // removes all possession
Possessor.issueCommandsToAll(command []) 
Possessor.issueCommands(Actor, command []) 
Possessor.issueCommand(command)
Posessor.setTemporaryMain(Actor) // experimental thoughts, what if we made a function that temporarily sets another character as the main actor (allows player input to move character and centers camera on it)? Maybe we get some ghost abilities that allows us to temporarily control other ghosts but leaves our original body vulnerable to attack? Maybe too much functionality. 
Possessor.revertMain() // give control back to original main character 

Command has schema:

{
 command_type: string; 
 params: Hashmap (aka a dictionary in python or just an object in javascript) 
}
@aaronamk aaronamk added the code label Oct 7, 2021
@anzuurin anzuurin self-assigned this Oct 7, 2021
@aaronamk aaronamk changed the title Codebase RampUp #1: Movable main character and possessable AI Possessable AI Oct 8, 2021
@amj0851
Copy link
Member

amj0851 commented Oct 12, 2021

Sexy pseudocode made by sexy man - not Andrew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants