Whichbot Project
brcaswell
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.
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
Why are you doing this? And why are you 'announcing' this on a gaming forum, surely a blog would be better?
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.
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.
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.
I should point out, it's not enumerations[, structures,] and constants that cause the refactoring issue, it's the methods that utilize those declarations.
Why are you making it in VB.net when it is already in C++? What is the actual benefit?
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.
sweet
keep us appraised of the progress!
"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."
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.
"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.