0 Favourites

Dealing with lots of stats/rpg stuff

  • Hey everyone,

    How do you like to best manage data for games? Sometimes I know things like mario don't even need to worry about data, but then there are things like RPG that deal with alot of numbers. There are all the classes and stats and items and properties...

    What are you insights and how have you managed the sheer volume of numbers in a number heavy game? (for example cvc, custom data plugins, etc...

  • I use arrays and also import/export the array values as json, which can be read with NWjs from a text file.

  • You might try

    1. Edit content of items in excel/open office/Google document

    2. Export table in csv format

    3. Import csv into taffydb plugin, which is a database and it supports querying and sorting.

  • rexrainbow ha, I just about to mention the plugin you made for that- thats gold!

  • In game, I am using a combination of arrays and dictionaries to keep track of all the data in my SRPG.

    To load external data into those data storage, I am using csv files which is load straight into the arrays.

    Here's a expert tip, don't ever compute long formulas (such as sorting or attack formula) straight using variables from a sprite object, especially when you have many of them presence.

    Get the values from those variables, put them into arrays, global/local variables or dictionaries before calculating it.

    Even better is if you don't put any computation variable on sprites and just put them in arrays/dictionaries beforehand.

    You will find everything will run far smoother.

  • In game, I am using a combination of arrays and dictionaries to keep track of all the data in my SRPG.

    To load external data into those data storage, I am using csv files which is load straight into the arrays.

    Here's a expert tip, don't ever compute long formulas (such as sorting or attack formula) straight using variables from a sprite object, especially when you have many of them presence.

    Get the values from those variables, put them into arrays, global/local variables or dictionaries before calculating it.

    Even better is if you don't put any computation variable on sprites and just put them in arrays/dictionaries beforehand.

    You will find everything will run far smoother.

    I am having difficulty understanding what you mean by this? What is wrong with using a variable off of a sprite? What is the advantage of copying it to the array before computing?

  • I'm curious too. Hell I've built everything around sprite objects as variable containers.

  • ErekT Ya, Ive, I keep dozens of sprites with special icons that represent all my variables (I sure wish there was a faster way of adding variables in the editor). I have keyboardobjects, attribute containers, global variable storages, and so on.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • > In game, I am using a combination of arrays and dictionaries to keep track of all the data in my SRPG.

    > To load external data into those data storage, I am using csv files which is load straight into the arrays.

    >

    > Here's a expert tip, don't ever compute long formulas (such as sorting or attack formula) straight using variables from a sprite object, especially when you have many of them presence.

    > Get the values from those variables, put them into arrays, global/local variables or dictionaries before calculating it.

    > Even better is if you don't put any computation variable on sprites and just put them in arrays/dictionaries beforehand.

    > You will find everything will run far smoother.

    >

    I am having difficulty understanding what you mean by this? What is wrong with using a variable off of a sprite? What is the advantage of copying it to the array before computing?

    I am unsure on how to explain in detail but the short version is that when you retrieve value from a sprite object, there is a bit of overhead, vastly more than data storage object. It is not noticeable if you are not computing anything difficult or a lot. The overhead accumulate as you parse through more sprites/objects for data for computation. And if you run several loops of it in a single tick, hanging is concern if you set 60 fps as your minimum framerate (as I do).

    For my game, the AI for each enemy run through thousands for simulation to achieve the optimal round plan based on their given AI archetype. So, I can see the difference quite clearly.

    There is a huge difference in speed and smoothness parsing through rows in arrays or keys in dictionaries than going through each individual sprites for their variables

  • Sethmaster - ah, that makes sense. So you say that pulling variables off of a sprite has more overhead than computing in an array? I am curious why that would be. It is the same number of events right? hero.health-=enemy.attack has to pull from two objects, wouldn't that be true for pulling from two arrays?

    I know that events have overhead and that different types of events have different overheads, so in general I linke to make everything as a javascript plugin or behavior, wouldn't that be better than dealing with the array object? I've avoided it like the plague, lol.

  • I've had some success with importing a json into a dictionary object - declaring the variables in a text editor is then much easier than using events.... And, if you name your keys like "weapon0", "weapon1" etc then you can loop through them during the game using string functions.

  • Would someone like to show an example of the text files you use for handling data? Im just curious in seeing how you keep the data organized there, and how the data is read in C2.

  • Would someone like to show an example of the text files you use for handling data? Im just curious in seeing how you keep the data organized there, and how the data is read in C2.

    Just open any excel sheet and you already figured it out how I managed all my data and their maintenance.

    Any time I wish to import it to C2, I do eight important steps:

    1. Toss all data that I wanted into a new excel sheet.

    2. Do a Find and Replace for commas.

    3. Save as MS-DOS CSV

    4. Do a Find and Replace for CSV commas. (I use this | as replacement)

    5. Do a Find and Replace back for data commas (revert them back to commas).

    6. Create a new array for it if the data type is new.

    7. Import the CSV and link it up to my function that parse through AJAX.

    8. Create a new section in that function to toss all data from AJAX parsing to the array.

    And there, it is done. the data is available for use through the game.

    You can skip step 6,7 and 8 and just copy paste the new data straight into the imported file when you updated the data in your excel sheets.

  • > Would someone like to show an example of the text files you use for handling data? Im just curious in seeing how you keep the data organized there, and how the data is read in C2.

    > ny time I wish to import it to C2, I do eight important steps:

    1. Toss all data that I wanted into a new excel sheet.

    2. Do a Find and Replace for commas.

    3. Save as MS-DOS CSV

    4. Do a Find and Replace for CSV commas. (I use this | as replacement)

    5. Do a Find and Replace back for data commas (revert them back to commas).

    6. Create a new array for it if the data type is new.

    7. Import the CSV and link it up to my function that parse through AJAX.

    8. Create a new section in that function to toss all data from AJAX parsing to the array.

    Thanks for a detailed answer! I'll test this and check some related tutorials aswell.

  • Colludium I had a friend who created an external program to unzip construct 2 save files and then parse out certain information. When making a game I could do things like put z_Z in text fields, variable names, etc, and then pass it off to my friend who would then automatically inject the desired info in. It was crazy because you could make a game have 70 different languages in about 2 seconds for example.

    I thought I was a good programmer, but this friend made me feel woefully incompetent.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread sticky
87 481,331
fenis99's avatar
fenis99
Unread hot topic
38 2,653
saiyadjin's avatar
saiyadjin
Unread hot topic
0 Favourites
Isometric Stuff
32 4,444
Aritz's avatar
Aritz