D3 sdk Help: Using table files in a d3m. Compiling a dll.

For Descent, Descent II and Descent3 level editing and modification assistance.
Post Reply
User avatar
sushi.h.a.
DBB Ace
DBB Ace
Posts: 65
Joined: Tue Oct 18, 2005 2:51 pm
Contact:

D3 sdk Help: Using table files in a d3m. Compiling a dll.

Post by sushi.h.a. » Tue Dec 20, 2005 7:37 pm

Hello everyone.

I was look for some help with the following...

I am very near posting release 2 of GroupC, and I was considering trying to package GroupC as a d3m game type. (So that it would be usable with any map)

I have done quite a bit of research to that end, but there is very little to go on.
I need to do the following things:
+ Alter the ?Anarchy? source code so that it will load the GroupCn2.gam table file.
+ Compile and link the altered Anarchy source code to create a dll.
The rest is pretty straight forward as far I can tell.

If anyone can provide an example or walkthrough of the source code that needs to be added, where to insert it, and how to turn it all it into a dll, I would greatly appreciate it.
I?m currently using the msVC++ 5 IDE.

Thanks
:D
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy » Tue Dec 20, 2005 8:32 pm

First, copy the Anarchy folder to a new folder called GroupC. Then, change the appropriate project settings to produce a DLL called GroupC.dll.

There's a call in DLLGameInit (I think) that loads the Anarchy tablefile. Be aware that if you have a custom string table (something also loaded from that function) you will need to provide that as well. Also, the one provided in the SDK is not the one used in the game; that one can be found inside anarchy.d3m.

Once you've got the DLL built, you have to add it to a file called GroupC.d3m (which is just a HOG2) along with its string table and tablefile, and put that in the right subfolder in your D3 directory (I think it's missions? not sure).

Actually, I'm not sure VC++5 will work at all. D3's object files were built and linked using VC++6, and might pose a problem with name-mangling.

Moving to Descent Development as that is a more appropriate place for this thread.
User avatar
sushi.h.a.
DBB Ace
DBB Ace
Posts: 65
Joined: Tue Oct 18, 2005 2:51 pm
Contact:

Post by sushi.h.a. » Tue Dec 20, 2005 11:18 pm

Sorry about posting in the wrong spot, and thanks for fixing that.

Thanks for your reply.

I would have thought that the load-table code would be in the DLLGameInit too, but it is not there in any form as far as I can tell. This might be because ?Anarchy? doesn?t use any table files. The problem is none of the template game types included in D3sdk seem to use table files, so I haven?t found any code that actually loads a table.

The best I could find was the following code in the ?gamedll_header.h? file.

// Adds a table file into the manage system for add-on data
typedef bool (*TableFileAdd_fp)(char *filename);
DMFCDLLOUT(TableFileAdd_fp TableFileAdd;)

This leads me to believe that the following function might load the table:

TableFileAdd( GroupCn2.gam );

Even if that is the correct line, I?m not sure where it should be called within ?DLLGameInit?.

I know that it can be done, because ?Frag Tag? Uses a custom table file. ?Frag Tag? doesn?t include it?s source code though so there is no example to be found there.

The issue of compiling and linking is also problematic. From what I understand the ?virtualgcc.exe? is involved. I?m not terribly clear on the workflow for compiling and linking in the D3skd. The D3skd readme is a bit vague at points.

Anyway, this is what I have found so far, so any further assistance is welcome.
Thanks again. :)
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy » Thu Dec 22, 2005 11:30 am

Virtualgcc has nothing to do with it. The "virtual" compilers are used for D3Edit scripting; mods are compiled traditionally.

I think if you check the Entropy source it has the proper place to load a tablefile. If I hadn't lost the OG3 source I would have the answer for you definitively.
User avatar
sushi.h.a.
DBB Ace
DBB Ace
Posts: 65
Joined: Tue Oct 18, 2005 2:51 pm
Contact:

Post by sushi.h.a. » Thu Dec 22, 2005 3:59 pm

I just checked the source coded for ?Entropy? again, but no luck.

I inadvertently included the worst kind of type-o in my last post. What I meant to say was ?I?m not terribly clear on the workflow for compiling and linking in the D3skd.? I fixed the post.

At any rate, when I compile the cpp from the IDE I get an obj file. If this is what I?m supposed to get, I?m not sure how to link it to create a dll. If it?s not what I?m supposed to get, I have no idea what I?m doing.

Thanks again for taking the time to try and help me out. I really appreciate it.
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy » Thu Dec 22, 2005 4:09 pm

You're supposed to build the entire project, not just compile one file. When you build the project you get a DLL (you'll need to edit the project and change the name of the output DLL to something along the lines of "GroupC.dll", otherwise you'll be stuck with a uselessly-named Anarchy.dll).

Modding in D3 isn't easy, especially thanks to the rather sparse (to put it nicely) documentation. It's 100% impossible if you're not proficient enough in C to track down everything.
User avatar
sushi.h.a.
DBB Ace
DBB Ace
Posts: 65
Joined: Tue Oct 18, 2005 2:51 pm
Contact:

Post by sushi.h.a. » Sun Jan 01, 2006 12:22 am

Okay, I'll try that out...
Thanks again.

...and Happy New Year! :)
Post Reply