Whichbot Project

brcaswellbrcaswell Members Join Date: 2009-10-30 Member: 69181Posts: 46 Fully active user
Translating Code to .Net Managed
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! Members, Constellation Join Date: 2003-07-15 Member: 18173Posts: 6,132
    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 Members, Constellation Join Date: 2003-11-23 Member: 23395Posts: 495 Advanced user
    QUOTE (brcaswell @ Nov 10 2009, 10:04 PM) »
    I'm posting this as a general notification. Also, I'm wondering if anyone is working on a similar project.


    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.
    Silverwing
    QUOTE
    If atheism is a religion, then not collecting stamps is a hobby.
    QUOTE (ASnogarD)
    It is fine to add a skill that can be aquired by playing the game, not a skill that requires non intuitive movement/gamestyle to aquire... thats counter intuitive and bad design.
    A skill that is first discovered by accident, and then learnt by others via social networking isnt a cool feature, its a popular glitch.

  • DepotDepot The ModFather Members Join Date: 2002-11-09 Member: 7956Posts: 6,411 Fully active user
    Forgive my ignorance, but is Whichbot no longer supported by clamatius?
    image
    modNS Forums - NS1 and NS2: We Wrote The Book On NS Moddingimage
  • brcaswellbrcaswell Members Join Date: 2009-10-30 Member: 69181Posts: 46 Fully active user
    QUOTE (Depot @ Nov 11 2009, 01:12 PM) »
    Forgive my ignorance, but is Whichbot no longer supported by clamatius?


    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 Members Join Date: 2009-10-30 Member: 69181Posts: 46 Fully active user
    QUOTE (Silverwing @ Nov 11 2009, 10:49 AM) »
    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.


    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 Members Join Date: 2009-10-30 Member: 69181Posts: 46 Fully active user
    QUOTE (brcaswell @ Nov 12 2009, 12:56 AM) »
    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.


    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! Members, Constellation Join Date: 2003-07-15 Member: 18173Posts: 6,132
    Forgive my ignorance.

    Why are you making it in VB.net when it is already in C++? What is the actual benefit?
  • brcaswellbrcaswell Members Join Date: 2009-10-30 Member: 69181Posts: 46 Fully active user
    edited November 2009
    QUOTE (Thaldarin @ Nov 12 2009, 08:08 AM) »
    Forgive my ignorance.

    Why are you making it in VB.net when it is already in C++? What is the actual benefit?



    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: http://www.developer.com/net/cplus/print.php/2197621


    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 Members, Constellation Join Date: 2003-03-01 Member: 14175Posts: 5,583 Advanced user
    you win in your own thread

    sweet


    keep us appraised of the progress!
  • DepotDepot The ModFather Members Join Date: 2002-11-09 Member: 7956Posts: 6,411 Fully active user
    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."
    image
    modNS Forums - NS1 and NS2: We Wrote The Book On NS Moddingimage
  • flying_mooseflying_moose Members, Constellation Join Date: 2009-06-03 Member: 67676Posts: 64
    edited November 2009
    QUOTE (Depot @ Nov 13 2009, 05:25 AM) »
    The biggest problem is that VB.net isn't supported on Linux.


    Wrong.

    source:
    http://www.mono-project.com/Main_Page

    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 Members Join Date: 2009-10-30 Member: 69181Posts: 46 Fully active user
    QUOTE (Depot @ Nov 13 2009, 05:25 AM) »
    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."


    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.

    http://en.wikipedia.org/wiki/Memory_management

    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 http://msdn.microsoft.com/en-us/magazine/cc164193.aspx

    Linux certainly has a version of the .Net framework, so Intermediate Languages are supported on linux. http://monodevelop.com/ (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! Members, Constellation Join Date: 2003-07-15 Member: 18173Posts: 6,132
    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.