Author Topic: 2.42.9 Changes  (Read 12001 times)

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
2.42.9 Changes
« on: October 16, 2006, 02:16:11 PM »
This topic is just a place for me to keep track of the changes I make from one version to another, in this case from 2.42.8 to 2.42.9. It is not the complete list of stuff in the next drop (yet) just the stuff I have completed to date. I will edit this post as I complete changes and start a new topic for each new release.

If there is a zipped exe attached to this topic, it is a stable buddy drop which you are more than welcome to try. Such 'between release' exes will have letters following the release version e.g. 2.42.8a.

If you have feature requests or bug reports for this version, please report those as separate topics.

1) When a sim file is loaded, it's path is now displayed in the main MDI window title bar.
2) The name of a sim file (no path, just the file name - the file is assumed to be in the \saves directory) can now be passed on the command line when the DB exe is invoked.  If such is passed, the info screen is bypassed and the program loads and starts the sim.
3) PERF.  PROFILE.  Netforces() is no longer called for fixed bots.  There is no reason to calculate all the forces for fixed bots.  To allow this, the mass calculation routines are now invoked directly from UpdateBots() before Netforces() is called.
4) PERF. PROFILE.  Tweak to the random angle calculation in BrownianForces() to avoid some unecessary calculation.
5) Tweaked the default Orange to 220, 150, 60 RGB
6) PERF. PROFILE.  DoObostacleCollisions was being called unnecessarily in the case where the sim contained no obstacles.
7) PERF. PROFILE.  GateForces() was being called unnecessarily in the case where internet connections were not being used.
8) PERF. PROFILE.  UpdatePosition was unecessarily calculating a bot's mass.  Mass calculation is handled by CalcMass() in UpdateBots().
9) Virus insertion bug.  AddGene had an off-by-one error in determining where to insert a gene from a virus.  Now 1 is added to the return value from NextStop().
10) PERF.  PROFILE.  UpdateShots() was calling DoShotObstacleCollisions() unnecessarily in the case where the sim contained no obstacles.
11) PERF. PROFILE.  Quick exit from VoluntaryForces() in the case where the movement sysvars are all 0.  Should help significantly for sims with lots of veggies which tend not to move on their own.
12) PERF.  PROFILE.  BorderCols() now short circuits when the bot being considered isn't withn the bot's radius of the field border.
13) PERF.  PROFILE.  CheckTeleporters() was calling TeleportCollision() unnecessarily for inbound teleporters.
14) PERF.  PROFILE.  AddedMass calculation was moved to its own loop which only executes if density is non zero.

2.42.8a Buddy Drop Download

15) Shapes are now saved in sim files.
16) Bug with shape collision detection introduced by 6 above was fixed.  Shape collision detection must happen before NetForces() or the vector doesn't get added.  The call to DoObstacleCollisions() was moved up one line to happen before NetForces().
17) Tweak to field border collision so that collisions with the edge of the field don't add velocity.  Can you say Flubber?
18) Missed the case in #9 above where the virus was being inserted at the end of the genome.  Should work now.

2.42.8b Buddy Drop Download

19) The TotBorn and TotRunTime counters were getting overwritten when TmpOpts was copied back into SimOpts when the Change button was pressed on the options dialog.  Now I copy them into TmpOpts when the dialog is opened so the right values get put back.
20) Removed the With Shots(t) statement in UpdateShots() in an attempt to squash the array locked bug.  Time will tell if this makes a difference.
21) Added a new Cost Reinstatement threshold.  Basically, when the population falls below the zero cost threshold, the cost multipler gets set to 0 and the old one gets saved.  If you are you are using dynamic costs, this will be the CostX number.  If not, this will be 1.  When the population comes back up and crosses the new reinstatement threshold, the old cost multiplier will be re-instated.  This can help stem population explosions following bottlenecks when using dynamic costs.
22) Fixed a serious bug in shape blocking which could cause bots in certain positions in the sim to be blind in a sim that is using shapes.  Bascially I had a pos.X where I should have had a pos.Y in the up front perf check that looks to see whether both bots are below the bottom of the shape.
23) Changed the Age cost log(age) option so that it is now log (age - cost start).  In this way, the cost will start ramping up at the age at which it compences.  Seems more intuitive.
24) Added linear increase option to the age cost.

2.42.8c Buddy Drop Download

25) Incremented the costs control array loop in the load routine for the costs dialog so that the new linear age cost fraction control gets initialized correctly.
26) PERF.  I'm pretty sure #20 has addressed the locked array bug.  So, where before the shots array was grown in huge jumps to avoid the redimension bug, now the shots array is increased by only 10% when it fills up.  This keeps the UpdateShots() loop from having to deal with a super sparse array.  Similarly, I now reduce the size of the array when the number of shots drops below 70% of the array size.  The array is reduced to 10% above the actual number of shots or 100, whichever is higher.
27) The display of shot impacts can now be turned on and off via a menu item on the Robots menu.
28) Fixed a small bug with 26 above where when the number of shots was below 100, the compact routine would erroniously get called and vaporise a lot of shots that should not have been destroyed.
29) The acceleration vector in VoluntaryForces() was being clipped to 40 for overflow protection.  Now it's clipped at SimOpts.MaxVelocity.
30) Implemented Movement Vectors, a display artifact which can help show how bots are using the movement sysvars.
31) Changed the local variable 'value' in RobShoot() to a Single from a Long.  VB was rounding certain calculations when assigned to the Long variable, resulting in 0 valued nrg shots when .nrg was below 50 as well as several other realted bugs when venom and waste were very low.
32) Implemented Resource Guages, a display artifact which graphically displays the nrg and body for every bot.
33) Added the Teleport Hetertrophs option to the teleporters dialog.
34) Had to tweak #3 above.  Apparently, we still need to call bordercols for fixed bots since fixed veggies can be pushed outside the world by the birth tie (I think).
35) Another issue with 26 above.  Forgot to deal with stored shots when compacting the shots array.  Now if the shot is stored, I update .virusshot on the parent bot accordingly.
36) Added Inbound Teleporter options for number of cycles between polls and number of bots per poll.  Reworked Teleporter properties dialog accordingly.

2.42.8d Buddy Drop Download

37) Messed up the inbound teleporter poll loop.  Was setting it to the number of bots per poll.  Fixed now.
38) Added an option to only preserve the last 10 autosaved best bots in the Recording portion of the options dialog.
39) The line to calculate the new random location for intrasim teleporters in CheckTeleporters()was inside the display off check.  Thus if the display was off, intrasim teleporters would send any bots they encounterred to location 0,0.  Moved the line outside the check.
40) A few profrolactic conversions to Longs in CheckTeleporters() and Respawn() to try and address a position calculation overflow problem with (I think) intrasim teleporters.
41) Removed reliance on sysvars.txt.  All the sysvars are now loaded within the exe in LoadSysvars().  This is one step towards makign the first time experience simple.
42) More issues related to the 26 above.  Stored virus shots were not getting deleted when the parent bot died nor was .virusshot or .vtimer getting zeroed when new bots came into being.  If the parent bot dies and the shots array gets shrunk while the bot does not exist then a new bot resuses that slot in the rob array, the shot referenced by the bot could reference an invalid location in the shots array causing a subscript out of range crash when the vtimer goes off.  Now stored shots are deleted when bots die.  .vtimer and .virusshot are also zeroed when new bots are created.  Additionally, .virusshot is now zeroed when the virus shot is actually fired.  Also fixed a bug in CompactShots() where the shot was being destroyed in the case where the new slot and the old slot for the shot were the same.  Also in cases where MakeVirus() fails in BotDNAManipulation() because the gene can't be copied into the shot (can happen often in mutated bots), I now zero out the bot's .Vtimer and .virusshot.

2.42.8e Buddy Drop Download

43) Fixed a couple of typos/capitialization errors in 41.
44) SysvarTok() is now case insensitive w.r.t. sysvars in bot txt files.  The sysvar string is LCase'd before comparing to the internal sysvar table.
45) PERF.  Corpses were releasing 0 power nrg shots in respose to nrg feeding shots even though their nrg was 0.  Changed a check in ReleaseNrg() from <0 to <=0 so that this no longer happens.  Should reduce the number of shots and speed things up a tad in sims that have stupid bots whioch try to nrg feed on corpses.
46) Misc tweaks and clean up to allow the exe to stand alone for first time installs.  If the settings directory is not found, the program will now prompt to create it.  If lastexit.sim can't be found, the program now uses reasonable internal defalts.  The goal here is for things to work well for the first time user who has nothing but the naked exe adn to avoid the need to have performed a prvious setup with an older version.
47) Per #2 above, if there is a command line argument, it is assumed to be a sim and the sim is loaded.  If the command line argument contains a quoted string, as it will when the path to a sim file is passed by windows when the sim file extension is manually assoicated with the darwinbots exe, the quotes are stripped so that the file can be opened by the Open statement (which for some reason won't accept quoted paths).  So now, if you manually assoicate the sim file extension with DB and double click the sim file, DB will load the sim no matter where it resides.  If the command line string contains no "\" character, the command lien argument is assumed to be the filename (no path) of a sim residing in the \Saves directory off the DB maindir.  If it does contain a "\", it is assumed to be a fully qualified path.
48) Added overflow protection into createshot and fixed a bug in releasenrg where very powerful shots could end up with .nrg/0.9, causing an overflow when the power was assinged to the integer shot value.  It shoud have been .nrg * 0.9.

2.42.8f Buddy Drop Download

49) TieHooke is now called directly from UpdatesBots and not from NetForces since it must still be called for fixed bots as this is where the code is for tie hardening and for tie length checking.  Moving shapes can casue fixed bots to move and thus we need to check tie lengths even for fixed bots.

2.42.8g Buddy Drop Download

50) Changed SphereDragForces() so that it exits in the case that the if the magnitude of the drag vector is non-zero but really tiny as it can caused VectorInvMagnitude() to underflow.
51) Fixed a major bug with angular momentum and ties.  Bascially, the changes to .aim made by TieTorque() were being overwritten by SetAimFunc() later in the cycle with the result that no angular momentum was being transferred to tied bots through ties or from tie operations such as .fixang!  This fix has a pronounced impact on the visual physics and behavior of ties, hopefully much improved.

2.42.8h Buddy Drop Download

52) Now that angular momentum is working, there were cases where the call to the Circle method to draw the bot focus circle could cause an invalid precedure call crash as the hi and low arguments coudl exceed 2 * PI.  Now the arguments are reduced by 2PI until they are 0 < x < 2PI before the method is called.
53) TmpOpts.Daytime was not being set in the energy dialog when day/night cycles were disabled.  Thus if the user disabled day/night cycles while it was night, the sun would never come up.
54) Added code to SphereDragForces to slow down angular momentum due to fluid friction.
55) Added code to FrictionForces to slow down angular momentum due to surface friction.
« Last Edit: November 12, 2006, 01:25:29 PM by EricL »
Many beers....

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
2.42.9 Changes
« Reply #1 on: October 16, 2006, 11:36:10 PM »
Does #2 mean we can now double click on a saved sim and have the sim be loaded into DB?

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
2.42.9 Changes
« Reply #2 on: October 17, 2006, 12:07:19 AM »
Quote from: Numsgil
Does #2 mean we can now double click on a saved sim and have the sim be loaded into DB?
No, though if that is a feature request I could work on it.  But to do that right will probably require a change to the setup utility to register the .sim file type though I might be able to find a sneaky way to do it (once) in the exe load routine.

The reason I did #2 is that it is a step towards making DB into a screen saver....  
Many beers....

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
2.42.9 Changes
« Reply #3 on: October 19, 2006, 07:18:31 PM »
Bump.  2.42.8a buddy drop released.  Perf stuff and a fix to virus insertion.
Many beers....

Offline Anonomous Guest Person

  • Bot Builder
  • **
  • Posts: 85
    • View Profile
2.42.9 Changes
« Reply #4 on: October 20, 2006, 03:48:18 PM »
Quote from: EricL
Bump.  2.42.8a buddy drop released.  Perf stuff and a fix to virus insertion.

Woot, keep up the good work!

If you need any help, just ask...though I doubt I'm a much better programmer then you.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
2.42.9 Changes
« Reply #5 on: October 20, 2006, 04:10:34 PM »
Quote from: Anonomous Guest Person
If you need any help, just ask...
You can regress the virus insertion bug for me.  I.e. confirm that my fix actually fixes it.
Many beers....

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
2.42.9 Changes
« Reply #6 on: October 20, 2006, 06:43:02 PM »
AGP, by all means try and crack open the code and fiddle with things.  Either I or Eric can help you if you get stuck or have problems.  Would be really great to have someone else familiar with the code.

Offline Anonomous Guest Person

  • Bot Builder
  • **
  • Posts: 85
    • View Profile
2.42.9 Changes
« Reply #7 on: October 20, 2006, 08:27:37 PM »
Quote from: EricL
You can regress the virus insertion bug for me.  I.e. confirm that my fix actually fixes it.

Gh... actually as of testing it I don't think it does.

But you can test yourself via this sim if you'd like. It's all poised up for a bunch of simple virus-shootin' bots to infect a bunch of veggies! (here's a hint; victims of the virus spin around rapidly!)

[Edit to fix my grammar ]
« Last Edit: October 20, 2006, 08:33:01 PM by Anonomous Guest Person »

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
2.42.9 Changes
« Reply #8 on: October 20, 2006, 08:51:13 PM »
Quote from: Anonomous Guest Person
Gh... actually as of testing it I don't think it does.

Sorry about that.   Try 2.42.8b above.  I missed the case where the virus was being inserted at the very end of the genome.  Man, I'm rusty....
Many beers....

Offline Anonomous Guest Person

  • Bot Builder
  • **
  • Posts: 85
    • View Profile
2.42.9 Changes
« Reply #9 on: October 20, 2006, 09:14:15 PM »
Ah, now it works!

However I do notice that viruses don't seem to want to be placed before first gene... I'm not sure if that's a bug or not though!

[Edit]
I'll probably look at the source code (again) tomorrow. Or monday. Or whenever I feel like it and have enough system resources left.
I'm planning on making a mod of DarwinBots showing an approximate of how I wanted muscles and such to work. I say approximate since it's been over a year since I though the idea up.
But then again I might get lazy and not do that.
oh well!
« Last Edit: October 20, 2006, 09:20:27 PM by Anonomous Guest Person »

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
2.42.9 Changes
« Reply #10 on: October 22, 2006, 07:56:08 AM »
Do you think you could add a function to limit the amount of bots the same as veggies? It whould help keep the program running. Now when I don't have any costs for DNA commands I often get a lot of bots that freezes up the program.
The internet is corrupt and controlled by criminally minded people.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
2.42.9 Changes
« Reply #11 on: October 22, 2006, 12:47:54 PM »
I don't understand.  Limit bots how?  

If your bot population is getting too large for a given sim, I suggest using dynamic costs with an age cost for  controlling population.  You want to cull the least fit.  Since nrg levels are key to fitness, raising costs is the way to reduce populations.
Many beers....

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
2.42.9 Changes
« Reply #12 on: October 22, 2006, 01:19:43 PM »
I don't know how the dynamic cost setting works exactly and sometimes the population gets large very fast before the ageing cost get a chance to affect the bots. For instance I set the ageing cost to 5 starting at 1000 cycles, and also that there should be no costs if population drops below 10. What happens then is that the population has trouble reaching over 10 for awhile, then suddenly it seems to overcome it and I end up with 2000 bots on the screen freezing the program.

Maybe the dynamic cost is used for changing costs if it reaches over or below a certain population level. I wonder if it will work if the bots start to multiply extremely fast. I can have over 2000 bots and hardly no veggies in a sim. I don't know where the bots get there energy. Ok, I'll experiment with the dynamic cost function tonight and see how it works.
The internet is corrupt and controlled by criminally minded people.

Offline Anonomous Guest Person

  • Bot Builder
  • **
  • Posts: 85
    • View Profile
2.42.9 Changes
« Reply #13 on: October 22, 2006, 02:49:01 PM »
Quote from: EricL
I don't understand.  Limit bots how?


I think in the same flat manner veggies can be limited in, which I believe disables reproduction if there're more then x bots, x of course being the limit set for the number of bots possible in the simulation.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
2.42.9 Changes
« Reply #14 on: October 22, 2006, 04:13:16 PM »
Quote from: Testlund
I don't know how the dynamic cost setting works exactly and sometimes the population gets large very fast before the ageing cost get a chance to affect the bots. For instance I set the ageing cost to 5 starting at 1000 cycles, and also that there should be no costs if population drops below 10. What happens then is that the population has trouble reaching over 10 for awhile, then suddenly it seems to overcome it and I end up with 2000 bots on the screen freezing the program.

By delaying the age cost 1000 cycles, you are by definition selecting for fast reproduction.  CostX will rise to huge values as population rises, but will have no effect since the age costs aren't applied until a bot reaches 1000 cycles.  You will have selected for bots that reproduce quickly and you will end up with a sim crammed packed full of tiny, young bots.

If age cost is your only significant cost, don't delay it long.
« Last Edit: October 22, 2006, 04:14:12 PM by EricL »
Many beers....