Code center > Suggestions

Senses

<< < (5/9) > >>

PurpleYouko:
Darwinbots uses a "sorted" list which keeps track of the x positions of all the robots in a dynamic array.

This speeds things up a whole lot since we don't need to go quite as far as n^2 when we are calculating. We just look at a smaller slice of the population to save processor time.

It is still by far the slowest part of the program though (that and graphics)

 :D  PY  :D

Botsareus:
The Pain <--- Yep same problems with PB, Imagine if yo got 20 robots pushing each other off the screen.

MightyPenguin:
Model the enviroment, I'm telling you,and everything will follow after. Trust me on this. Instead of searching through all the bots to find which ones are closest, then looking at what they're saying, model sound waves as objects. Update positions every cycle and set up a rule for collisions.

Botsareus:
seeing witch robots are closest and setting up rules for collison is kinda the same thing, unless "seeing witch robots are closest" was an idea to actualy check the relative position of each robot and then do another loop to get the closest robot. And anyway I dont think there is going to be mutch difference of speed.

MightyPenguin:
Fuck yes. I've solved it. :pengysmiley:  Add a layer to the e-grid that stores the objects currently present in that square. Then, when a bot wants to check hearing or smell or sight or anything like that it can access that information for a suitable number of squares in each direction a get a small list to check distances for.

You'd never need to search the entire array for anything ever again. At least from a single bot perspective.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version