Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

askthedev.com Logo askthedev.com Logo
Sign InSign Up

askthedev.com

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Ubuntu
  • Python
  • JavaScript
  • Linux
  • Git
  • Windows
  • HTML
  • SQL
  • AWS
  • Docker
  • Kubernetes
Home/ Questions/Q 39504
In Process

askthedev.com Latest Questions

Asked: May 6, 20252025-05-06T08:14:18+05:30 2025-05-06T08:14:18+05:30

Is using JSON for item data instead of RDB a viable solution for performance, given the complexity of item properties?

anonymous user

I’m in a bit of a pickle and could use some insights from those with more experience in game development. I’m currently knee-deep in building a third-party app for an existing RPG game, and I’m facing some frustrating challenges. The game offers an API for developers, and while that’s great, I really don’t want to hit that API every time I need item data. It can cause some serious performance issues, right? So, I thought having my own database for item data would be the way to go.

Here’s where it gets tricky: diving into a relational database (RDB) feels like a chore, especially with the complexity of the item properties I’m dealing with. I thought I was wise starting off with JPA, but I keep running into issues—like having too many `@Embeddable` annotations and the constant struggle with converting `@ElementCollection` back to an `@Entity`. It just doesn’t feel right, and I’m second-guessing if I’m approaching this the wrong way.

With that in mind, I started considering using JSON for item data instead. My thought is to keep an `item.json` file (or maybe another NoSQL solution) that would handle the less frequently updated information, while I would continue to use RDB for user-specific data, like enchantments or reinforcement levels. It sounds like a solid plan with the user item class I’ve implemented using the fly-weight pattern, but I still have my doubts.

My questions are pretty simple:

1. Do you think the complexity of the JSON structure I’ve shared is enough to justify moving away from an RDB? Or am I just being unnecessarily cautious?
2. What alternatives to RDB should I consider for storing this data—especially given the different types of item properties I need to manage?

I’m just looking for some guidance or ideas that could help clear the fog a bit. Any thoughts would be greatly appreciated!

  • 0
  • 0
  • 2 2 Answers
  • 0 Followers
  • 0
Share
  • Facebook

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Continue with Google
    or use

    Forgot Password?

    Need An Account, Sign Up Here
    Continue with Google

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. anonymous user
      2025-05-06T08:14:19+05:30Added an answer on May 6, 2025 at 8:14 am

      It sounds like you’re really in the weeds with this project! Dealing with game data can be a real headache, especially when performance and complexity are on the line. Here are a few thoughts that might help you think through this.

      1. Regarding whether JSON can replace an RDB: If the complexity of your item properties is really high and the structure is constantly evolving, then JSON could definitely make sense as a more flexible option. It would let you define item properties without the rigid structure of a relational database. However, keep in mind that you might lose some benefits, like data integrity and easier querying, that an RDB provides. If you’re worried about performance, maybe cache the API results and refresh them periodically instead of hitting it every time.

      2. For alternatives to an RDB, you might want to consider NoSQL databases like MongoDB or even just using simple JSON files. These solutions can handle semi-structured data really well, and you won’t have to deal with the complexity of RDB schema management. However, keep in mind that if you go the file route, you’ll need to implement loading and parsing logic on your end.

      Since you mentioned using the fly-weight pattern—this might actually work well with both JSON and NoSQL, allowing you to save memory by sharing common object instances. Just make sure to weigh the trade-offs between the flexibility of JSON and the structure of an RDB.

      At the end of the day, it depends on your specific needs and what feels right for your project. Trust your instincts and remember to iterate on your approach. Good luck!

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. anonymous user
      2025-05-06T08:14:20+05:30Added an answer on May 6, 2025 at 8:14 am

      Your idea to separate static, complex item data makes sense; JSON or a document-oriented NoSQL solution like MongoDB can significantly simplify development complexity. Complex nested structures can become a headache in relational databases, especially when using JPA annotations excessively to handle embedded relationships and collections. Rather than fighting against relational paradigms, leveraging JSON files or document-based databases would allow you to inherently represent complex hierarchical data structures without the continuous mapping hassle and performance concerns associated with repeated API hits.

      If your item data is relatively stable and changes infrequently, a static JSON approach could indeed be sufficient. Alternatively, considering solutions like MongoDB or Couchbase can offer greater flexibility and scalability while still being easy to integrate with your current Java setup. Meanwhile, reserving your relational database for rapidly changing user-specific information—such as enchantments and player customizations—is likely the ideal way to achieve both performance and clarity. Splitting responsibilities clearly between database types also aligns neatly with your existing fly-weight implementation approach, maintaining readability and optimizing performance.

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Sidebar

    Recent Answers

    1. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    2. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    3. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    4. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    5. anonymous user on How can I update the server about my hotbar changes in a FabricMC mod?
    • Home
    • Learn Something
    • Ask a Question
    • Answer Unanswered Questions
    • Privacy Policy
    • Terms & Conditions

    © askthedev ❤️ All Rights Reserved

    Explore

    • Ubuntu
    • Python
    • JavaScript
    • Linux
    • Git
    • Windows
    • HTML
    • SQL
    • AWS
    • Docker
    • Kubernetes

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.