I really like using tabs rather than spaces for putting indention in my codes, but it seems not all people thinks the same. I go so far that with some open source gmk scripts (that I like) I have I always can't help but re-indent them using tabs all over again.
i always turn this:
{
maxid = -1;
maxpower = 0;
for (i=0; i<instance_count; i+=1){
iii = instance_id[i];
if (instance_exists(iii))
if (iii.object_index == unit){
if (iii.power > maxpower){
maxid = iii; maxpower = iii.power;}
}
}
}
into this:
{
maxid = -1;
maxpower = 0;
for (i=0; i<instance_count; i+=1)
{
iii = instance_id[i];
if (instance_exists(iii))
{
if (iii.object_index == unit)
{
if (iii.power > maxpower)
{
maxid = iii; maxpower = iii.power;
}
}
}
}
}
It looks longer, but i extremely prefer it that way.
var i, p, iii;
maxid = -1;
maxpower = 0;
for (i = 0; i < instance_count; i += 1) {
iii = instance_id[i];
if (!instance_exists(iii)) continue;
if (iii.object_index != unit) continue;
p = iii.power;
if (p <= maxpower) continue;
maxid = iii;
maxpower = p;
}Mainly I'm only partially 'obsessed' with performance factor in GM games. Knowing how performance of arrays versus data structures compare for specific tasks, I may use one that will take more time to code but work better when done.
In other programming languages I'm often bothered about types of variables - from programming for phones with low CPU & RAM (via Java ME) I've learnt that it can actually matter to use integer types instead of floating-point ones.
Shared thing between all programming languages is having too many indentation levels - more than four of such normally mean that things are getting complicated, and likely hard to read. So 'continue', 'break', 'return' statements where applicable.