Jump to content
The Dark Mod Forums

Porting some of The Dark Mod's gameplay mechanics to BFG-based engine.


Snehk

Recommended Posts

Hello! I'm new to the forums, and not sure if I should post this topic in this section...

 

I'm interested in porting some of gameplay mechanics from The Dark Mod to Storm Engine 2 (or use as reference for recreating them) - namely AI improvements, movement, grabbing and manipulating objects, and combat. I already checked wiki and downloaded sources, but it would be much quicker if someone could point me in some direction or which files I'll need to modify.

 

This is for general tinkering with code and building project prototypes. I already have minimal base assets required to load a level (minimum requirements for engine to launch at all was provided by developer, but building on that still took a while).

 

While I'm at development side of things - after getting through some fan missions, I'll most likely make my own. I really love Thief series and The Dark Mod and appreciate the effort you put into this game!

'What do I care for your suffering?'

Link to comment
Share on other sites

Long story short, Dark Mod quadruples the code over Doom3 (or something like that, I don't know exactly). It has a lot of code doing a lot of things that are pretty spread out. Also, it might be tricky to take bits and pieces since some things are spread out and integrated. But even aside from directly dragging things over, I think it's really educational just to see how the code works for those things.

 

Anyway, the things you want are mostly going to be in the source code for AI behavior and the Player. In the sourcecode, they'd be in the game folder. AI has its own folder called "ai", with AI.cpp being the core one. And then the states and tasks subfolders will deal with combat and behavior states, the states dealing with movements and shifting from one to another state. Then player.cpp is just in the game folder. That I think would get you started with object manipulation, and then there should be some more code directly on it somewhere.

 

You can usually tell where things are just by the title and file size. And once you get an idea of what things are called, you can do word searches to find where functions are used. And some of it is just randomly exploring and intuition. To be honest, most people that work on it didn't really have much guidance going in either. You just jump in and start exploring. Good luck!

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

The combat system might be a good place to start, at least the player part. The sword swing from different directions depending on how you use the math is a pretty simple thing. There are three script functions implemented in player.cpp (startMouseGesture, stopMouseGesture and getMouseGesture) which allow to track the movement of the player mouse.

 

The shortswords scriptobject utilizes these functions to determine in which direction the player has moved his mouse during holding down the attack or block key, and simple plays the respective animation. So we have 4 attack and 4 blocking animations. The script functions allow for four kind of checks: up/down, left/right, 4-dir and 8 dir. But in your own implementation you could simple return the directional vector and let the scriptobject do the rest, which would make the script function more versatile.

 

The ai also uses four attack directions if I am not mistaken, but I am not sure about the exact implementation.

 

I am not quiet sure what you mean by ai improvements. Anything specific you like to adopt?

 

Frobbing and grabbing is handled in player.cpp.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Thanks for replies and information!

 

Jumping right into the code and exploring is my preferred method, along with word searches. And since most of the id Tech 4 code is well commented and self explanatory (I hope I can say the same about DarkMod sources), you can get results quite quickly (like disabling spawnargs to load a map without need for player model, or how to change Flash Hud to GUI).

 

As for AI, I'm thinking about porting it whole. I already checked how it works on wiki, and think that the implementation is just golden and any project or prototype could benefit greatly from using it. DarkMod sources are really great base for RPG, slashers and (obviously) stealth projects.

'What do I care for your suffering?'

Link to comment
Share on other sites

To me, the best way to go is to follow the lightgem code.

 

Search the source for the tdm_lg_interleave cvar and follow it to where the lightgem gets captured then see how that info gets passed to the AI's visual scan, the look at what the AI does with that info.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

 


And since most of the id Tech 4 code is well commented and self explanatory (I hope I can say the same about DarkMod sources)

I hope to say that this is the case. Personally I try to adopt to the style of the already existing code when changing or adding something, which includes the comments, and from what I've seen all other coders have followed that procedure, too. At least it is very hard to tell what code is doom 3 and what is tdm, if you ignore the parts where the coders have commented that they were doing it. (I do this when altering code written by others, for example for a fix, so it is clear what has been changed and who is to blame if it doesn't work :P )

 

You can also find some documents about the doom 3 source in the internet. Many people have stated that this belongs to the codes written in a better way. John Carmack really did a good job here :)

 

http://fabiensanglard.net/doom3/

http://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-source-code

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

I wasn't able to check Dark Mod's sources until today. Checked only Player.h and Player.cpp, but I can say that it's easy to identify changes made in the code, especially that they are well commented and the code is readable as well. It should take some time to learn the codebase, but it'd be worth it even if it'll be only for educational purposes.

'What do I care for your suffering?'

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 4 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...