GDC-WM / GDC-WM/2DGame2021

Possessable AI

Open
#3 1 comment 0 reactions 0 assignees View on GitHub
backlog code
Dominant language
C++
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

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)
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the existing UserView and actor APIs, since the issue does not name specific files or tests. Clarify the scope of possession, command dispatch, and temporary main-character control before implementation; the issue currently does not define a concrete completion test.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.