Array or Dictionary for Pokemon-esque Game

0 favourites
  • 5 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • This question has probably come up multiple times. But I wanted to gather some thoughts on which to use for data management for a Pokemon-like game I'm making. Would I be better off storing stats and other data for the "Pokemon" (Dex entries, natures and abilities, etc.) in a Dictionary data structure or an array? What about items? I'm more familiar with arrays, and I think I could make it work like that, but what do y'all think? If you think a Dictionary could work better, could you explain how and why?

    Tagged:

  • Array

  • If there are too many properties (columns) for each creature in the array, it will be difficult to work with them, because you'll have to reference them by index.

    I would probably choose a third option - JSON. JSON takes some time to learn, but if you organize the data structure correctly, it should be the easiest and most convenient option.

    Here is an example:

    {
     "ratata": 
     {
     "Name": "Ratata",
     "Element": "Earth",
     "Level": 4,
     "Strength": 3,
     "Speed": 3,
     "Armor": 2,
     "HP": 21,
     "Vulnerabilities": "Dark,Poison",
     "attacks": [{ "Kick": 3}, { "Punch": 1}]
     }, 
    
     "ekans": 
     {
     "Name": "Ekans",
     "Element": "Poison",
     .........
     }
    
    }
    
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This has been a long term project of mine, and while I've not gotten around to it yet, I think my planning was to use a combination of both Dop and Lionz answers here. (Unfortunately my planning notes don't have this written down!)

    Essentially, the JSON would store all of the static information like base stats, types, movepool etc. for the Pokemon and then depending on what the information would be used for, each system would have data structures.

    For example - I'd planned to use arrays to track stats of each Pokemon currently in battle, using the data in the JSON to help calculate stat changes. You could in theory use either an array or a dictionary to track which Pokemon you'd seen or caught and then draw the correct information out of the JSON for the dex.

    I'm probably really overcomplicating it as I always do, but I guess it ultimately depends on how complex you want your game to be.

  • This has been a long term project of mine, and while I've not gotten around to it yet, I think my planning was to use a combination of both Dop and Lionz answers here. (Unfortunately my planning notes don't have this written down!)

    Essentially, the JSON would store all of the static information like base stats, types, movepool etc. for the Pokemon and then depending on what the information would be used for, each system would have data structures.

    For example - I'd planned to use arrays to track stats of each Pokemon currently in battle, using the data in the JSON to help calculate stat changes. You could in theory use either an array or a dictionary to track which Pokemon you'd seen or caught and then draw the correct information out of the JSON for the dex.

    I'm probably really overcomplicating it as I always do, but I guess it ultimately depends on how complex you want your game to be.

    Ya for me I prefer to use array for gameplay data and because I like the array events that you don't get with a dictionary object. Dictionary could be useful to reference something that is stored. I use JSON format only if I want to save the array but usually I am using system save so it's not needed.

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