Author Topic: DB too slow?  (Read 4672 times)

Offline keli

  • Bot Neophyte
  • *
  • Posts: 3
    • View Profile
DB too slow?
« on: January 07, 2009, 05:00:18 PM »
I have a very good computer and very good video card(if it rally matters) but I can only have like 150 simple bots then it starts to lagg and slow down very much. dose this program have a video card support( or hardware support) and if so how can I turn it on?

Offline Shasta

  • Administrator
  • Bot Destroyer
  • *****
  • Posts: 231
    • View Profile
DB too slow?
« Reply #1 on: January 07, 2009, 07:17:02 PM »
Someone can fix me if I'm wrong, but as far as I know there is no hardware acceleration, and it really wouldn't even help, Darwinbots is very much CPU bound.

 As for why you are running so slow, there are two buttons that can speed it up some, Fast Mode, and Flicker Mode, (Green arrows on the toolbar). For me on windows Vista x64 I get up over 2000 cycles/second with <40 bots and it scales down from there (With fast and flicker)

Which bots are you running?

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
DB too slow?
« Reply #2 on: January 07, 2009, 10:01:54 PM »
It's going to lag when there are a lot of bots.  Most serious sims run at maybe 2-5 cycles/sec.

Like Shasta said, DB is usually CPU bound.  You can check how much of an issue the gfx are for speed by turning on/off graphics (there's a monitor icon in the toolbar).

Offline ikke

  • Bot Destroyer
  • ***
  • Posts: 300
    • View Profile
DB too slow?
« Reply #3 on: January 08, 2009, 02:15:39 AM »
Correct me if I’m wrong, but I was under the impression accelerator cards also do collision detection more effectively?

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
DB too slow?
« Reply #4 on: January 08, 2009, 03:28:48 AM »
Video cards can be used for faster physics, but you have to specifically program for it and it's only useful for effects (it's too hard to transfer the data back to the main program).  Physics cards likewise.

Offline keli

  • Bot Neophyte
  • *
  • Posts: 3
    • View Profile
DB too slow?
« Reply #5 on: January 11, 2009, 07:31:05 AM »
Thanks for the support:)

Offline Moonfisher

  • Bot Overlord
  • ****
  • Posts: 592
    • View Profile
DB too slow?
« Reply #6 on: January 11, 2009, 02:05:00 PM »
If you have a dual or quad core then you should also know that DB is single threaded, so it will only run on one of them. If you want to take advantage of all your CPU's then you could probably set up a sim for each CPU with some teleporters in between them. This also has the advantage of allowing you to have different settings for each environment.
This is also why some of the older computers with a single powerfull CPU will be able to run faster sims than newer computers with several less potent CPU's.
Also judging from the source the performance for bot code excution hasn't been optimized, and generaly I think VB6 isn't the best environment for developing a program like DB once it reaches a certain size. I haven't looked at the source for the upcomming DB3, but looking at the wiki it seems like it will perform a lot better or atleast be more inviting to optimize where needed.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
DB too slow?
« Reply #7 on: January 11, 2009, 10:03:08 PM »
Quote from: Moonfisher
If you have a dual or quad core then you should also know that DB is single threaded, so it will only run on one of them. If you want to take advantage of all your CPU's then you could probably set up a sim for each CPU with some teleporters in between them. This also has the advantage of allowing you to have different settings for each environment.
This is also why some of the older computers with a single powerfull CPU will be able to run faster sims than newer computers with several less potent CPU's.
Also judging from the source the performance for bot code excution hasn't been optimized, and generaly I think VB6 isn't the best environment for developing a program like DB once it reaches a certain size. I haven't looked at the source for the upcomming DB3, but looking at the wiki it seems like it will perform a lot better or atleast be more inviting to optimize where needed.

VB6 has some overhead, but not as much as you might think.  One of the things I've learned since working on Darwinbots is that algorithmic order (big O notation) will always outweigh any language overhead, within reason.  Meaning that even if you managed to make Darwinbots 20% faster, that's a constant increase in speed and will absolutely vanish when you add another 3 bots to an already huge simulation since that's a O(n^2) environment.

So the main reason for a different language is that it's easier to program complex algorithms in C# than VB6.  VB6 is just a pain to work in.

Offline Moonfisher

  • Bot Overlord
  • ****
  • Posts: 592
    • View Profile
DB too slow?
« Reply #8 on: January 12, 2009, 12:54:24 PM »
I was mostly thinking of the plands to make it object oriented and have unit tests.
A code standard would probably be a good idea too, if you can get people to follow it.

It would just make the whole thing easier to work with in the future, and a lot easier for people to dig into the source.
But mostly it makes it easy to optimize DB if it's well structured and has some good tests.
And if it's multithreaded it will perform a lot better on computers with more than one CPU.

I also agree that VB6 has some strange syntax and it can be hard to find any dokumentation... found it kind of akward to work with in general.
And it doesn't realy encourage making structured and object oriented code, and with a program the size of DB it just gets too confusing.