Best way to store data (ala, Dialogue, Items, ect)?

Not favoritedFavorited Favorited 0 favourites
  • 2 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Hi, I'm currently making an RPG. If you know anything about RPGs you'll know that they need a ton of data to store for things like items, dialogue, ect. My main thing is whats the best way to go about doing that. In particular when it comes to random objects you can interact with in the overworld. Right now, I have it so that whenever I want the player to interact with something I have to go into the eventsheet and add an "id = x then type x from array" event. Is there a better way to go about doing this? In particular I want to know if there's a way to do this in the editor itself using variables. i DID have a system like that before, however it was pretty limited as it could only store 1 dialogue box at a time... It wouldn't/couldn't do anything past that.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I strongly suggest starting using JSON instead of arrays. It will take a little time to learn, but will save you a lot of time and headache down the road!

    Consider this JSON, which stores all weapons in the game and their stats:

    {
     "IronSword": {
     "Type": "Melee",
     "Rarity": "Common",
     "Damage": 25,
     "Attack Speed": 1.2,
     "Crit Chance": "5%",
     "Range": 1.5,
     "Durability": 100,
     "Special Effect": "None"
     },
     "SteelAxe": {
     "Type": "Melee",
     "Rarity": "Uncommon",
     "Damage": 40,
     "Attack Speed": 0.9,
     "Crit Chance": "3%",
     "Range": 1.3,
     "Durability": 120,
     "Special Effect": "Cleave"
     },
     "HunterBow": {
     "Type": "Ranged",
     "Rarity": "Common",
     "Damage": 18,
     "Attack Speed": 1.5,
     "Crit Chance": "10%",
     "Range": 8.0,
     "Durability": 80,
     "Special Effect": "Quick Draw"
     },
     "Longbow": {
     "Type": "Ranged",
     "Rarity": "Rare",
     "Damage": 35,
     "Attack Speed": 1.1,
     "Crit Chance": "15%",
     "Range": 10.0,
     "Durability": 70,
     "Special Effect": "Armor Pierce"
     }
    }
    

    You can access any stat directly with a single expression, for example: WeaponJSON.Get("Longbow.Damage"). It's a lot easier than dealing with arrays!

    .

    Besides, JSON is flexible - you can create records and structures that are simply not possible with arrays:

    .

    And here is a more advanced trick - I often store the data as an array in a table format, which makes it easy to view and modify in the editor. But at runtime, I convert it to JSON. I've been using this method for the past few years with great success.

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)