FSW-style Squad Movement

Discuss programming in the QuakeC language.
Post Reply
GiffE
Posts: 170
Joined: Sun Oct 08, 2006 3:39 pm
Location: USA, CT
Contact:

FSW-style Squad Movement

Post by GiffE »

Hey,
I'm trying to code a Full Spectrum Warrior style mod in DP. Basically how the game play is that you control a squad of 4 bots which you can position tactically in places of cover (having cover where ever u go is always a good idea.) The problem I'm having i need to move the move cursor near a window and all the cursors lock into the best position lined up along the wall.

This is what FSW-style movement looks like:
http://s33.photobucket.com/albums/d75/G ... -58-51.flv

Here is a pic of a possible senarior
Image

I've coded all the simple things such as the camera view and the bots(although they need some better brains) mainly i just need some help on the movement (getting them to line up along a wall near a corner if the cursor is near one.

Logically this is what I THINK i need to do:
Trace to wall
then get the length of the wall to the right/left
the prime spot is the first spot on the corner which can fit the dimensions of a player.
Then find the remaining spots to the right/left (evenly spaced)

BTW i just need to find the origins that i will be sending the bots to, "spots" = origin

Any idea how to do this or some psuedo code on how to make a FSW style movement.

Thanks,
Gif
Entar
Posts: 439
Joined: Fri Nov 05, 2004 7:27 pm
Location: At my computer
Contact:

Post by Entar »

This mod sounds a little like Quake Matt's Reinforcers, which was really cool - http://quakematt.quakedev.com - but it looks like you're taking the pathfinding / cover a step further...
GiffE
Posts: 170
Joined: Sun Oct 08, 2006 3:39 pm
Location: USA, CT
Contact:

Post by GiffE »

I was actually using quakematt's mod as an example.
so pretty much yea :) except with 4 guys moved with 1 command and they can have some better positioning.

I think i could solve this if I could find the corner of a wall then move over about the size of a player (so he can squeeze in there)
Quake Matt
Posts: 129
Joined: Sun Jun 05, 2005 9:59 pm

Post by Quake Matt »

Thanks for the feedback!

The most effective way to do this, I think, would be to edit the map and place two 'cover_location' entities at the corner. Then you can find all nearby entities of this kind an move to the best one.

Of course, if editing the map's not possible, there's another approach you could try. Whenever you run a traceline command, Quake will generate a vector called 'trace_plane_normal' which, as you'd expect from a normal, will point directly away from the wall, perpendicular to the surface. If you then run the code

makevectors(vectoangles(trace_plane_normal));

the global v_right vector will be set so it runs parallel to the surface. You can then run some subsequent tracelines at several points along this vector to check where (and if) the wall ends, and move to that point instead.

If it'd help, I'll try to draw a picture of what I mean.
GiffE
Posts: 170
Joined: Sun Oct 08, 2006 3:39 pm
Location: USA, CT
Contact:

Post by GiffE »

Quake Matt wrote:Thanks for the feedback!

The most effective way to do this, I think, would be to edit the map and place two 'cover_location' entities at the corner. Then you can find all nearby entities of this kind an move to the best one.

Of course, if editing the map's not possible, there's another approach you could try. Whenever you run a traceline command, Quake will generate a vector called 'trace_plane_normal' which, as you'd expect from a normal, will point directly away from the wall, perpendicular to the surface. If you then run the code

makevectors(vectoangles(trace_plane_normal));

the global v_right vector will be set so it runs parallel to the surface. You can then run some subsequent tracelines at several points along this vector to check where (and if) the wall ends, and move to that point instead.

If it'd help, I'll try to draw a picture of what I mean.
I thought about doing map ents but i think it will be to labor intensive for the mapper. so i've been trying to use a coordination of traces to find where the wall ends, then plot the guy there.
eg:

Code: Select all

		local vector wallang;
		local vector right;
		local float counter2;
		wallang = vectoangles(trace_plane_normal);
		counter2 = 1;
		makevectors(wallang);
		while(counter2 < 5 && trace_fraction != 1.0)
		{
			right = org + (v_right * (POINTER_DISTANCE*counter2));
			traceline(right, right + (v_forward*-10), TRUE, self);
			counter2++;
		}
		self.pointer1.origin = org + (v_right * (POINTER_DISTANCE*(counter2-1)));
		self.pointer1.angles = wallang;
(this was just a test to see if i looked at the wall it would go 4 spaces to the right/left or stop if there was a corner there)

above that i just traced to the wall.

it doesnt exactly work though
GiffE
Posts: 170
Joined: Sun Oct 08, 2006 3:39 pm
Location: USA, CT
Contact:

Post by GiffE »

I need to do something like this:
http://s33.photobucket.com/albums/d75/G ... -17-79.flv
without using entities.

Basically i need to figure out the origin in which the wall ends (the corner), once i have that i can do the rest.

Any code example of how to find that origin would be much appreciated.
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

why not Rainbow Six Lockdown style?
Image
GiffE
Posts: 170
Joined: Sun Oct 08, 2006 3:39 pm
Location: USA, CT
Contact:

Post by GiffE »

...
Not really helpful leileilol
Post Reply