FPS: 5
After playtesting Automata extensively, I found that the framerate slows considerably when more enemies are added. 1 enemy = 30 FPS running at 100% CPU, 50 enemies = 5 FPS running at 100% CPU. More tiles also slow the framerate down, from 9-10 FPS to 5-. FPS. I suspect that if the screen was almost filled with tiles and 50 or so enemies were on the screen, my game would run at 1 FPS.:(
(log in to comment)
Comments
direction = random number
if direction is 1 then go (right or up)...
if colliding(tile) move back
For a more complex environment you would want some kind of partitioning scheme, so the enemies would only run the collide function on nearby objects that it could conceivably collide with.
on map load:
#Build empty map
map = []
row = []
while 1:
row.append(0)
if len(row)==map_width:
map.append(row)
row = []
if len(map)==map_height:
break
for tile in loaded_tiles:
add_tile_to_scene
row[tile.y][tile.x] = 1
#for collisions
tile_x = enemy.x//tile_width
tile_y = enemy.y//tile_height
if left: tile_x-=1
if right: tile_x+=1
if up: tile_y-=1
if down: tile_y+=1
if tile_x<0 or tile_y<0 or tile_x==map_width or tile_y==map_height:
collide = 1
elif map[tile_y][tile_x]:
collide = 1
else:
collide = 0
that's not bad. numpy is pretty awesome
dotteri on 2011/09/15 15:34:
What does a enemy exactly? I mean AI. How is implemented?