Valhalla Legends Forums Archive | Battle.net Bot Development | Newb Mac Programmer (soon to be)

AuthorMessageTime
Lime-Marine
ok guys, As SOME of you may know i am starting LimeBot (mac binary bot) to rival kane. I learning c++ and all and i'm wondering, the structure of a bot consists of A. Main.cpp being main commands B. Commands.cpp (commands). and C. Login.cpp (login to b.net) and a few more. Is this correct?
March 16, 2003, 11:05 PM
Camel
there is no single correct way to set up your bot
imho, the more split up code is, the easier it is to deal with, given that it's organized well. however, it would be entirely possible to create a bot with a single main.cpp
March 16, 2003, 11:25 PM
Zakath
The new version of ZakBot that I'm working on has 3 source files: ZakBot.cpp, BinaryBot.cpp, and ZakBot.res. The original version had 6 or so, as I recall (I'm too lazy to check right now).

Sky's BinaryChat has over 100 different source files.

Division of code among source files is just an organizational choice. Normally you split different functional themes among different files, but you could divide things up however you like. BinaryBot.cpp, for example, is the implementation file for a framework class - it is completely standalone, is not intended to be modified, and thus is some 1000 or so lines long.
March 18, 2003, 1:04 PM
Kp
Though it is an organizational choice where you put what functions, I'd like to point out that usually when you compile a file, everything in that file is compiled for the resulting object.  A bigger file will take longer to compile.  Therefore, there is some value in having source files split out so that you don't needlessly recompile functions that haven't changed in months, just because they're in the same file as the new function you're writing and debugging.  The counterpoint is that fewer object files reduces the chance of using an outdated struct definition and confusing the program; however, most decent compiler suites will identify such dependencies for you.  Confused yet? ;)
March 18, 2003, 6:27 PM
Camel
imho, you should *always* use .h files for all your declarations, even if you only have one .cpp file, because i find it helps in getting all of the important declarations "up at the top."
March 18, 2003, 7:22 PM

Search