Vampirism - Become a vampire!

Vampirism - Become a vampire!

16M Downloads

Technical considerations: Minions

maxanier opened this issue ยท 2 comments

commented

When having minions in the world there are a couple scenarios that have to be considered.

  • Lord leaves the game
    • minion loaded
    • minion loaded in a different world
    • minion unloaded
  • Lord changes dimension
    • minion loaded
    • minion unloaded
  • Chunk with minion unloads
    • lord present
    • lord not present
  • Chunk with minion loads
    • lord present
    • lord not present
  • Minion dies
    • lord present
    • lord not present
  • Lord gives new order
    • minion loaded
    • minion not loaded
  • Client side?
commented

Approach "tickets" based in FactionPlayerHandler (FPH).
Minions entities are interchangeable, but there is MinionData that stores the important information (health, inventory, name, position, etc.).
If the minion is not present it is stored in the FPH.
Datasets are unique and assigned to a minion slot permanently.
Minions only store that unique slot id in their NBT. So if they are loaded they have to request the dataset from the FPH

  • World saved/closed with all entities loaded
  • Lord leaves the game
    • minion loaded - have to store entity references (maybe entity ids) and iterate them to request data and invalidate entity in some event
    • minion loaded in a different world - have to store dimension as well
    • minion unloaded - data already stored in FPH
  • Lord changes dimension
    • minion loaded
    • minion unloaded
  • Chunk with minion unloads
    • lord present - store data in FPH
    • lord not present - minion should already be invalid
  • Chunk with minion loads
    • lord present - get data from FPH
    • lord not present - can't get data, have to remove entity and wait for lord to request minion
  • Minion dies
    • lord present - Notify lord
    • lord not present - Should not be possible as minions are invalid when lord unloaded
  • Lord gives new order (task or TP)
    • minion loaded - a) have order ready for request b) iterate minion reference
    • minion not loaded - a) Have order ready for request b) create new entity from FPH data
  • Client side?

Additional

  • Minion loaded, but its slot is already in use - Just remove entity
Questions
  • Allow entities in a different dimension
  • Or maybe adjust to even allow entities while player offline
commented

Approach "ticket" based in a global (save game wide) WorldSavedData (MWD)
Minions entities are interchangeable, but there is MinionData that stores the important information (health, inventory, name, position, etc.).
If the minion is not present it is stored in the MWD.
Datasets are unique and assigned to a minion slot permanently.
Minions only store that unique slot id in their NBT. So if they are loaded they have to request the dataset from the MWD.
Lord player inform the MWD about their commanding capabilities and interact with their minions via the MWD

  • Lord leaves the game
    • minion loaded - minions can just continue or if desired be unloaded as well
    • minion loaded in a different world
    • minion unloaded
  • Lord changes dimension
    • minion loaded
    • minion unloaded
  • Chunk with minion unloads
  • Chunk with minion loads
  • Minion dies
    • lord present
    • lord not present - Need to queue message somehow
  • Lord gives new order
    • minion loaded - directly notify maybe
    • minion not loaded - Either queue task or load minion at different position
  • Client side? - *MWD not available client side

Need two way communication via MWD:

  • Minion -> MWD -> Lord (if lord is present, direct access is possible)
  • Lord -> MWD -> Minion

This means minions can exist when lord is not present