FreshRSS

Normální zobrazení

Jsou dostupné nové články, klikněte pro obnovení stránky.
PředevčíremHlavní kanál
  • ✇Recent Questions - Game Development Stack Exchange
  • Database Design of loot tablesTdude179
    Apologies for the length, I'm currently struggling to model a recursive loot table system in a PostgreSQL database for my game. Meaning, I want to have a main loot table, and then add sub-loot tables as needed. These could be themed tables or just tables of like items. I'd like to be able to add sub-tables several levels down the tree. At the moment, I have a working system that does not use a recursive approach, but would like to update it to allow for sub-tables. This is the SQL for my Loot ta
     

Database Design of loot tables

Apologies for the length, I'm currently struggling to model a recursive loot table system in a PostgreSQL database for my game. Meaning, I want to have a main loot table, and then add sub-loot tables as needed. These could be themed tables or just tables of like items. I'd like to be able to add sub-tables several levels down the tree. At the moment, I have a working system that does not use a recursive approach, but would like to update it to allow for sub-tables.

This is the SQL for my Loot table:

CREATE TABLE LootTable (
    TableID SERIAL PRIMARY KEY,
    TableName VARCHAR(50) NOT NULL UNIQUE,
    AmountOfDrops INTEGER DEFAULT 1
);

This is the table for loot table contents:

CREATE TABLE LootTableObject (
    ItemID INTEGER REFERENCES Items(ItemID) ON DELETE CASCADE ON UPDATE CASCADE,
    TableID INTEGER REFERENCES LootTable(TableID) ON DELETE CASCADE ON UPDATE CASCADE,
    Probability DECIMAL(10, 4) DEFAULT 1 NOT NULL,
    IsUnique BOOLEAN NOT NULL DEFAULT false,
    DropsAlways BOOLEAN NOT NULL DEFAULT false,
    IsEnabled BOOLEAN NOT NULL DEFAULT true,
    DropAmountMin INTEGER DEFAULT 1,
    DropAmountMax INTEGER DEFAULT 1,

    PRIMARY KEY (ItemID, TableID)
);

As stated, these tables work in a non-recursive sense at the moment. I have a system that will query all LootTableObjects of a certain TableID (Each TableID represents a different monster's drop table). It adds any drops marked dropsAlways. Then adds up all probabilities, chooses a random number, and uses that to choose a regular drop. It loops again for however many drops the table says are to drop.

The problem I'm running into is how to conceptually model a database that would allow for sub loot tables. As an example, here is what I am trying to model:

A loot table would look like this:

LootTableObjects, amountOfDrops: 2
-----------------
Coins, Probability: 1
Health Potion, Probability: 1
Rare Drops Sub Table, Probability: 1

And the Rare Drops Sub Table would look like:

Rare Drops, amountOfDrops: 1
-----------
Steel Sword, Probability: 1
Steel Warhammer, Probability: 1
Steel Scimitar, Probability: 1

Therefore, if the sub-table was hit during loot determination, it would pick one of the 3 items in that table.

A sub table should have the exact same attributes as both the LootTableObject and LootTable. As in, I want the sub tables to have a certain chance to drop, and a certain amount of items that will drop when the table is selected, as well as if it drops always, or is unique (can drop only once during loot determination).

How would I change the LootTable & LootTableObject tables to account for these subtables? I'm more concerned with the concept of how this is done, rather than the exact SQL to make it work.

  • ✇Recent Questions - Game Development Stack Exchange
  • How would you implement a map system like WoW?Subressor
    I'm really struggling with a 'resonable' technical implementation of the map system used by the popular MMO World of Warcraft. Not really sure on a data structure format and how to save/store it in a SQL relational DB. I've come up with an idea below, but wondered if anyone had any better ways? A brief summary of the map system used by World of Warcraft: Loading up the map starts with a blank outline of a continent Each continent has multiple 'zones', which are outlined, but blank Selecting a '
     

How would you implement a map system like WoW?

I'm really struggling with a 'resonable' technical implementation of the map system used by the popular MMO World of Warcraft. Not really sure on a data structure format and how to save/store it in a SQL relational DB. I've come up with an idea below, but wondered if anyone had any better ways?

A brief summary of the map system used by World of Warcraft:

  • Loading up the map starts with a blank outline of a continent
  • Each continent has multiple 'zones', which are outlined, but blank
  • Selecting a 'zone' zooms into the zone, but it is initially blank
  • As the player explores the zone, certain areas within the zone will 'be discovered' and will be coloured and detailed in
  • Players need to explore the whole zone for it to be fully discovered and show a 'complete' map
  • Players can discover any area of the map in any order
  • Maps and areas are not rigid, they can be complex and different shapes and sizes

My current thinking:

  • Use a 2D tool to create the following 2D assets
  • The blank outline of a zone
  • Multiple transparent layers with a certain area 'coloured', which could be overlayed onto the blank outline
  • Assign an integer ID to each area layer
  • When a player discovers a zone
  • Attempt to find the correct corresponding layer and assigned 'integer'
  • Add this integer to an array corresponding to a zone
  • When a player logs off
  • save this array to a string, seperating the integers with a underscore
  • save this string to a seperate SQL table, using the character ID as a primary key
  • When a player logs on
  • load all rows using the character ID as a lookup
  • Load all of the integers sperating them out with the underscore
  • use the integers as a ID reference to the transparent layers to show as visible

Thoughts?

❌
❌