How do I simulate Database

Get help using Construct 2

Post » Mon Apr 07, 2014 10:08 pm

Hi,
:cry:
I am working in a sport proyect.

I need pass to the game a lot of data (names, abilities,age,nationality, etc)
and I wont to get this information from a easy way, is imposible put in global variables
all of this information.

I am thinking in a Database or something similar.

Waiting your help

Best regards
Paberb
B
6
S
1
Posts: 47
Reputation: 518

Post » Mon Apr 07, 2014 10:24 pm

If you gonna use this for example for store information of each player, you can use instance variables.
B
11
S
3
Posts: 39
Reputation: 814

Post » Mon Apr 07, 2014 10:28 pm

Thanks for your reply.

Yes is a good idea but, for 1000 basket players x 20 attributes, i need 20.000 instance variables, is crazy.

Exist other way?
B
6
S
1
Posts: 47
Reputation: 518

Post » Mon Apr 07, 2014 10:47 pm

You could use an Array for this:

https://www.scirra.com/manual/108/array
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

Post » Tue Apr 08, 2014 4:39 pm

Yes, I now the Array, but I dont know how load and save to disk, can you help me?
B
6
S
1
Posts: 47
Reputation: 518

Post » Tue Apr 08, 2014 4:46 pm

PABERB wrote:Yes, I now the Array, but I dont know how load and save to disk, can you help me?


since you have a lot of datas, I think webstorage is not the way to go (I could be wrong), but I don't know of a way to save and load file from disk (except if you are planning on using Node webkit of course)

Maybe there is a plugin that can help, but I am not sure.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

Post » Tue Apr 08, 2014 5:00 pm

@PABERB

if youre dealing with lots of data

csv plugin
or csv to array
or json plugin (in progress but very useable)
or combination of these

the savedata can be alot smaller than the data you need to run your game, so i think webstorage should be ok

edit: to load the data you would just place the data (csv or json) in the files directory and use ajax to load the data, on data loaded you get the string in ajax.lastdata, and with this you can continue, .. dont know if the plugin deals with the loading.

you do have to be somewhat comfortable with c2, to use all of this, and large data games in general...
ImageImage
B
71
S
22
G
7
Posts: 827
Reputation: 10,177

Post » Tue Apr 08, 2014 6:58 pm

Thanks a lot.

But Arrays

I need to know how and where the array save the data and how load it.
I want to load the data inside of array, ready to use.
B
6
S
1
Posts: 47
Reputation: 518


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests