Stealthy game
by Alexander B · in Torque Game Engine · 08/12/2009 (4:07 am) · 27 replies
I am making a game based around stealth and I have 4 questions. Please reply if you know the answer as it will help my team a lot.
1. How do I make it so when the player goes into an object the game loads the next mission?
2. I have implented the aiguard resource but when I try to sneak up behind them they detect me without even looking at me. Is there a better ai resource for stealth? If there is not what should i do?
3. My player uses claws, what should i do to implent melee?
4. When the player progresses to a certain level I want the player to become faster. I know how to make the player faster but im not sure how to make it work for only some levels.
Thanks in advance
1. How do I make it so when the player goes into an object the game loads the next mission?
2. I have implented the aiguard resource but when I try to sneak up behind them they detect me without even looking at me. Is there a better ai resource for stealth? If there is not what should i do?
3. My player uses claws, what should i do to implent melee?
4. When the player progresses to a certain level I want the player to become faster. I know how to make the player faster but im not sure how to make it work for only some levels.
Thanks in advance
#2
2: You would have to factor in directional awareness based on where the AI is facing.... I had thought that the Improved AI Guard did that.
3: Use one of the melee resources; or fake it with invisible projectiles, raycasts, etc.
4: Levels as in game levels/missions or player levels? Simple easy way would be to have a unique player datablock per level. Or you could follow one of the dynamic attribute adjustment resources.
08/12/2009 (9:49 am)
1: Use a trigger, plenty of examples of mission loading from triggers can be found in the forums...2: You would have to factor in directional awareness based on where the AI is facing.... I had thought that the Improved AI Guard did that.
3: Use one of the melee resources; or fake it with invisible projectiles, raycasts, etc.
4: Levels as in game levels/missions or player levels? Simple easy way would be to have a unique player datablock per level. Or you could follow one of the dynamic attribute adjustment resources.
#3
08/13/2009 (5:52 am)
Thanks for your answers as it really helps :) Michael for the forth question i mean a mission. So on lets say the forth mission the player goes much faster then on the third mission.
#4
08/13/2009 (8:51 am)
In that case the simplest easy method would be to a player datablock for levels 1-3 and then for stages 4+ you could use a differnt datablock with different values.
#5
08/15/2009 (6:59 am)
Also, for the AI, I think some AI resources make use of a 'sixth-sense' to automatically detect nearby players. You might want to get rid of that.
#6
You can also change the distance the player has to be before the AI sees them.
Both of those snippets are at the top of AIGuard.cs
08/15/2009 (10:30 am)
In the AI guard resource, you can adjust their Field of View.$AI_GUARD_FOV =260; //The guards field of vision
You can also change the distance the player has to be before the AI sees them.
$AI_GUARD_DETECT_DISTANCE =250; //The range at which a guardbot will start reacting to a client target $AI_GUARD_IGNORE_DISTANCE = 105; //The range at which the bot ignores a client and will not fire on it.
Both of those snippets are at the top of AIGuard.cs
#7
09/06/2009 (5:36 am)
Thnaks for your replys. I still have a major issue. For the melee how do i get an invisible projectile that has a very short range?
#8
For the short range, you would have to modify the lifetime field based upon the muzzleVelocity(speed) in order to best approximate the range of your invisible projectile. I use the following formula when I adjust those values for a ranged projectile:
distance / muzzleVelocity = lifetime distance = desired range in meters
muzzleVelocity = speed in meters/second
lifetime = time in ms that the projectile is "alive"
Since the projectile doesn't have to travel all that far I would use a relatively slow projectile speed just to give you some timing to play with. So lets say a muzzleVelocity of 10, and let's fudge it a little and give it a 2 meter range:
2m / 10m/s = 0.2 seconds (or 200 ms) Just plug those values into the relevant datablock fields and adjust to taste.
09/06/2009 (7:47 am)
To make the projectile invisible just comment out the projectileShapeName field in the projectile datablock. Depending on the effect you want, you may also want to comment out the explosion and particleEmitter fields also. For the short range, you would have to modify the lifetime field based upon the muzzleVelocity(speed) in order to best approximate the range of your invisible projectile. I use the following formula when I adjust those values for a ranged projectile:
muzzleVelocity = speed in meters/second
lifetime = time in ms that the projectile is "alive"
Since the projectile doesn't have to travel all that far I would use a relatively slow projectile speed just to give you some timing to play with. So lets say a muzzleVelocity of 10, and let's fudge it a little and give it a 2 meter range:
muzzleVelocity = 10; lifeTime = 200;And you will have to tweak these values to what works best for you. One Torque unit doesn't not equal one meter (despite the popular misconception) -- you will have to visually judge if the combination of speed and lifetime gives you the desired range. To me the above values seem to approximate the range of a knife or dagger.
#9
09/06/2009 (12:25 pm)
Quote:One Torque unit doesn't not equal one meter (despite the popular misconception)Could you elaborate on this? Sorry it's a little OT ;P.
#10
It's just a conclusion of mine after visually judging distance and scale of various objects after using Torque for architectural rendering... and also after trying to adjust the range of the above projectile.
It's probably more of 'feel' thing than a valid observation, but I've found that when converting some house plans over into Torque units that a value of 0.4 gives me a foot. Whereas if 1 TU = 1m then that should have been 0.3 (0.3058).
Different player scales, FOV, camera height, etc all play a factor that in time has caused me to feel that overall scale/distance in Torque is actually more of a relative value than the absolute rule of 1:1 that seems popular among artists and various exporters.
But hey, I could be wrong too :D
09/06/2009 (2:15 pm)
@Daniel:It's just a conclusion of mine after visually judging distance and scale of various objects after using Torque for architectural rendering... and also after trying to adjust the range of the above projectile.
It's probably more of 'feel' thing than a valid observation, but I've found that when converting some house plans over into Torque units that a value of 0.4 gives me a foot. Whereas if 1 TU = 1m then that should have been 0.3 (0.3058).
Different player scales, FOV, camera height, etc all play a factor that in time has caused me to feel that overall scale/distance in Torque is actually more of a relative value than the absolute rule of 1:1 that seems popular among artists and various exporters.
But hey, I could be wrong too :D
#11
09/06/2009 (7:00 pm)
Where is the pojectil datablock? I hvae looked in most of the scipts in server/scripts but haven't found anything related to the projectile.
#12
Since you're wanting this for a custom weapon just use the crossbow projectile as a reference on how to write your own projectile datablock. Then in your weapon's ShapeBaseImageData datablock you would make sure that the projectile field points to your newly created projectile datablock.
09/06/2009 (7:28 pm)
Each weapon will/should have it's own group of associated datablocks. In the case of the stock scripts (starter.fps), these will be found in crossbow.cs in the server side scripts. In it you'll find sound, particles, debris, explosion, projectile, ammo, weapon, and image datablocks. The one you want is ProjectileData(CrossbowProjectile).Since you're wanting this for a custom weapon just use the crossbow projectile as a reference on how to write your own projectile datablock. Then in your weapon's ShapeBaseImageData datablock you would make sure that the projectile field points to your newly created projectile datablock.
#13
09/06/2009 (10:42 pm)
Okay, thanks. I'm just making the assumption of 1TU=1m because all the physics seems to be programmed in metric units (though I have little knoqledge of how physics is different with Imperial measures). I think if we scale our art appropriately then it should fit perfectly well - but of course, in a 3D world where units on't mean anything, there'd be nothing to stop us assuming 1TU=1ft or something like that - we'd just have to adjust gravity and all the other stuff.
#14
09/07/2009 (3:41 am)
Well i commented out the rpojectile line. I even deleted the line but the Projectile is still there. Any ideas on why it is still there? However i did what you said and the Projectile ony goes so far so thanks for that.
#15
You could try setting the scale to "0 0 0" :P.
09/07/2009 (9:03 am)
Any console errors? If your script didn't compile then it might be using an old version of the script, before you made the changes. Or Projectiles might require a shape name (I doubt it).You could try setting the scale to "0 0 0" :P.
#16
Since you're able to see that the "projectile only goes so far" you may also want to comment out the particleemitter = "" line in the projectile also.
But yeah, are there any console errors?
09/07/2009 (1:44 pm)
I didn't think about trying that scaling to 0 trick, but I do know that commenting projectileShapeName in TGEa/Torque3D will give you an invisible projectile -- it should in TGE also. Since you're able to see that the "projectile only goes so far" you may also want to comment out the particleemitter = "" line in the projectile also.
But yeah, are there any console errors?
#17
Thanks so much michael and the people who helped me.
EDIT: Well i have 3 problems already hehe. My first problem is that when I hit another character i bounce back and so does the ai. I really need to stop that otherwise it looks stupid.
My second problem is that when i kill the ai the body just stays tehre. No death animation. How do I change the ai's animations?
My third problem is i need to change the ai's weapon how can i do that?
Thanks :)
09/08/2009 (3:36 am)
I have got rid of the projectile by commenting out particleemitte. I don't need any more hlp just yet but I will post when i do.Thanks so much michael and the people who helped me.
EDIT: Well i have 3 problems already hehe. My first problem is that when I hit another character i bounce back and so does the ai. I really need to stop that otherwise it looks stupid.
My second problem is that when i kill the ai the body just stays tehre. No death animation. How do I change the ai's animations?
My third problem is i need to change the ai's weapon how can i do that?
Thanks :)
#18
09/08/2009 (10:25 am)
Quote:My first problem is that when I hit another character i bounce back and so does the ai. I really need to stop that otherwise it looks stupid.Is that when you use your melee-attack projectile? Look at CrossbowProjectile::onCollision. There should be code to add impulse to hit objects (if not, then it's in the function radiusDamage). You'll need to figure out how to reduce the impulse.
#19
09/08/2009 (12:01 pm)
Quote:If you're using a custom shape you will need to make sure that it has a TSShapeConstructor which is assigning and loading the animations -- take a look at the existing one for hte stock players in the data/shapes/player directory
My second problem is that when i kill the ai the body just stays tehre. No death animation. How do I change the ai's animations?
Quote:My third problem is i need to change the ai's weapon how can i do that?Take a look at function AIManager::spawn() in aiplayer.cs -- it's here that the ai is given a weapon and ammo to use it. At some point in time you'll probably want to "upgrade" the methods in there with one of the AI resources.
#20
Anyway I am using the aiguard resource and in aiguard.cs instead of the ai using the corssbow i said fsmg becuase thats the gun im using and i have a scipt in server.sctipts that is the same as the corssbow.cs scipt except it has all the fsmg sounds and the .dts file path.
However ingame the ai has no weapon and in the console i keep getting this error:
starter.fps/server/scripts/inventory.cs (134): Unable to find object: 'fsmgAmmo' attempting to call function 'getName'
As for the ai's aniamtion Im unsure on what to do. In the ai's folder it has player.cs with all the ai' aniamtions. However i don't think the game is loading the scipt. How do i get the script to load.
09/09/2009 (3:58 am)
Thanks for your replys. I have got rid of the knockback. You have to comment out pretty much everything aftr // Apply the impulse in radiusDamage.csAnyway I am using the aiguard resource and in aiguard.cs instead of the ai using the corssbow i said fsmg becuase thats the gun im using and i have a scipt in server.sctipts that is the same as the corssbow.cs scipt except it has all the fsmg sounds and the .dts file path.
However ingame the ai has no weapon and in the console i keep getting this error:
starter.fps/server/scripts/inventory.cs (134): Unable to find object: 'fsmgAmmo' attempting to call function 'getName'
As for the ai's aniamtion Im unsure on what to do. In the ai's folder it has player.cs with all the ai' aniamtions. However i don't think the game is loading the scipt. How do i get the script to load.
Torque 3D Owner ERICK MIRANDA M
I think it is the easiest way, and the code when the player enter the trigger
datablock TriggerData(nameTrigger) { tickPeriodMS = 100; }; function nameTrigger::onEnterTrigger(%this,%trigger,%obj) { Parent::onEnterTrigger(%this,%trigger,%obj); schedule( 0, 0, loadMission, "complete/path/to/mission"); }