Code center > Darwinbots Program Source Code

Overflow etc.

(1/2) > >>

Greven:
Just a few simple questions...

Why is there so many overflow errors and other unexpected errors in DB?

I know DB is big in codelines etc., but overflow problems aint that hard to stop, only checking if the variable is near the maximum limit. Or has stated elsewhere making all variables long or single. Will that slow down the simulation speed????????????

PurpleYouko:
We have literally thousands of variables in DB. They are in all different formats too, a whole lot of them are integers which is where we get most of our overflows.

While it is pretty satraight forward to check that numbers aren't too big for th evariable type, the problem lies in the shear number of if-then statements needed to achieve this. Every time a variable is modified (possibly 100s of times per cycle), a check must be done and checks take a finite amount of time.
In order to speed up the program we try to centralize these checks to one or two places but sometimes this doesn't cut it, particularly when a bit of code gets modified in such a way that it effects a variable that on the face of it shouldn't be effected, and pushes it over the limit in another place entirely.

For example, changing the range of a shot in one routine can make a poison shot in another part of the program come back with a value of 33000 or something equally bizarre.

The whole thing is just hyper complicated.

I still thinnk the best thing to do would be to make every variable either a double or a long.

DB was originally written with the mindset that shorter 16 bit variable would be faster but on modern 32 bit windows environments, I am pretty sure that 32 bit variables are actually just as fast if not a little faster.

Besides this we could then remove all those checks and that would speed up the program too.

Endy:
I can just barely see some of the complexity, when using notepad to view some of the stuff, and I'm amazed you're even able to find your way around :blink:

However you guys manage it, my hat is off to you :clap:

Numsgil:
It's a bit easier in Visual Basic because things are autoformatted for you.  The only real way to understand the program anymore is as a collection of independant modules.  If you try to start at the beginning of the program and run through it in your head like that you'll go mad.

Here's how I work: "gee, I want to add something to the mutations code", so I load up the mutations module and find where it's doing something similar to what I'm after.  Then I just sort of copy and modify.

Next release will have the code slightly more readable, with some of the monsterously long functions broken down a bit more.

For the love of all that's Holy someone besides PY and me make a crack at coding something.  Anything.  There's a whole list of things to be coded in the suggestions forum, some only would take a few hours or maybe a day if anyone had the time and drive to try.

You can even DL VB from the FTP (soon all speech will be in acronym form :P)

Greven:
I am ok programmer ín VB, but I always get scared when I look at the code! It is so %#=%/#%)=()= hard to read and understand. I like my self to get a overview of all things in a particular program, but in DB it is so hard, becuase a lot of the variables & function (etc.) has some stupid italian name or something like that, and I dont what to use 200 hours just to understand the main part of the program, and figure out what it does, if I did I could write a book about it. (No fun) ;)

Navigation

[0] Message Index

[#] Next page

Go to full version