rewrite database and xml system. fix some bugs; implement autotile mapping system