Dealing with lots of stats/rpg stuff

Discussion and feedback on Construct 2

Post » Sat Apr 30, 2016 1:57 am

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...
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Sat Apr 30, 2016 3:32 am

I use arrays and also import/export the array values as json, which can be read with NWjs from a text file.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,614

Post » Sat Apr 30, 2016 3:51 am

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.
B
108
S
26
G
267
Posts: 4,456
Reputation: 149,747

Post » Sat Apr 30, 2016 3:58 am

@rexrainbow ha, I just about to mention the plugin you made for that- thats gold!
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Sat Apr 30, 2016 8:00 am

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.
B
36
S
18
G
11
Posts: 248
Reputation: 8,694

Post » Sat Apr 30, 2016 7:47 pm

Sethmaster wrote: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?
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Sat Apr 30, 2016 9:23 pm

I'm curious too. Hell I've built everything around sprite objects as variable containers.
B
39
S
16
G
6
Posts: 542
Reputation: 7,617

Post » Sun May 01, 2016 12:42 am

@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.
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Sun May 01, 2016 5:29 am

ruskul wrote:
Sethmaster wrote: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
B
36
S
18
G
11
Posts: 248
Reputation: 8,694

Post » Sun May 01, 2016 6:18 am

@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.
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 6 guests