Game Development Community

Crouching?

by Tyler Slabinski · in Torque Game Engine · 11/24/2009 (6:12 pm) · 21 replies

Let's say that the player needs to crouch... How do I shrink the bounds box ingame so that it is half-height? Is there some kind of function that can do this?
Page «Previous 1 2
#1
11/24/2009 (11:08 pm)
www.garagegames.com/community/resources/view/4348
There are quite a few updates and addons to this resource - off the top of my head, I think the main ones were by Josh Moore and Ron Nelson.
#2
11/25/2009 (7:00 pm)
Well I can't get that resource to work. Does anyone have a working copy of the player.cc and player.h file with that resource? I tried for the past 2 days to get it to work.
#3
11/25/2009 (7:19 pm)
post your errors and I'll help ya get it working, never implemented it, nor do i have crouch animations to test it with to get it working.
#4
11/25/2009 (7:51 pm)
Ok, give me one sec.
#5
11/25/2009 (10:43 pm)
Well TGE crashes when it loads the player.cs file, so I will post that here:

datablock TSShapeConstructor(PlayerDts)
{
   baseShape = "./player.dts";
   sequence0 = "./player_root.dsq root";
   sequence1 = "./player_forward.dsq run";
   sequence2 = "./player_back.dsq back";
   sequence3 = "./player_side.dsq side";
   sequence4 = "./player_lookde.dsq look";
   sequence5 = "./player_head.dsq head";
   sequence6 = "./player_fall.dsq fall";
   sequence7 = "./player_land.dsq land";
   sequence8 = "./player_jump.dsq jump";
   sequence9  = "./player_diehead.dsq death1";
   sequence10 = "./player_diechest.dsq death2";
   sequence11 = "./player_dieback.dsq death3";
   sequence12 = "./player_diesidelf.dsq death4";
   sequence13 = "./player_diesidert.dsq death5";
   sequence14 = "./player_dieleglf.dsq death6";
   sequence15 = "./player_dielegrt.dsq death7";
   sequence16 = "./player_dieslump.dsq death8";
   sequence17 = "./player_dieknees.dsq death9";
   sequence18 = "./player_dieforward.dsq death10";  
   sequence19 = "./player_diespin.dsq death11";
   sequence20 = "./player_looksn.dsq looksn";
   sequence21 = "./player_lookms.dsq lookms";
   sequence22 = "./player_scoutroot.dsq scoutroot";
   sequence23 = "./player_headside.dsq headside";
   sequence24 = "./player_recoilde.dsq light_recoil";
   sequence25 = "./player_sitting.dsq sitting";
   sequence26 = "./player_celsalute.dsq celsalute";
   sequence27 = "./player_celwave.dsq celwave";
   sequence28 = "./player_standjump.dsq standjump";
   sequence29 = "./player_looknw.dsq looknw";
   sequence30 = "./player_swimroot.dsq swimroot";
   sequence31 = "./player_swimforward.dsq swim";
   sequence32 = "./player_crouchroot.dsq crouchroot";
   sequence33 = "./player_crouchforward.dsq crouchforward";
};

I feel like this is going to be a simple answer that I am missing...
#6
11/26/2009 (12:13 am)
Sounds a lot like you're exceeding the maximum size limit to transmit the datablock over the network. I seem to remember that would happen around 33 animations.

Are you running a debug build? If so, you will be able to find out whether my guess is right.

Either way, I highly recommend this resource.
#7
11/26/2009 (2:17 am)
EDIT: Nevermind.
#8
11/26/2009 (2:46 pm)
Well I still can't get this to work. I tried implementing that new resource you showed me, but it doesn't help. Everything compiles fine, but when I try to start up any mission it crashes. Here is the last piece of the log:

//-----------------------------------------------

Loading light datablocks from: common/lighting/filters/*.dso
Loading compiled script common/lighting/filters/test.cs.

Loading light datablocks from: common/lighting/filters/*.cs
Loading compiled script common/lighting/filters/test.cs.
Loading complete.
//-----------------------------------------------

Loading compiled script starter.fps/server/scripts/player.cs.
Loading compiled script starter.fps/data/shapes/player/player.cs.
Validation required for shape: starter.fps/data/shapes/player/player.dts

That last part comes only after I force the task to stop. Anyone see a problem in that? Doesn't seem too abnormal to me.
#9
11/26/2009 (5:06 pm)
No... it seems like it's loading player.cs all right. Again: are you using a debug build? That should give you more information on the crash.
#10
11/26/2009 (5:09 pm)
Yes, I am using the debug build. I will upload the files I am using.
#11
11/26/2009 (5:25 pm)
Here are the files I'm using:

CrouchSwim File

I included the source files I changed, the starter.fps file that I've been using, and the actual debug build I am using. Unfortunately I use a Mac, so you will need to compile it if you use Windows or Linux.
#12
11/26/2009 (7:01 pm)
If you're running debug and not getting an error message telling you what went wrong, it sounds like an infinite loop somewhere. I'll take a look at the files.

EDIT: Or... I will... when I can figure out how I'm supposed to download the ZIP...
#13
11/26/2009 (7:46 pm)
Near the bottom there is something that says 'Save file to your PC'.
#14
11/26/2009 (11:42 pm)
Oh wow, they didn't want to make that too difficult, I see ;P. Downloading now.
#15
11/26/2009 (11:45 pm)
Tell me about it, next time I'm uploading on rapidshare.
#16
11/28/2009 (8:37 pm)
Well I have good and bad news.

The good is that I re-made the player.cc file with the resource. It doesn't crash, and the water works now.

The bad news is that the new animations don't work. Crouching, proning, and swimming animations don't work.

EDIT: Ok, I've just about given up on this resource. The swimming doesn't work how I expected (looking for half-life/quake style swimming), the resource is outdated, and I can't seem to get any of the animations to work.

Anyone have a better solution for this?
#17
11/28/2009 (9:54 pm)
You're right, it's pretty outdated, but as far as I recall nobody else has ever really implemented that functionality in Torque. I have managed to get it working before, though. I promise I'll take a look at your files soon, if you're still going to stick with this resource.

I'm almost finished with my advanced player class which you might be interested in - but I'm not sure how much longer it will take to do the final few items. But it's got basically what you're looking for in terms of stances and animations, in addition to FPS torso twisting, feet-aligning-to-ground, and a few other goodies (last to be implemented: advanced arm animations). It's a pretty huge change, especially in terms of art - neither Kork nor the default player datablock will work with my new system, and it's a lot to absorb.
The advantage is that it's an entire separate class, basically, so you can run it alongside the standard Player class no worries. (I actually just modified Player, and lots of parts are still the same - but it's certainly feasible to have both classes in the engine at once.) Changes to things like TSShapeConstructor notwithstanding.

There's also a swimming resource around here somewhere - you could use that to replace the swimming code, which I do remember was a little janky.
#18
11/28/2009 (10:07 pm)
Yea, I only know the very basics of C++, and I don't know how the engine works. I'm definitely not going to use that resource though, it's too glitchy and wasn't even made for 1.5
#19
12/09/2009 (12:02 am)
If you give it a little time to cool off, I can vouch for that resource - I'm pretty sure I got it to work with little modification when I was first playing around with stuff.

RE animations not working: from a quick glance at the files you sent me, it seems that pickActionAnimation isn't done right. Here's the general format:
if (mFalling)
   {
   }
   else
   {
      if(getPlayerPosition() == 1) {
         if (mContactTimer >= sContactTickTime) {
            // Nothing under our feet
            action = PlayerData::RootAnim;
         }
         else
         {
            // Our feet are on something
            // Pick animation that is the best fit for our current velocity.

            //AND SO ON
         }
      }
      else if (getPlayerPosition() == 2) {  
         action = (mVelocity.len() < 0.5) ? PlayerData::CrouchRootAnim : PlayerData::CrouchForwardAnim;  
      }  
      else if (getPlayerPosition() == 3) {  
         action = (mVelocity.len() < 0.5) ? PlayerData::CrawlRootAnim : PlayerData::CrawlForwardAnim;  
         if (mWaterCoverage != 0.0f) {  
            action = (mVelocity.len() < 0.5) ? PlayerData::SwimRootAnim : PlayerData::SwimAnim;  
         }  
      }  
   }
   setActionThread(action,forward,false,false);

As it is now, you're setting crouch and prone animations, then letting the normal animation code overwrite all of that.
#20
12/09/2009 (3:38 pm)
You know what? I am just going to use your advanced player resource when you are done. I need to implement those other things you have, so why not?

I'll just work on the other parts of my game.
Page «Previous 1 2