Jump to content

Recommended Posts

Posted

This post is intended as a STOVL rocket booster for programmers who are looking at starting out with the CodeTyphon IDE, like myself, e.g. to shorten the time you can get airborne and start to build your own ExportDLL code.

ExportDLL is an API for HCE that Tony generously provided, right now he is working to enable access to the Harpoon Events which as he put it is the soul of them game and will enable the self proclaimed programmers to try their hands on modding Harpoon.

The recommended programming tool is for ExportDLLs is CodeTyphon, a free Pascal based public IDE.
Here I'm sharing my baby steps with it buildling an ExportDLL, that is installing CodeTyphone and then building the LazGUI.dll, the ExportDLL feature demonstration Tony provided.

All I did so far would not take more than 30 minutes, now that I did it once, yet I spent many hours over several days figuring out what's what and goes where. I hope to spare few minutes for fellow enthusiasts, I'm sure I'll spare myself hours if I ever going to need to rebuild the IDE. I also hope that some of the experienced craftsmen will drop in here to show us how to do it better, faster or more elegantly.

First the basics about ExportDLL, Tony's original announcement, must read topic:
http://harpgamer.com/harpforum/index.php?/topic/2190-exportdlls

The CodeTyphone programming tool info on the HarpGamer files section is here however you better download the current version directly from the CodeTyphone site:
http://www.pilotlogic.com/sitejoom/index.php/wiki/84-wiki/codetyphon-studio/80-codetyphon-download

Once you got the 500Mb install zip, extract it and run the install.bat script from under the extracted CodeTyphonIns folder. This will install the CodeTyphon Control Center (CTC) and lot of source files.

Next you build the IDE and Pascal compiler, start CTC and then select
Menu > Typhon > "Typhon32 Build SmallIDE".
index.php?app=core&module=attach&section
This will take some time, CTC cross compiles the IDE and the Pascal compiler from the source. I'm not sure about SmallIDE vs BigIDE, what difference it makes, but you must build a 32bit compiler for compiling ExportDLs.

Download the ExportDLL files library from Tony's cache:
https://tarzan.tgp.net:8443/svn/StratsimsOSS/HC/shared/pascal/trunk
I place them under: "C:\Matrix Games\Code\Shared\pascal", you will need to set your project build parameters depending where you put these.
The downloaded files are:

  • There is a mathematical library included with pascal source, the trigonometric routines are used for navigational computing.

Then there are

  • uHCDefines.pas, HCE DLL interface constant definitions
  • uHCEventHelpers.pas, two text conversion routines for HCE events
  • uHCGCI.pas, navigation routine to calculate lattitude, longitude coordinates
  • uHCGlobals.pas, some more constants
  • uHCTypeDefs.pas, this is the main event, here you find the type definitions for the HCE data possible to access through DLLs

Download the LazGUI example
https://tarzan.tgp.net:8443/svn/StratsimsOSS/HC/ExportDLLs/lazGUI/trunk/
I place the files under: C:\Matrix Games\Code\LazGUI
Tony has just updated the example to latest standards so you should get the 2009.088 GE for the DLL to work as intended.

Now there is the lazGUI.lpi file, this is the project information file that stores compiler options and also the path to the different source files needed for the build, it is in XML format. I'll need to modify it to match the folders where I have the sources on my computer. As I'm not familiar with the IDE e.g. where, under which menu to change project/compiler options I'm editing the XML directly. (Anyone experienced with the IDE is welcome to tell how to do the following properly.) Looking into the XML I see that

  • The HCE directory is defined as "D:\Games\HC", e.g.:
    <WorkingDirectory Value="D:\Games\HC"/>
    On my PC this is "C:\Matrix Games\HUCE.2009.088" so I'm replacing these strings in the XML.
  • Required packages come from dir "..\..\shared\pascal", e.g.:
    <Filename Value="..\..\shared\pascal\uHCDefines.pas"/>
    I replace all these with "..\shared\pascal" to match my arrangements.

This seems to be all.

Now start the IDE. > Typhon32. from the Start menu.
index.php?app=core&module=attach&section

Open the LazGUI project,
Menu > Project > Open project
index.php?app=core&module=attach&section

Select the lazgui.lpi file from where you put it, my case "C:\Matrix Games\Code\LazGUI".
Looks ok, the Project Inspector shows all files and none are removed when I tell it to remove non-existing ones.
index.php?app=core&module=attach&section

So, here it goes
Menu > Run > Build
Like a cinch.
index.php?app=core&module=attach&section
And there is a shiny new LazGUI.dll under "C:\Matrix Games\HUCE.2009.088\ExportDLLs"

Works too, starting HCE I get the ExportDLL bonus window:
index.php?app=core&module=attach&section

Now you are ready to add your own code. :)




Interesting readings to start with:
http://wiki.lazarus.freepascal.org/Lazarus_Faq
http://wiki.lazarus.freepascal.org/Object_Pascal_Tutorial
http://lazarus-ccr.sourceforge.net/docs/lcl/index.html
http://wiki.lazarus.freepascal.org/LCL_Components#Standard_tab
Don's Toolbox, an actual ExportDLL implementation
http://harpgamer.com/harpforum/index.php?/files/file/809-toolbox/


post-2539-0-85681300-1376923409_thumb.png

post-2539-0-35506600-1376923533_thumb.png

post-2539-0-06440500-1376923577_thumb.png

post-2539-0-59774200-1376923644_thumb.png

post-2539-0-20262800-1376923686_thumb.png

post-2539-0-54990300-1376923827_thumb.png

  • 2 weeks later...
  • 1 year later...
Posted

With sadness I am removing the CodeTyphon installer from the HG downloads. I've examined some of the source-code first hand (for some of the GIS components) and it appears to be an unlicensed derivative of a commercial component. There have been other (less concerting to me) charges levelled against CodeTyphon for having treated open source material incorrectly (renaming files and such, lack of proper attribution) as well.

 

In any event, you can still get CodeTyphon directly from its publisher but I would encourage using other solutions (such as Lazarus directly). There have been multiple efforts to help the CodeTyphon folks to a more compliant situation but they have not been interested in such help.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...