1267 robots, 24 units of food |
I got to uni at about 1 PM and checked the simulation. A not so informative error dialog box had popped up. The computer was struggling to run. I don't know whether the computer was out of memory or disk space.
1267 robots, 24 units of food |
The exception message was std::bad_alloc so I suspect the computer had run out of memory. Firefox running in the background also popped up dialog boxes asking whether I wanted to stop unresponsive scripts.
The computer thrashed for ages, about 20 minutes before things went back to normal and I could resume control. I'm not out of disk space so the crash was probably due to running out of memory. I left uni at 6 and the 6:12 PM save file was 8.5 megabytes. The save file at 6:29 PM was 41.6 megabytes. The final save file at 11:46 PM was 426 megabytes. Hmm. The gap between each save is 10184 updates.
Let's see whether I can load 110609-2346.sav. I doubt it will load. Most of the time, the binary save files are at most 50 megabytes. A few minutes have passed. The computer is starting to struggle. It worked but there was a ridiculous number of robots.
I'm going write a little code to get a screen shot, print the number of robots and reduce the number of robots. Here we go. I'm going to randomly halve the population 4 times. No luck. The program crashed when I try to save. Oops, I wasn't getting the number of robots properly in the first place. There are 1267 robots and 24 units of food.
110609-2345, 1267 robots, 426 MB
110610-1707, 634 robots, 213 MB
110610-1713, 317 robots, 106 MB
110610-1715, 159 robots, 53 MB
110610-1716, 79 robots, 27 MB
Much better.
The next thing I want to do is to get the robots to spend energy at a certain rate based on time rather than based on number of steps. But I'm not sure whether to pass the change in time through the update function or give each object a pointer to an object that can give them the change in time. The easiest way at the moment is to create a variable inside class Robot that I manually update.
Each robot has about 16384 units of energy. Robots use 1 unit of energy per second. That's simulation time and not real time. 16384 seconds is 273 minutes or 4.6 hours. That sounds like a fair bit of time.
Strange. I changed the maxSubSteps in btDynamicsWorld::stepSimulation() from 1 to 60 and the simulation went a lot faster. It shouldn't do that from what I understand.
const float timeStep = deltaTime; const float maxSubStep = 60; const float fixedTimeStep = 1.0f / 60.0f; dynamicsWorld->stepSimulation( timeStep, maxSubSteps, fixedTimeStep );
Become lost ...
RELATED
No comments:
Post a Comment