Skip to content

Action Management ~ Teleportation Effect Design

Borja Sotomayor edited this page May 15, 2021 · 3 revisions

Team Action Management - Teleportation Effect Design


Note that even though I am leaving this wiki up, this design will NOT be implemented into chiventure - instead, teleportation will be defined through custom actions.


Introduction - General Ideas

While the original issue was to "introduce teleportation as an effect of performing an action," I have decided that it would be better to instead introduce teleportation as a new supported action.

  • This action would NOT, under normal circumstances, be allowed to happen
    • Ex: a player cannot just type "TELEPORT [place]" at the beginning of a game and have the action automatically complete
  • This action is meant to be used under special circumstances
    • Examples:
      • Used in a teleportation spell unlocked via skill trees
      • Used as an effect of completing an action (such as interacting with an object or talking to an NPC)
  • This design focuses ONLY on the implementation of teleportation as an action
    • This design will NOT define any special circumstances in which it can be used
  • While teleportation will not be able to be used with the current chiventure code, it could be useful down the line when special circumstances are implemented

Implementation Details

  • Action Management include
    • action_structs.h -> Add "TELEPORT" to the actions enum
  • Action Management src
    • get_actions.c -> Add {"TELEPORT", PATH} to the valid_actions list
    • actionmanagement.c -> Alter do_path_action; additional details below
  • Action Management tests
    • test_get_actions.c -> Update/add to tests appropriately
    • test_path_actions.c -> Update/add to tests appropriately
  • do_path_action
    • In progress

Final Notes

I have no other notes regarding this design at the moment.


Initial Brainstorming

I am leaving the notes that I came up with at the beginning of the design process down here in case I or anyone else need them for future reference. However, these should not be considered part of the final design. Remember that the original issue was to introduce teleportation just as an action effect, so some of these notes are written with this context in mind.

  • Relevant files:
    • item.h
      • game_action_effect_t -> Talk to Isaac about how he's overhauling it
        • Add action as a possible effect? Make teleportation into a new action? -> potentially be useful for future such as teleportation as a spell
    • action_structs.h
      • New action? Would be tempted to use go, but that requires checking a path while teleportation can throw a player wherever -
      • Overhaul do_path_action to generalize movement? do_move_action? Helper functions go, teleport
    • game_action.h/game_action.c
      • do_effect/do_all_effects -> Looks like these functions just change the attribute to modify; again, knowing what the game_action_effect_t overhaul will look like will affect what I do with this
    • actionmanagement.c
      • If teleportation = only an effect - In theory, should not have to change anything here - do effect will handle what happens when teleportation occurs
      • If teleportation = new action - hoo boy
        • Overhaul do_path_action to generalize movement - would have to change parameters; how to specify teleportation?
        • "TELEPORT [room]" -> "TELEPORT [path]"? Just use to wrap around room so that function header does not change *
        • Make sure to update get_actions.c so that cli registers stuff appropriately
    • operations.c
      • kind2_action_operator -> do different things if "GO" or if "TELEPORT"
      • Or is that even necessary for now? After all, user should NOT be allowed to teleport normally, so if path find does not work then teleport via typing command "TELEPORT [path]" will fail -> leave that as a problem for someone else? Yeah I like that idea
    • game.h/game.c
      • move_room -> General enough that it can be used for teleportation with no changes; does not check for connections, just moves to room as long as the room exists.

Perhaps make teleportation available as an action, make action available as an effect BUT make non-effect teleportation illegal normally (and then custom actions can play with it as well?)

  • Create helper function for WDL -> add teleportation as effect(item, item_action, room_to_teleport_to)
  • Implement teleportation as an action, write tests for it
  • Could be useful down the road if teleportation can be added as an effect, used as a spell, etc; but as of right now, teleportation would not be able to be utilized
  • Therefore, is it even useful to implement this now?
  • Clean this up and ask the team tomorrow
Clone this wiki locally