0
\$\begingroup\$

I am using Postgres to create an Online RPG.

I am creating a game and I want quests to be as variable as possible. I am wondering if JSONB is the solution. The alternative is to create a bunch of different flags for quest types like:

is_kill, is_speak_to_npc, is_gather_resource, is_...

Not sure what else would be there at this point but you get the idea.

Wondering if using JSONB will be an issue when trying to query for quests in the future. Any ideas are appreciated.

\$\endgroup\$
3
  • \$\begingroup\$ Are you creating the game solo? It is not practical to create an online RPG or MMO solo. \$\endgroup\$
    – Kevin
    Commented May 12, 2023 at 3:31
  • \$\begingroup\$ What kinds of queries do you foresee performing on your Quests table? I'd expect they'd be things like "Find quests offered by this quest giver / in this location / for these classes / in this level range / within these dates", and not so much "Find quests whose second beat is gathering resources". So you can probably have a separation between information you use to select a quest and information you use to execute the quest. \$\endgroup\$
    – DMGregory
    Commented May 12, 2023 at 12:21
  • 2
    \$\begingroup\$ @Kevin I am insane and already have a playable game. lol. \$\endgroup\$
    – bezzoon
    Commented May 12, 2023 at 13:36

1 Answer 1

0
\$\begingroup\$

I created tables that store various sections of the quests in a row, rather than trying to store in some sort of JSONB or other format. You can't query nicely in those unless you have things split out into parts already.

Having said that, I pass back to my game client in a JSON format, but handle that on the server end.

I also split out quest sections into individual rows, so that a single quest can have multiple sections, requirements and potentially have to be performed in a specific order or concurrently. That allows my game client to know which quest part is active at any given time, making it easier to track advancements and progress, but also opening up different requirements as needed.

Lastly, I'd point out that whether you store the data in a normal row format, or each quest as an object ready to be passed to your game really, in the grand scheme of things, doesn't matter. You might have a different interface for your editor setup, and a different one for clients to query.

I have a development interface that lets my editor query, pass data, modify results etc but transform that when I promote the data, so that the load on the client-servers is minimised. Horses for Courses mate.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .