Preloaded arrays

Get help using Construct 2

Post » Mon Feb 13, 2017 8:05 pm

GamerGon wrote:
CloveltOc wrote:Three types:
I need all of this data to be accesible without loading and unloading files with AJAX (not instant, sadly), that's why I copy them into arrays


It's not a "game" or "Construct" thing, It's web technology. AJAX is the way to access external files.


Yup! Just saying that being able to load only one file at a time is quite a bummer
B
9
S
3
Posts: 152
Reputation: 1,270

Post » Mon Feb 13, 2017 8:12 pm

R0J0hound wrote:The idea is to make editing the data file easier since xml and json are tedious.


Easier to have your own format/parser?
XML tedious?
Disagree.

One example of a xml dictionary that I'm using right now:

<?xml version='1.0' encoding='utf-8'?>
<dictionary version='1.0' selected_language='eng'>
<word key='hi'>
<translation language='spa'>Hola</translation>
<translation language='eng'>Hello</translation>
</word>
<word key='bye'>
<translation language='spa'>Adios</translation>
<translation language='eng'>Good bye</translation>
</word>
</dictionary>

What kind of file would be clearer than that?
The XML parser in C2 is about 10 lines.
Lead developer at Octeto Studios
Visit our portfolio at: http://www.octetostudios.com/ :)
Facebook || Twitter || Youtube
B
37
S
7
G
5
Posts: 217
Reputation: 5,614

Post » Mon Feb 13, 2017 8:16 pm

CloveltOc wrote:Yup! Just saying that being able to load only one file at a time is quite a bummer


Mmm... that is not 100% correct.
You can REQUEST multiple files and inside "On complete" AJAX.LastData refers only to the data loaded in the tag defined at your "On complete" event.
Lead developer at Octeto Studios
Visit our portfolio at: http://www.octetostudios.com/ :)
Facebook || Twitter || Youtube
B
37
S
7
G
5
Posts: 217
Reputation: 5,614

Post » Mon Feb 13, 2017 8:20 pm

GamerGon wrote:
CloveltOc wrote:Yup! Just saying that being able to load only one file at a time is quite a bummer


Mmm... that is not 100% correct.
You can REQUEST multiple files and inside "On complete" AJAX.LastData refers only to the data loaded in the tag defined at your "On complete" event.


Yeah, that's what I meant, only one files' lastdata at a time.
B
9
S
3
Posts: 152
Reputation: 1,270

Post » Mon Feb 13, 2017 8:24 pm

CloveltOc wrote:Yeah, that's what I meant, only one lastdata at a time.


Don't understand your problem.
You can have:
- 10 different file requests.
- 10 different "AJAX on complete" with AJAX.lastdata inside.
Lead developer at Octeto Studios
Visit our portfolio at: http://www.octetostudios.com/ :)
Facebook || Twitter || Youtube
B
37
S
7
G
5
Posts: 217
Reputation: 5,614

Post » Mon Feb 13, 2017 8:25 pm

GamerGon wrote:
R0J0hound wrote:The idea is to make editing the data file easier since xml and json are tedious.


Easier to have your own format/parser?
XML tedious?
Disagree.

One example of a xml dictionary that I'm using right now:

<?xml version='1.0' encoding='utf-8'?>
<dictionary version='1.0' selected_language='eng'>
<word key='hi'>
<translation language='spa'>Hola</translation>
<translation language='eng'>Hello</translation>
</word>
<word key='bye'>
<translation language='spa'>Adios</translation>
<translation language='eng'>Good bye</translation>
</word>
</dictionary>

What kind of file would be clearer than that?
The XML parser in C2 is about 10 lines.


Not trying to compete here! I know any syntax is better than mine, that's why I'm looking for alternatives.
Image
B
9
S
3
Posts: 152
Reputation: 1,270

Post » Mon Feb 13, 2017 8:31 pm

CloveltOc wrote:Not trying to compete here! I know any syntax is better than mine, that's why I'm looking for alternatives.
Image


Don't see the problem in your file or syntax.
"size": [2,23,1] is nothing. Really. Even ten times that is nothing in terms of filesize (kbs) and parsing time.
Lead developer at Octeto Studios
Visit our portfolio at: http://www.octetostudios.com/ :)
Facebook || Twitter || Youtube
B
37
S
7
G
5
Posts: 217
Reputation: 5,614

Post » Mon Feb 13, 2017 8:42 pm

GamerGon wrote:
CloveltOc wrote:Yeah, that's what I meant, only one lastdata at a time.


Don't understand your problem.
You can have:
- 10 different file requests.
- 10 different "AJAX on complete" with AJAX.lastdata inside.


I stated earlier that I want to access all this data from different containers (arrays) instantly, I'd rather not risk it by loading files on runtime, which isn't instant... XML is nice, though, thanks!
B
9
S
3
Posts: 152
Reputation: 1,270

Post » Mon Feb 13, 2017 8:46 pm

CloveltOc wrote:
GamerGon wrote:
CloveltOc wrote:Yeah, that's what I meant, only one lastdata at a time.


Don't understand your problem.
You can have:
- 10 different file requests.
- 10 different "AJAX on complete" with AJAX.lastdata inside.


I stated earlier that I want to access all this data from different containers (arrays) instantly, I'd rather not risk it by loading files on runtime, which isn't instant... XML is nice, though, thanks!


I understand, but web games always have a "load time" with a "loading layout" with loading bar. In its event sheet you can load all your config files to your arrays so "in runtime" you don't have to load external files anymore. Your arrays already have your data.
Last edited by GamerGon on Mon Feb 13, 2017 8:48 pm, edited 1 time in total.
Lead developer at Octeto Studios
Visit our portfolio at: http://www.octetostudios.com/ :)
Facebook || Twitter || Youtube
B
37
S
7
G
5
Posts: 217
Reputation: 5,614

Post » Mon Feb 13, 2017 8:48 pm

Major loading time (99%) will be for images and audio, not your config files. Even if you have 10 different files with 100 lines each.
Lead developer at Octeto Studios
Visit our portfolio at: http://www.octetostudios.com/ :)
Facebook || Twitter || Youtube
B
37
S
7
G
5
Posts: 217
Reputation: 5,614

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests