I hope this is right place to ask: I'd like to speed up the file operations in my tile engine. And since now the engine itself is fast again, this calls for bigger maps
. Unfortunately that also increases loading times dramatically, so I wonder if anyone could help me out and put these functions into native C code.
Code: ags
There's also a second thing I'd die to see as a plugin and that's a way to save data structures (whole arrays and/or structs) to a file. Currently I serialize everything into giant strings and save those. Of course it takes forever to finish
Imagine the game turns out to be great if it weren' for the loading times...? That would ruin your fun too! See.. it's a win/win situation
Seriously, if anyone could lend a me helping hand, that would be totally great!
Eternal gratitude assured

int noloopcheck Readword(this File*) {
char c1 = this.ReadRawChar();
char c2 = this.ReadRawChar();
return c2*256+c1;
}
int noloopcheck ReadDoubleword(this File*) {
int i1 = this.Readword();
int i2 = this.Readword();
// cut 16th bit due to int being signed
i2 = i2%16;
return i2*65536+i1;
}
String noloopcheck BitString(int i, int bits) {
int p = bits - 1,are;
String s="";
int q;
while (p > -1) {
q = FloatToInt(Maths.RaiseToPower(2.0, IntToFloat(p)), eRoundNearest);
are = i/q;
i = i -are*q;
s = String.Format("%d%s",are, s);
p--;
}
return s;
}
int noloopcheck BitStringToInt(String s) {
int l = s.Length,are;
int i;
String ss;
int add = 1;
while (i < l) {
ss = s.Substring(i, 1);
if (ss == "1")are =are + add;
i++;
add = add * 2;
}
returnare;
}
There's also a second thing I'd die to see as a plugin and that's a way to save data structures (whole arrays and/or structs) to a file. Currently I serialize everything into giant strings and save those. Of course it takes forever to finish

Imagine the game turns out to be great if it weren' for the loading times...? That would ruin your fun too! See.. it's a win/win situation

Seriously, if anyone could lend a me helping hand, that would be totally great!
Eternal gratitude assured
