By default, RPGJS does not use a database like MongoDB or Postgres. RPGJS is database agnostic
Two methods have to be used on the RpgPlayer
class
player.save()
player.load()
save()
creates a snapshot of the user's properties (position, hp, etc.). It returns the data in JSON format
Then save the player to a database, like Postgres
To load, it's load()
, it gives back all the properties to the player and reposition the player on the map
Here is an example with MongoDB:
https://github.com/RSamaium/RPG-JS/blob/v3/packages/plugins/title-screen/src/server/mmorpg/index.ts