This is something hard. I don't know if I should even do it with PHP
I try to use PHP design a battle system like Final Fantasy Tatic and other games like it. a 2D map, a person can do actions, and action result changes in position and changes some people's stat.
I try to use PHP to do this, and I searched the internet and I found...
THERE is not much about 2D PHP programming, I can't even find concepts of using PHP to make 2D maps...
and what I want even more is
There is not much about using PHP make AI, and I need some AI to do responces.
so, here is everything I got... a map system, which is a 2D array
$map[$x][$y]
and the array will either be NULL or contain a object(player... wall or something)
and when a character move, the object will move and the current $map[$x][$y] will set to be null and transfer the object to another array....
looks inefficient... but I don't think there is anything better to do...
Now, some of my quesion is, if I want to know what position an object is, I have to loop though each one of the array... is there more efficient way to do it? because if the $x and $y are EXTREMELY large and there are a LOT objects... this could be pretty slow...