discord-quest / discord-quest-bot

Discord bot for the Discord Hackweek.
GNU General Public License v3.0
2 stars 0 forks source link

Represent worlds #8

Open CHATALOT1 opened 5 years ago

CHATALOT1 commented 5 years ago

"If each dungeon is going to be prebuilt, we could probably represent it as a 2d array then store dynamic state from that dungeon for each player (ie health, chest opened etc)" - @tcmal

tcmal commented 5 years ago

Have done a first draft of this, as an overview:

ActiveWorld:
    world_name = CharField(20) # Right now maps aren't stored in the database
    player_id = ForeignKey('Player', related_name='map')

Player:
    discord_uuid = CharField(20, primary key)
   # todo

abtract Entity:
   x, y = int
   active_world = foreignKey('ActiveWorld', related_name='entities')
    unique_together=((x,y,active_world))

then other entities can implement Entity as you'd expect & add their own attributes.

Only issue is the World isn't currently stored in the database, meaning it needs to get got from somewhere else at somewhere else. it could be stored in the database however depending on what we want a World to be, we might want it under VCS.