Jump to content


Photo

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


  • Please log in to reply
6 replies to this topic

#1 Snehk

Snehk

    Newbie

  • Member
  • Pip
  • 3 posts

Posted 25 August 2017 - 12:58 PM

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!



#2 demagogue

demagogue

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 5215 posts

Posted 25 August 2017 - 09:49 PM

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!


Posted Image

#3 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5155 posts

Posted 26 August 2017 - 12:54 AM

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
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#4 Snehk

Snehk

    Newbie

  • Member
  • Pip
  • 3 posts

Posted 26 August 2017 - 05:09 AM

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.



#5 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 7821 posts

Posted 26 August 2017 - 05:16 AM

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.c...ds/the-dark-mod

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

#6 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5155 posts

Posted 26 August 2017 - 12:14 PM


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/59...-3s-source-code


FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#7 Snehk

Snehk

    Newbie

  • Member
  • Pip
  • 3 posts

Posted 29 August 2017 - 04:30 PM

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.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users