Valhalla Legends Forums Archive | Battle.net Bot Development | [C++] Quality bot design / 'practices'

AuthorMessageTime
Okee
Hey guys, I saw the thread about visual basic related practices and design, and was wondering what some good things to keep in mind while making a C++ bot would be?

What's the main thing most C++ bots should be centered around - a class containing all account settings, etc, or some other element?

What's a good way to keep your bots organized and simple?

Just anything that people might find useful while writting C++ bots, or applications.
July 13, 2005, 3:50 PM
Myndfyr
I think that most people would tell you that, since C++ is object-oriented, the best thing to go for is modularity.

My bot (if you want to call it that, in C#, although C++ has just as much capability to do the same thing, if not more) is centered around an abstract design that involves plugins and system-level contracts.  Essentially, the main program has any number of plugin DLLs in its folder.  It knows enough about the plugin to load it.  Then it enumerates a registry path (I use GUIDs to identify a plugin type in both the DLL and the registry) and determines which plugins to load objects for.  This lets me make a generic, base Settings class that essentially encapsulates a registry key.  Classes can extend it and provide more detailed properties.

Part of the plugin contract is that each DLL provides an object factory class (that is determined by metadata, although you can require a DLL provide a global, exported C function to return one).  I defined an interface that tells me what the object factory class can do, and that way I don't need to worry about late binding -- something similar could work for you.

But it shouldn't be the "settings" that your bot is centered around, per se -- it should be the extensibility contracts (plugin system).  If you center it around your settings, you won't be able to adapt it as easily to other kinds of systems later.
July 13, 2005, 4:32 PM
bethra
[quote author=MyndFyre link=topic=12200.msg120514#msg120514 date=1121272354]
I think that most people would tell you that, since C++ is object-oriented, the best thing to go for is modularity.

My bot (if you want to call it that, in C#, although C++ has just as much capability to do the same thing, if not more) is centered around an abstract design that involves plugins and system-level contracts.  Essentially, the main program has any number of plugin DLLs in its folder.  It knows enough about the plugin to load it.  Then it enumerates a registry path (I use GUIDs to identify a plugin type in both the DLL and the registry) and determines which plugins to load objects for.  This lets me make a generic, base Settings class that essentially encapsulates a registry key.  Classes can extend it and provide more detailed properties.

Part of the plugin contract is that each DLL provides an object factory class (that is determined by metadata, although you can require a DLL provide a global, exported C function to return one).  I defined an interface that tells me what the object factory class can do, and that way I don't need to worry about late binding -- something similar could work for you.

But it shouldn't be the "settings" that your bot is centered around, per se -- it should be the extensibility contracts (plugin system).  If you center it around your settings, you won't be able to adapt it as easily to other kinds of systems later.
[/quote]

Do you know of any good tutorials or examples for making and using a DLL in C++?  I've tried making my own but it doesn't work >_< probably cuz I'm doing something wrong T_T.

I tried using BnetAuth.dll just to see and I couldn't figure out how to even use it because my code must of been wrong or something... I've searched google but I haven't found anything really useful.

Any links or something that might provide a good resource on making and using DLLs?

I really want to make my bot so I can make it more portable.
July 17, 2005, 12:16 AM

Search