Coder Social home page Coder Social logo

Comments (3)

SirSerje avatar SirSerje commented on June 10, 2024

Schema for session :

_id: "KLYWJadQyXL0ICm7unAFwvyhjWZsLnX0"
expires: 2019-04-10T13:29:35.351+00:00
session: {"cookie":{"originalMaxAge":14400,"expires":"2019-04-10T13:29:35.351Z","httpOnly":true,"path":"/"},"userId":"5cacbcd775838b370714cd80"}

Schema for user:
Screen Shot 2019-04-10 at 4 32 49 PM

I propose to create new Collection kind of:

id: unique id
owner: link to user id (1 user can't have more than one account)
characters: [...]
quests: [...]
graveyard: [...]
playerinfo: [...]
//shoping items should be specified for each character

from unexpected-journey.

SirSerje avatar SirSerje commented on June 10, 2024
let item = {
	id: 0,
	name: "Shirt",
	wear: true,
	characteristic: {
        str: 1,
		int: -1,
    }
	//добавить износ
	//добавить стоимость
}
let character = {
	id: 2,
	name: "John Doe",
	level: 15,
	int: 10,
    str: 12,
    gold: 100,
	items : [item]
}
let action = {
	id: 543,
	name:"Helpful moment",
	description:"blah blah, take a punch and go out",
	type: "statChecker",
	conditions: {
		gold:"15",
		str: "8",
		verify: "all",
	},
	prize: [
		item,
        {gold: 20}, //? возможно деньги тоже надо описать структурой
        {healt: -5}
		
	],
	dice: null, //кубик бросать не надо
	nextStep: ["309irtjlfk", "23regfk"], //айди на след комнату(ы)
	
}
let mapTile = {
         id: 235,
	name: "",
	description: "",
	image: "link",
	actions: []
}
let journey = {
    characterId: "03opwriegjkldf", //будем дергать сущность characters
    character: character,
	locations: [mapTile],
}
let root = {
	owner: "t094piorgjlkf", //кто владелец данной комнаты
	character: character,
	room: journey,
}

from unexpected-journey.

SirSerje avatar SirSerje commented on June 10, 2024

В виде JSON объекта. По сути если я начал игру - каждая игра будет таким объектом в базе лежать.
Попробую описать логику:
Я создал персонажа, нажал "начать игру"
В этот момент создалась игровая сессия "приключение", назовем это так. В этом объекте храниться информация о текущих характеристиках персонажа, храниться ID юзера владеющего этой комнатой. room - это полное описание игрового приключения, которое будет происходить. Оно состоит из набора локаций. Каждая локация имеет айди. При попадании на каждую локацию, у нее есть описание и несколько путей ее прохождения - "действия"
Каждая локация имеет несколько действий на выбор ('action').
Само "действие" - проверка наличия айтемов / характеристик / бросок кубика / просто определенный выбор с последствиями. Их мы будем добавлять как фичи, но пока у нас будет 3 действия - проверка характеристик / бросок кубика / выбор действия с последствиями
В зависимости от выбранного действия, если персонаж не проиграл, он проходит на следующую локацию, которая предопределена.

{
  owner: "t094piorgjlkf", //ID юзера
  character: { //тут будет один или массив созданных персонажей
    id: 2,
    name: "John Doe",
    level: 15,
    int: 10,
    str: 12,
    gold: 100,
    items : [{
      id: 0, // думаю создать конфиг с вещами по айдишкам и по номеру давать или забирать
      name: "Shirt",
      wear: true,
      characteristic: {
        str: 1,
        int: -1
      }
      //добавить износ (?)
      //добавить стоимость (?)
    }]
  },
  room: {
    characterId: 2, //ссылка на персонажа по айдишке
    locations: [ //карта путешествия = массив локаций по которым перемещаешься
      {
      id: 235, //пока не знаю надо ли
      name: "",
      description: "",
      image: "link",
      actions: [{ //каждая локация предлагает несколько действий на выбор (~до 4)
        id: 543, //?
        name:"Helpful moment",
        description:"blah blah, take a punch and go out",
        type: "statChecker",
        conditions: {
          gold:"15",
          str: "8",
          verify: "all"
        },
        prize: [
          item,
          {gold: 20}, //? возможно деньги тоже надо описать структурой
          {healt: -5}
        ],
        dice: null, //кубик бросать не надо или будет массив бросков
        nextStep: ["309irtjlfk", "23regfk"] //айдишки на следующие локации
      }]
    }]
  }
}

from unexpected-journey.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.