Whichbot Project

brcaswellbrcaswell Join Date: 2009-10-30 Member: 69181Members
<div class="IPBDescription">Translating Code to .Net Managed</div>I'm currently translating the whichbot source code (written in unmanaged C++) over to vb.net.

As the C++ source code is about 30,000 lines of code, and my C++ skills are amateur, at best, this project will take some time.

I plan on having several revisions and milestone objectives in this project.

My current objective is to make a direct translation of the classes, methods, and datatype declaration to vb.net. There are many translation/conversion software from VB.net to other languages, which I'll work with in the later stages of the project. My next milestone will be to restructure the code and create new methods, specifically in the strategy class.

I'm posting this as a general notification. Also, I'm wondering if anyone is working on a similar project.

Comments

  • ThaldarinThaldarin Alonzi&#33; Join Date: 2003-07-15 Member: 18173Members, Constellation
    I'm a little confused,

    Why are you doing this? And why are you 'announcing' this on a gaming forum, surely a blog would be better?
  • SilverwingSilverwing bulletsponge Join Date: 2003-11-23 Member: 23395Members, Constellation
    <!--quoteo(post=1737136:date=Nov 10 2009, 10:04 PM:name=brcaswell)--><div class='quotetop'>QUOTE (brcaswell @ Nov 10 2009, 10:04 PM) <a href="index.php?act=findpost&pid=1737136"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I'm posting this as a general notification. Also, I'm wondering if anyone is working on a similar project.<!--QuoteEnd--></div><!--QuoteEEnd-->

    I think that's the part relevant to your question, Thal. I think. Possibly.

    However, since you don't say it out and out: Do you intend this "translation" for NS2? Is that why you post it here?

    Also, good luck brcaswell.
  • DepotDepot The ModFather Join Date: 2002-11-09 Member: 7956Members
    Forgive my ignorance, but is Whichbot no longer supported by clamatius?
  • brcaswellbrcaswell Join Date: 2009-10-30 Member: 69181Members
    <!--quoteo(post=1737228:date=Nov 11 2009, 01:12 PM:name=Depot)--><div class='quotetop'>QUOTE (Depot @ Nov 11 2009, 01:12 PM) <a href="index.php?act=findpost&pid=1737228"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Forgive my ignorance, but is Whichbot no longer supported by clamatius?<!--QuoteEnd--></div><!--QuoteEEnd-->

    I'm not sure whether it's still being supported. The whichbot project website is till up at source forge. I'm not sure if that actually requires money to maintain.

    The source code available on the site has a GNU licensing, which informally states you can't use it for commercial purposes. It's totally up for pet projects. The licensing of the source will go with my translated version of the code.
  • brcaswellbrcaswell Join Date: 2009-10-30 Member: 69181Members
    <!--quoteo(post=1737214:date=Nov 11 2009, 10:49 AM:name=Silverwing)--><div class='quotetop'>QUOTE (Silverwing @ Nov 11 2009, 10:49 AM) <a href="index.php?act=findpost&pid=1737214"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I think that's the part relevant to your question, Thal. I think. Possibly.

    However, since you don't say it out and out: Do you intend this "translation" for NS2? Is that why you post it here?

    Also, good luck brcaswell.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Well, After I restructure the code in a managed language, I'll be adding my own methods that will make up the bot's thinking process. That portion of the code will likely be part of an NS2 bot project I have in mind. My objective is really just using Whichbot and NS1 platform to test some of my methods, so I'm afraid not, it would have to be almost completely refactored for NS2. The portions of code that make up the bot, navigation, strategy, and targeting rely heavily on the HL engine, and NS1 constraints, such as enumerations and defined constants.
  • brcaswellbrcaswell Join Date: 2009-10-30 Member: 69181Members
    <!--quoteo(post=1737290:date=Nov 12 2009, 12:56 AM:name=brcaswell)--><div class='quotetop'>QUOTE (brcaswell @ Nov 12 2009, 12:56 AM) <a href="index.php?act=findpost&pid=1737290"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Well, After I restructure the code in a managed language, I'll be adding my own methods that will make up the bot's thinking process. That portion of the code will likely be part of an NS2 bot project I have in mind. My objective is really just using Whichbot and NS1 platform to test some of my methods, so I'm afraid not, it would have to be almost completely refactored for NS2. The portions of code that make up the bot, navigation, strategy, and targeting rely heavily on the HL engine, and NS1 constraints, such as enumerations and defined constants.<!--QuoteEnd--></div><!--QuoteEEnd-->

    I should point out, it's not enumerations[, structures,] and constants that cause the refactoring issue, it's the methods that utilize those declarations.
  • ThaldarinThaldarin Alonzi&#33; Join Date: 2003-07-15 Member: 18173Members, Constellation
    Forgive my ignorance.

    Why are you making it in VB.net when it is already in C++? What is the actual benefit?
  • brcaswellbrcaswell Join Date: 2009-10-30 Member: 69181Members
    edited November 2009
    <!--quoteo(post=1737315:date=Nov 12 2009, 08:08 AM:name=Thaldarin)--><div class='quotetop'>QUOTE (Thaldarin @ Nov 12 2009, 08:08 AM) <a href="index.php?act=findpost&pid=1737315"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Forgive my ignorance.

    Why are you making it in VB.net when it is already in C++? What is the actual benefit?<!--QuoteEnd--></div><!--QuoteEEnd-->


    Well, it's written in unmanaged C++, which means it uses a compiler that coverts the language over to machine code, binary code, or executable code (by any name, it's the same thing) thats native to machine (OS and chip architecture). There are a variety of C++ compilers, so one could compile their source using several compilers to achieve broad platform compatibility.

    Here is a decent article that describes the differences between managed and unmanaged, or native, code: <a href="http://www.developer.com/net/cplus/print.php/2197621" target="_blank">http://www.developer.com/net/cplus/print.php/2197621</a>


    The reason I'm translating to vb.net is because it is a managed code and I am proficient in it. As the author pointed out in his article, these languages are compiled into an intermediate language, which are utilized, managed by CLR. This does limit the control of the programmer by automating memory management tasks, such as garbage collecting. An unmanaged code programmer would either have to explicitly, or would have the flexibility of, coding these automated services themselves. These CLR services are very proficient, however the process of using intermediate code that is compiled on the fly, by the 'Just in Time' (JIT) compiler, has issues on performance compared to executing binary code, which was pre-compiled unmanaged code.

    One of the greatest benefits to managed code is the ability to reference the assembly of a compiled project into a new project. Meaning, a person could easily include and reference the whichbot.dll (managed) file in their program, inherit the bot base class (or any inheritable class, as defined by the programmer), override particular methods (the ones that are overridable, as defined by the programmer) with their own methods, and dramatically change how the bot prioritizes and thinks.

    Classes, Methods, and accessible datatypes of executables written in and compiled from Unmanaged Code can certainly be targeted in code through explicit dll reference calls, however, you would need to know the definitions, method names, and/or memory addresses to utilize the reference properly. 'Porting' the source over to a managed code will just make it easier for future developers.
  • That_Annoying_KidThat_Annoying_Kid Sire of Titles Join Date: 2003-03-01 Member: 14175Members, Constellation
    you win in your own thread

    sweet


    keep us appraised of the progress!
  • DepotDepot The ModFather Join Date: 2002-11-09 Member: 7956Members
    I asked one of our developers about this and will pass along his responses.

    "The most obvious problem is that the Metamod API isn't available for VB.net. The biggest problem is that VB.net isn't supported on Linux. Plus, all that talk of portability and memory management is moot since HLDS only works on one processor architecture and unnecessary memory management would slow things down."
  • flying_mooseflying_moose Join Date: 2009-06-03 Member: 67676Members, Constellation
    edited November 2009
    <!--quoteo(post=1737412:date=Nov 13 2009, 05:25 AM:name=Depot)--><div class='quotetop'>QUOTE (Depot @ Nov 13 2009, 05:25 AM) <a href="index.php?act=findpost&pid=1737412"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->The biggest problem is that VB.net isn't supported on Linux.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Wrong.

    source:
    <a href="http://www.mono-project.com/Main_Page" target="_blank">http://www.mono-project.com/Main_Page</a>

    Edit: Decided I should clarify. Mono is an open source implementation of Microsoft's .Net Framework based on the ECMA standards for C# and the Common Language Runtime for windows/Linux/OS X. Visual Basic has been supported as of version 1.2.3 (current version 2.4) While not installed by default on many distributions, MONO does come standard on all Ubuntu distributions.
  • brcaswellbrcaswell Join Date: 2009-10-30 Member: 69181Members
    <!--quoteo(post=1737412:date=Nov 13 2009, 05:25 AM:name=Depot)--><div class='quotetop'>QUOTE (Depot @ Nov 13 2009, 05:25 AM) <a href="index.php?act=findpost&pid=1737412"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I asked one of our developers about this and will pass along his responses.

    "The most obvious problem is that the Metamod API isn't available for VB.net. The biggest problem is that VB.net isn't supported on Linux. Plus, all that talk of portability and memory management is moot since HLDS only works on one processor architecture and unnecessary memory management would slow things down."<!--QuoteEnd--></div><!--QuoteEEnd-->

    Geesh, Depot...

    Memory management is a logic concept that relates to memory in RAM. It has nothing to do with processor architecture, nor does the 'concept' relate to any hardware architectural limitation. There are relevant factors that proper memory management takes into account. These factors are related to physical components that make up the RAM device, such as primary storage and secondary storage. You can think of these factors as variables, or passing parameters, and the logic concept of memory management as a series of functions, or methods, that make up the parts of memory management. Yes, it's that abstract.

    It's understandable to use the term for processor cache memory (executes instructions every tick). However, the concept of memory management still isn't dependent on hardware.

    I'm not familiar with Half-Life Dedicated Server's (HLDS) memory management; Although, I can safely assume it only accounts for it's own memory management and not for class, methods, and deftypes written by another programmer for their program, or 3rd party programs. It, again, has no correlation to processor architecture.

    <a href="http://en.wikipedia.org/wiki/Memory_management" target="_blank">http://en.wikipedia.org/wiki/Memory_management</a>

    I'm not familiar with metamod's methods; however, there are metamod API references written in the whichbot source code. I'll use those API references for the common task of marshaling <a href="http://msdn.microsoft.com/en-us/magazine/cc164193.aspx" target="_blank">http://msdn.microsoft.com/en-us/magazine/cc164193.aspx</a>

    Linux certainly has a version of the .Net framework, so Intermediate Languages are supported on linux. <a href="http://monodevelop.com/" target="_blank">http://monodevelop.com/</a> (Any .Net technical issues on Linux can be directed to that community for additional support, I'll probably be utilizing their expertise.. that is, if I cared whether my project can be run on linux.. which I don't)

    I will be converting vb.net to another managed language (more than likely, Visual C++.Net) after I restructure the code.
  • ThaldarinThaldarin Alonzi&#33; Join Date: 2003-07-15 Member: 18173Members, Constellation
    By the time you have done this you could have probably become proficient enough in C++ to continue towards the upkeep.
Sign In or Register to comment.