Torque Cover System
by Bryce · in Game Design and Creative Issues · 07/10/2007 (8:43 pm) · 15 replies
Has anybody thought of implementing a dynamic cover system, like you would see in Rainbow Six Vegas and Gears of War? Need some inspiration!
#2
07/10/2007 (10:18 pm)
Is Illumina a game that I can buy yet?
#3
The cover system works pretty well, not as dynamic as other games out there, but im hoping to improve it over the next few weeks.
Thanx to matt for giving me a working basic system to build off.
If anyone out there wants to helpout on getting a more flexible cover system let me know :)
07/10/2007 (10:50 pm)
Nope not yet :) .The cover system works pretty well, not as dynamic as other games out there, but im hoping to improve it over the next few weeks.
Thanx to matt for giving me a working basic system to build off.
If anyone out there wants to helpout on getting a more flexible cover system let me know :)
#4
I developed an AStar pathfinding test application a little while back.
The plan was to use it as a test bed for Hierarchical AStar pathfinding. At the moment I've just got the basic A star working.
It's in 2D but should work in 3D.

The cool thing about it is you can actually see how the computer performs the A Star search.
It can be downloaded here www.colab-aktiv.com/strangeDays/misc/freeStuff/
All the source files are included
It's done in Borland C++ Builder 6 but you should be able to port the classes to VS.
If you want to use it in Torque you'll probably have to implement it in C++
It requires nodes to be placed and if you look at the test map at how I've group nodes around the corners of walls you can see how it would be easy to find cover. Look for the closest node that is out of sight of the aggressor.
Anyone is free to use any of the code/classes they want.
When I develop this further I'll post it as a resource.
07/11/2007 (6:09 am)
I'm not sure if this is the sort of thing you are looking for but here it is anyway....I developed an AStar pathfinding test application a little while back.
The plan was to use it as a test bed for Hierarchical AStar pathfinding. At the moment I've just got the basic A star working.
It's in 2D but should work in 3D.
The cool thing about it is you can actually see how the computer performs the A Star search.
It can be downloaded here www.colab-aktiv.com/strangeDays/misc/freeStuff/
All the source files are included
It's done in Borland C++ Builder 6 but you should be able to port the classes to VS.
If you want to use it in Torque you'll probably have to implement it in C++
It requires nodes to be placed and if you look at the test map at how I've group nodes around the corners of walls you can see how it would be easy to find cover. Look for the closest node that is out of sight of the aggressor.
Anyone is free to use any of the code/classes they want.
When I develop this further I'll post it as a resource.
#5
Was having that same idea a while ago. The raycast could also grab the face normal, and then I would find a way of setting his transform so that he's right against the wall and facing the direction of the face normal. But then I'd need to know the area of the face so I don't end up taking cover behind a flower pot.
And then how can I make him stop when he reaches a corner? How does he tell when he's inbound to a corner?
@Chris
A* is a little different than we want here. I've actually been working on implementing that in 3d, too (Everyone, please stop reading my mind. It makes me uncomfortable). The cover system I have in mind would be to allow a player to run up to a wall in a firefight, press up against it to use as cover, and be able to fire strategically over the top and sides. Here's a good Rainbow Six Vegas video showing the cover system. Go ahead an fast forward to 1:36, you can see the guy up against his box reloading. He can stay there, fire blindly over the top and sides, expose only a small amount of himself to fire, or whatever he wants. What I've been doing to find cover by AI is choose random points around him, and run a RayCast from that point to the attacker to see if it works as cover. This cover system is for the player :-)
07/11/2007 (6:22 am)
@MattWas having that same idea a while ago. The raycast could also grab the face normal, and then I would find a way of setting his transform so that he's right against the wall and facing the direction of the face normal. But then I'd need to know the area of the face so I don't end up taking cover behind a flower pot.
And then how can I make him stop when he reaches a corner? How does he tell when he's inbound to a corner?
@Chris
A* is a little different than we want here. I've actually been working on implementing that in 3d, too (Everyone, please stop reading my mind. It makes me uncomfortable). The cover system I have in mind would be to allow a player to run up to a wall in a firefight, press up against it to use as cover, and be able to fire strategically over the top and sides. Here's a good Rainbow Six Vegas video showing the cover system. Go ahead an fast forward to 1:36, you can see the guy up against his box reloading. He can stay there, fire blindly over the top and sides, expose only a small amount of himself to fire, or whatever he wants. What I've been doing to find cover by AI is choose random points around him, and run a RayCast from that point to the attacker to see if it works as cover. This cover system is for the player :-)
#6
07/11/2007 (6:43 am)
Bryce, you could do that again with another raycast and if it doesn't hit an interior, block their movement bind. Have the function called every 500 milliseconds or so.
#7
EDIT: Idea. When he uses an object of cover, I could find the distance between where an immediate raycast would hit the wall behind him. That would be the minimum distance. If a raycast ends up striking something around a corner, get that distance. If it's bigger than the distance between the player and wall orginally, then the wall has changed.
07/11/2007 (6:54 am)
Maybe. But what if we are using it inside a large interior? Every nearby wall is part of that same interior.EDIT: Idea. When he uses an object of cover, I could find the distance between where an immediate raycast would hit the wall behind him. That would be the minimum distance. If a raycast ends up striking something around a corner, get that distance. If it's bigger than the distance between the player and wall orginally, then the wall has changed.
#8
07/11/2007 (10:23 am)
P.S. Nice program, ChrisG
#10
Now, the code itself was contracted, so i can't post it, i could give ideas and stuff, maybe some psuedo code.
If you're interesting, ping me, or yell at me here a lot, i'll probably post some stuff :p
07/11/2007 (2:02 pm)
I've actually done work on a cover system before, stylized a lot like gears.Now, the code itself was contracted, so i can't post it, i could give ideas and stuff, maybe some psuedo code.
If you're interesting, ping me, or yell at me here a lot, i'll probably post some stuff :p
#11
07/11/2007 (2:06 pm)
Post works for me!
#12
07/11/2007 (5:56 pm)
Jeff : I need that code :P Please post your ideas.
#13
what i did instead of firing ray casts constantly, etc though, is there's some functions in player.cc that dictate contacts with surfaces. So if a contact with a viable object happened(like an interior), you'd fire a raycast and get the surface normal.
From here, I did a gears approach, and basically turned the player around and forceds his back to the wall, and moved the camera so it was in front of the player facing the wall.
What you do then is guage the player's velocity, and if it's right or left along the wall, let him shimmy, and if it's away from the wall, then you pull off the wall, turn around and realign the camera.
And yes, you use raycasts to dictate if you're going to walk past the edge of the wall.
Ian: if you want, i could help you with it. drop me a line.
07/11/2007 (6:05 pm)
Well, you guys were going in the right direction with the raycast to get the surface, etc, etc.what i did instead of firing ray casts constantly, etc though, is there's some functions in player.cc that dictate contacts with surfaces. So if a contact with a viable object happened(like an interior), you'd fire a raycast and get the surface normal.
From here, I did a gears approach, and basically turned the player around and forceds his back to the wall, and moved the camera so it was in front of the player facing the wall.
What you do then is guage the player's velocity, and if it's right or left along the wall, let him shimmy, and if it's away from the wall, then you pull off the wall, turn around and realign the camera.
And yes, you use raycasts to dictate if you're going to walk past the edge of the wall.
Ian: if you want, i could help you with it. drop me a line.
#14
07/11/2007 (6:24 pm)
Thanks, everyone. Good inspiration :-)
#15
07/11/2007 (7:00 pm)
Thanks Reno, couldn't find your contact info so send us an email at iroach@westnet.com.au :)
Torque Owner Matt Vitelli