Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
sevenx

About C++

Recommended Posts

Hi , I came from zdoom forum , with question : "Can I use my skill of C++ in Doom or Zdoom ? " . I Know about ACS, but i want programming only Doom on C++, for example , control of monster/player , and other source code of Doom,or modification Doom with C++ code . Can I do it ? Because , in zdoom forum me answer "No" .

Share this post


Link to post

As was stated on ZDoom.org, you can use C++ to directly modify the source of a Doom port that's written in it (such as ZDoom or Eternity, not sure about any other released ones) but I don't think any existing port will allow you to use it as a scripting language. This is probably pretty unlikely to change.

Share this post


Link to post

Now I have Zdoom source , and when I enter in microsoft visual C++ , I see many folders of Zdoom , and I do not know which means any folder.
For example, I want to programming control of monster, but i don't know where is this code in Zdoom. Do you understand me ? Can you help,please?

Share this post


Link to post

Most of the source files follow a naming convention like "s_" for sound related, "am_" for automap, "r_" for renderer, etc... To really know what you're doing, you're going to need to have an intimate knowledge about how the engine works before delving into the source code.

Also, why do you feel the need to take an engine like ZDoom and modify it's source just to change stuff like monsters or weapons? ZDoom is the most flexible source port when it comes to modifying the game. You can literally do almost anything without the need for compiling the source with your own changes.

Share this post


Link to post
sevenx said:

Now I have Zdoom source , and when I enter in microsoft visual C++ , I see many folders of Zdoom , and I do not know which means any folder.
For example, I want to programming control of monster, but i don't know where is this code in Zdoom. Do you understand me ? Can you help,please?

First, you need to know what you want to do. I'm serious -- if you don't know what code you want to change, you can't change it. If you do know, however, you'll find it pretty soon.

Suppose you want to change the way monsters move. First, you'll study the monsters' logic, which is found in their DECORATE code. That'll teach you that they use A_Chase to move around. Then you can just hit Ctrl-Shift-F in Visual C++ to bring a "Search" box. Type "A_Chase" in it, tell it to look in the entire solution, and it'll find the A_Chase function regardless of where it is.

EarthQuake said:

ZDoom is the most flexible source port when it comes to modifying the game. You can literally do almost anything without the need for compiling the source with your own changes.

Vavoom is probably even more flexible, given most of the logic is implemented in VavoomC. Though very, very few people bother modding it. Not sure whether it's because it's too complicated or because there's just not enough Vavoom modders.

Share this post


Link to post

As for AI modification in general, yes this is possible in Vavoom. Generally you go to the progs/common/linespec and edit Actor.Hexen.vc . There you will find functions like A_FiredChase, A_IceGuyChase, A_KoraxChase which are the core AI functions. You can modify them and run the game without even needing to recompile. Scripts are compiled at runtime and can be distributed as a mod.

Below is the AI of Afrit from hexen, one of more complex AI functions:

//============================================================================
//
//  A_FiredChase
//
//============================================================================

final void A_FiredChase()
{
	float ang;
	float dist;

	if (ReactionCount)
		ReactionCount--;
	if (Threshold)
		Threshold--;

	// Float up and down
	Origin.z += Level.Game.FloatBobOffsets[Special1];
	Special1 = (Special1 + 2) & 63;


	// Insure it stays above certain height
	if (Origin.z < FloorZ + 64.0)
	{
		Origin.z += 2.0;
	}

	if (!Target || !Target.bShootable)
	{
		// Invalid enemy
		LookForPlayers(true);
		return;
	}

	// Strafe
	if (Special2 > 0)
	{
		Special2--;
	}
	else
	{
		Special2 = 0;
		Velocity.x = 0.0;
		Velocity.y = 0.0;
		dist = DistTo(Target);
		if (dist < FIREDEMON_ATTACK_RANGE)
		{
			if (P_Random() < 30)
			{
				ang = atan2(Target.Origin.y - Origin.y,
					Target.Origin.x - Origin.x);
				if (P_Random() < 128)
					ang = AngleMod360(ang + 90.0);
				else
					ang = AngleMod360(ang - 90.0);
				Velocity.x = 8.0 * cos(ang) * 35.0;
				Velocity.y = 8.0 * sin(ang) * 35.0;
				Special2 = 3;	// strafe time
			}
		}
	}

	FaceMovementDirection();

	// Normal movement
	if (!Special2)
	{
		if (--MoveCount < 0 || !StepMove())
		{
			NewChaseDir();
		}
	}

	// Do missile attack
	if (!bJustAttacked)
	{
		if (CheckMissileRange() && (P_Random() < 20))
		{
			SetState(MissileState);
			bJustAttacked = true;
			return;
		}
	}
	else
	{
		bJustAttacked = false;
	}

	// make active sound
	if (ActiveSound && P_Random() < 3)
	{
		PlaySound(ActiveSound, CHAN_VOICE);
	}
}

If I understand correctly, the "attack range" constant (512) isn't strictly attack range, but range within which Afrit starts dodging.

Gez said:

Vavoom is probably even more flexible, given most of the logic is implemented in VavoomC. Though very, very few people bother modding it. Not sure whether it's because it's too complicated or because there's just not enough Vavoom modders.


Vavoom is indeed very flexible. It's best to download "progs" from here http://vavoom-engine.com/download.php and see what is possible (note the rest is done with DECORATE, that's why it's not present). Writing your own functions, new items, classes for Hexen, changing physics, the interface, intermission screen, modifying AI...

I dabble in Vavoom modding, but I have a problem with latest release and until someone helps me I can't get my mod to work. It worked in earlier version.

I can identify a couple of problems with Vavoom:

- Vavoom isn't very popular because it isn't very popular. It's a feedback loop at this point.

- VavoomC documentation is poor. Mostly you learn by reading the code. There aren't many comments, but it's rather clear. Documentation isn't very good in general, lack of examples how to run from commandline on Linux etc.

- There could be more useful error messages and feedback in general

- performance isn't great, especially on huge maps or when there are lots of particles like broken glass.

- Various minor bugs, although Janis and Firebrand fix most of them when reported.

- A bit lacking in terms of polish. Vavoom may have very nice effects and "Doom 3 light" looks amazing in right levels, but it's nowhere near as polished as, say, Doomsday.

These problems don't bother me much, I'm amazed by what can be done with VavoomC. I try to help people on Vavoom forums, too. Vavoom makes an impression of something made by skilled but antisocial programmers, it's mostly lacking in terms of documentation and general polish and attention to detail, things like good background and colors for automap etc.

Share this post


Link to post

And I have qustion .
You told me about AI functions ,because you know what does any functions means and structure of Zdoom or Vavoom , and where I can learn about that functions of AI and others functions . And where I can learn about the structure of Zdoom or Vavoom ? Because I don't know engines structure . Because, when i enter the vavoom structure, i see many folders and many files of source , but i don't know what does folders and files means.And I don't know about functions in source .
I want to know what does any functions,any folders and any files means in Vavoom or Zdoom.
Understand me ? Please,help,if you can...

Share this post


Link to post

Use the wiki to find the actor functions and what they do. Then just search for them in Visual Studio.

Thanks to the magic of the Search function and "IntelliSense", you don't have to know how the source is organized. You'll learn it as you become more familiar with the code anyway.

Share this post


Link to post

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
×