Game Development Community

fxForceField, Collision Object, Walls - request for beta tester

by Jaimi McEntire · in Torque 3D Professional · 08/27/2009 (2:09 am) · 36 replies

I've written a force field object for T3D. This lets you create force fields, walls that you can turn on and off, and generic invisible collision objects for those statics that just don't collide right. I'd like to have it tested a little more before I release it as a resource, and am requesting a beta tester or two.

To use this, you would need to be able to apply the following fixes to your T3D Beta 5:

www.garagegames.com/community/forums/viewthread/100447
www.garagegames.com/community/forums/viewthread/100449

Here is what it currently does:

It blocks player movement.
It does NOT block projectiles (you can shoot right through it).
It can be visible, or invisible (and still have collision)
You can turn it on or off (off will stop rendering and collision)
You can adjust the UV scaling.
It can use any material.
If you use a translucent material, it does not cast shadows.
If you use an opaque material, it casts shadows.

Here is a mysterious glowing yellow force field in the middle of the ruins:
www.aztica.com/images/fft1.jpg
Here are some steps made out of light (I was going to make a bridge of light, but then just got tired)
www.aztica.com/images/fft2.jpg
Here are the same steps, but with a stone material:
www.aztica.com/images/fft3.jpg
To test this, add this function to ObjectBuilder.Ed.Gui:

//------------------------------------------------------------------------------
// Environment
//------------------------------------------------------------------------------

function ObjectBuilderGui::buildfxForceField(%this)
{
   %this.className = "fxForceField";
   %this.addField("enabled","TypeBool","Enabled","true");
   %this.addField("visible","TypeBool","visible","true");
   %this.process();
}

And add this line to your "level" group in creator.ed.cs:

%this.registerMissionObject( "fxForceField");

Next, download this file:

www.aztica.com/images/fxforcefield.zip

And add the code to engine/source/t3D/fx, add it to your project, and rebuild. You should now have an fxForceField in the editor (under "level").

The following is a known issue:

A raycast will NOT select the item. I'll probably add the ability to process raycasts while the editor is open, and the ability to enable/disable raycasts, but for now, just select them in the tree.
Page «Previous 1 2
#1
08/27/2009 (7:16 am)
Ok, I'm DLing and testing, but I can tell it's great already!

Edit: I am not really a good beta tester, but here is what I have to report:

1. Installs flawlessly and easily
2. Functionality off/on and visible all work
3. shooting thru it at a static shape works fine
4. shooting an AI through it caused extreme lag, to the point where I thought the game had crashed
5. I could not test translucent or any other materials on it, because I haven't really begun my study of them yet, and I don't understand the material editor.
#2
08/27/2009 (12:27 pm)
Thanks for testing!

For a translucent material, you can use this:

singleton Material(ForceField)
{
mapTo = "unmapped_mat";
diffuseMap[0] = "art/environment/forcefield_yellow.png";
scrollDir[0] = "0.1 0";
castShadows = "0";
translucent = "1";
glow[0] = "1";
translucentBlendOp = "LerpAlpha";
emissive[0] = "1";
};

Just put it in a materials.cs (I'm testing in the warrior camp, so mine was in Genre Kits\FPS Genre Kit\game\art\shapes\WarriorCamp)

and then place this file in art/environment:

www.aztica.com/images/forcefield_yellow.png

I'll check out the extreme lag, I'm not sure what can be causing that. Thanks for catching it!
#3
08/27/2009 (12:50 pm)
Looks cool Jaimi -- I'll be trying this out later today!

I already know I would make a request for being able to stop projectiles though ;)

Quote:
Here are some steps made out of light (I was going to make a bridge of light, but then just got tired)
Back in the day, Tribes used a translucent DTS shape for it's forcefields -- I used to build whole entire structures out of them, and yes even a bridge of light too :)
#4
08/27/2009 (12:53 pm)
@Michael - no problem, I'm adding the CastRay in right now. It's still handy to allow projectiles through if you want to use it as a collision brush, so i'll make it user selectable.
#5
08/27/2009 (12:58 pm)
setting this up now, this would be awesome for simulated bullet penetration, perhaps instead of stopping projectiles use it to decrease bullet damage. similar to what call of duty modern warfare uses. though would have to figure out why it is lagging when shooting at AI
#6
08/27/2009 (2:37 pm)
I forgot to mention, although I am not sure it is relevant, that I am using Kevin Mitchell's custom AI, the code for it can be found here:

www.garagegames.com/community/resources/view/17253

Thanks for the materials Jaimi, I will try them out today sometime.
#7
08/27/2009 (2:57 pm)
@Steve - I'm able to duplicate this without AI, so I don't think it's the issue. It looks like something in stock T3D is not liking it. It happens when an explosion is too near the force field. I'm trying to track it down.
#8
08/28/2009 (11:38 am)
Steve,i believe you should disable the light (hasLight) in your explosions and projectiles.
#9
08/28/2009 (11:40 am)
@Picasso -

Is this in relation to the slowdown? I was thinking it was something in the shaders, nothing I do seems to fix it.
#10
08/28/2009 (1:28 pm)
@Jaimi -- in my case, it appears to most definitely *not* be related to the distance of the object from the force field. I put the stock car and an animated StaticShape of my own inches away from the force field and shot at them with no problems at all. The AI, however, causes problems regardless of his distance. I am using Gideon with whatever ammo comes stock.

@Picasso -- where are those fields located, please?



#11
08/28/2009 (3:16 pm)
Seems to work rather well for me, I didn't see any slowdown while firing projectiles through it.... so weird that.

But then I'm not using one of the betas, I'm using a fresh from the trunk build and just added the fxForcefield to the FPS Genre Kit. I did notice that SfxBackBuffer has been removed so I had to remove that line to get it to compile -- something you might want to keep in mind for the future...

The only AI test I did was one of my testing levels that had a pathed bot in it, and well he's pretty dumb anyway, so I don't know if his getting "hung up" had anything to do with the forcefield or not -- it's like he didn't know there was something in his way (but he has that problem with all kinds of things already).

The forcefield looks really cool when you animate the material, especially with some sort of electrical effect :D
#12
08/28/2009 (3:51 pm)
Quote:The forcefield looks really cool when you animate the material, especially with some sort of electrical effect

Oh come on, Michael - you can't put that sort of comment out there, and not follow it up with a video. Let's see! :)
#13
08/28/2009 (5:21 pm)
Hehe, that was awful of me wasn't it ;)

Had to do this from my laptop so no Advanced lighting, and apparently Screenr only records 3d at about 10 fps -- here you go:
electric forcefield
I had hoped it would show it at full speed...
#14
08/28/2009 (6:57 pm)
Here's one a little bit better -- used Torque's recordMovie() function and created a gif from it.i167.photobucket.com/albums/u143/heretek/torque/FF_electric01_thumb.gifNow to set them to a team so that team members can pass through and also make them use power so that the enemy team has to destroy the generators in order to knock the forcefield down.
#15
08/29/2009 (12:36 am)
@Michael - That's pretty good!
#16
08/29/2009 (3:17 pm)
Jaimi -- at this point, it appears to be working fine for me. My problem was related to the AI I am using. I am sorry that I did not realize that before telling you it was related to the force field.
#17
08/29/2009 (10:39 pm)
@Jaimi: WoW! This is exactly what we are looking for. Thank you. We want to use these for setting up collision detection on DTS-based buildings/interiors instead of using a DIF or polysoup. It would be great if we had a way to see them while in the World Editor and then they are invisible while in run mode.

Why? We prefer to use one 3D graphics package (Houdini) and not have to use Constructor for our buildings.

We will start testing your current version tomorrow.

#18
08/29/2009 (11:05 pm)
@Scott - That's how it works now. Just put a material on it (something semi-transparent), and then set visible=false and On=true. Whenever the editor is on, it will ignore the visible flag & "on" flags, and render anyway.

@Steve - That's no problem. It did let me see another problem, but I'm not sure it's related to my code. Sometimes explosions cause an extreme lag. It may just be something in B5.
#19
08/29/2009 (11:25 pm)
@Jaimi: Just in case I forgot to mention.....You da man!

#20
10/25/2009 (2:45 pm)
Hi Jaimi,

I'm very interested in this resource. Where are you on the testing? Do you need some help?

I tried in the 1.0.1 version, and I have some compilation errors.
I applied this change:
ri->objectToWorld = renderPass->allocUniqueXform( objectToWorld );
      ri->worldToCamera = renderPass->allocSharedXform(RenderPassManager::View);
      ri->projection    = renderPass->allocSharedXform(RenderPassManager::Projection);
I comment the //ri->backBuffTex = GFX->getSfxBackBuffer();

Will test and keep you updated.
edit: Seems to work. I have some issue when moving the object from On to Off and Off to On. When I put the object to off, I have difficulties to through it. And after 2 or 3 tries, that seems to works. I will try to get you a way to reproduce this bug. Edit: it seems to happened when you are in a building like station01, you look from the inside the force field and put it off, you can't go out :(.

More off will not stop rendering but only collision. Here is my declaration.
new fxForceField(Entrance) {
      Material = "energy";
      On = "1";
      Visible = "1";
      scaleU = "1";
      scaleV = "1";
      DefaultLight = "0";
      position = "32.392 -17.6143 245.054";
      rotation = "0 0 1 55.0614";
      scale = "5.04052 0.897383 9.82341";
      canSaveDynamicFields = "1";
         enabled = "1";
   };
Page «Previous 1 2