Little Fighter Empire - Forums
investigating object range with loadTarget() - Printable Version

+- Little Fighter Empire - Forums (https://lf-empire.de/forum)
+-- Forum: Little Fighter 2 Zone (https://lf-empire.de/forum/forumdisplay.php?fid=7)
+--- Forum: AI Scripting (https://lf-empire.de/forum/forumdisplay.php?fid=56)
+--- Thread: investigating object range with loadTarget() (/showthread.php?tid=7976)



investigating object range with loadTarget() - YinYin - 06-20-2012

i've written a code to have a closer look at how object slots are being assigned by the game:
    C-Code:
void id(){
 clr();
 int d = 400;
 for (int i = 399; i > -1; --i){
  if (loadTarget(i) >= 0){
   d = i+1;
   break;
  }
 }
 int c = 0;
 for (int i = 0; i < d; ++i){
  c = loadTarget(i);
  if (i == 0 || i == 25 || i == 50 || i == 75 || i == 100 || i == 125 || i == 150 || i == 175 || i == 200 || i == 225 || i == 250 || i == 275 || i == 300 || i == 325 || i == 350 || i == 375){print("\n");}
  if (c >= 0){print( c );} else{print(".");}
 }
}
the code will first iterate backwards to find the highest occupied object slot and then go through from 0 to that slot, printing out the object type on a slot (or a . for an empty slot)
25 slots per line going from left to right, top to bottom

the result:
0-7 are for human players (as already known)
8-15 are for selected computer players (occupying the same slots as humans)
a good conclusion from this already is: if there is a human player on slot 0, then slot 8 will most likely be empty
so you never have to iterate over the first 16 slots if you aren't looking for characters (and in non battle or stage mode fights you only need to look through the first 16 slots for opponents, except for clones of course)

after that the slots get filled from 16 onwards with anything that comes along (just go into battle mode with this AI and have everything at max)
but if you only have a normal vs or stage battle you will notice that the game keeps a few free slots after the characters and only starts filling slots with weapons (F8) and other objects from slot 50 onwards. it seems the first 50 slots are usually reserved for characters!

lets use this info to make our iterations more compact!


RE: investigating object range with loadTarget() - Alblaka - 06-20-2012

Which means There cannot be any T!=0 object within slot 0-49?
That IS indeed useful.


RE: investigating object range with loadTarget() - YinYin - 06-20-2012

nope - i think i've seen battle mode fill these slots with a few type 6 (bottles)
but i may be mistaken

if i am then you sure can start all your non character iterations at slot 50


RE: investigating object range with loadTarget() - A-Man - 03-01-2015

Sounds too unreasonable 0_o. One can say that maybe the first few slots were done like that to ease the sorting for teleportation or something, but I know for sure you can go over 100 characters on the screen. Setting a condition for when characters go beyond 50 sounds like a hassle also, and I don't see the Wongs doing it.

Perhaps everything is just being filled in order (except for the human players maybe), and these empty slots you observed are just shadows of objects that were deleted? (energy balls?)


RE: investigating object range with loadTarget() - YinYin - 03-01-2015

I don't know what you are getting at.
In versus mode all non character objects fill slots 50 onwards, leaving a big gap between characters and other objects - that's all I observed.