Jump to content

Force power's interactions with item objects and npcs.


Lockgo

Recommended Posts

Hi everyone, I was thinking trying my had at moding the force powers a bit. Specifically force push/pull, and grip. Specifically how they interacted with items and ragdolls. For example, ammo boxes and med-pacs could be moved around with push and pull, but they always did this weird rotation thing where it looks like it was having a seizure, and after it landed it would always land on its side. The same side mind you, no matter how it fell.

 

Also, with fallen enemy bodies, if you used grip on them, there was a chance they legs would go right through the floor.

 

Any idea where in the code I could look at to edit it?

Smoo likes this
Link to comment

Well preventing clipping would be pretty hard since I can't really think of a way that you could do it without writing your own physics/collision engine.  w_force.c sounds like the right one for force powers, but not physics.

JKG Developer

Link to comment

I had item pushing in my mod years ago.  I forget where I got it from.

			} else if ( em_itemPush.integer && CheckPushItem( push_list[x] ) ) {	//rolling and stationary thermal detonators are dealt with below
				if ( push_list[x]->item->giType == IT_TEAM ) {
					push_list[x]->nextthink = level.time + CTF_FLAG_RETURN_TIME;
					push_list[x]->think = ResetItem;//incase it falls off a cliff
				} else {
					push_list[x]->nextthink = level.time + 30000;
					push_list[x]->think = ResetItem;//incase it falls off a cliff
				}

				if ( pull ) {
					//pull the item

					push_list[x]->s.pos.trType = TR_GRAVITY;
					push_list[x]->s.apos.trType = TR_GRAVITY;
					VectorScale(forward, -650.0f, push_list[x]->s.pos.trDelta);
					VectorScale(forward, -650.0f, push_list[x]->s.apos.trDelta);
					push_list[x]->s.pos.trTime = level.time;		// move a bit on the very first frame
					push_list[x]->s.apos.trTime = level.time;		// move a bit on the very first frame
					VectorCopy( push_list[x]->r.currentOrigin, push_list[x]->s.pos.trBase);
					VectorCopy( push_list[x]->r.currentOrigin, push_list[x]->s.apos.trBase);
					push_list[x]->physicsObject = qtrue;
					push_list[x]->flags |= FL_BOUNCE_HALF;
				} else {
					push_list[x]->s.pos.trType = TR_GRAVITY;
					push_list[x]->s.apos.trType = TR_GRAVITY;
					VectorScale(forward, 650.0f, push_list[x]->s.pos.trDelta );
					VectorScale(forward, 650.0f, push_list[x]->s.apos.trDelta );
					push_list[x]->s.pos.trTime = level.time;		// move a bit on the very first frame
					push_list[x]->s.apos.trTime = level.time;		// move a bit on the very first frame
					VectorCopy(push_list[x]->r.currentOrigin, push_list[x]->s.pos.trBase);
					VectorCopy(push_list[x]->r.currentOrigin, push_list[x]->s.apos.trBase);
					push_list[x]->physicsObject = qtrue;
					push_list[x]->flags |= FL_BOUNCE_HALF;
				}

There's a bit more to it than that, and other stuff that but is general idea of how to actually move them.

Smoo likes this
Link to comment

Last thing I want to do is rewrite the entire physic engine, since from what I read, would be a huge undertaking. I would be happy with say, if random rock debri worked like it did in the original Jedi Knight's Sith engine.

Link to comment

Where would be a good place to look for the items, when they rotate in mid flight? I just want to see if I can put a set landing position, instead of how they always land on the ground on the side.

 

or does g_exphysics.c cover that too?

Link to comment

You shouldn't even need to deal with g_exphysics.c for moving of items with relation to force powers.  That could be your issue right there if you have weird things going on if you are.

Its actually in base JA, its a weird thing the game always did. The moment you move shield/ammo box/guns, the game has them "land on their side" and as they are flying, they basically rotate on a set path.

 

From how I see it, it was a good enough illusion the game did as long as you didn't look to hard at it. since the items flying in the air won't even be in the air for longer then a second, and no one really will look at ammo boxes/guns on the ground since when you get close enough you automatically pick them up.

Link to comment

Easier, yes. Easy, no :P there's a whole load of issues with overloading the net code when too many things are moving about which I came across, and it's a lot of work to get a really good level of integration between the physics engine and the game itself :/

Lockgo and Smoo like this
Link to comment

you say the net code as it is a issue, can't it not be redone so it could handle it, its been seeing in some of the Q3 source codes where it has been done, Xreal engine and some other i can't remember the names of :)

Link to comment

As far as I know, none of the Q3 engine derivatives have made any extensive changes that would support massive number (e.g. 50+) objects all moving at the same time in one area. And I personally don't know what would need doing to allow this either. I'm sure there are games that have done it, but I've not really looked into it.

Smoo likes this
Link to comment

my mistake I did not mention that we talked about having to have 50 different things on a map at a time, believed just xreal could lower this sort of thing since they've thrown some sort of physics engine in the game :)

Link to comment

XreaL had experimental bullet support in its java version of the mod code, but it wasn't really going anywhere.  Not even networked.

 

@@Lockgo do you have a video to explain the weirdness you are seeing?  I don't really see any reason to be dealing with g_exphysics at all on item pickups.  As they already have a think function which also already does simple normal physics as it is.

Smoo likes this
Link to comment

I can make a video later on, I can't at the present moment, but its just something that always existed in Jedi Academy. Basically the object would rotate around one direction, the same direction, on its side, and then it will always land on its side, with half the object going through the floor. Probably where the model "center" was.

 

This always looked strange to me, especially since med packs have that trapezoid shape.

 

Just load game in single player, and force pull a medpack and watch it spin and land. Doesn't have to be a medpack, any item should do, just most noticeable with medpacks.

 

This isn't an issue in multiplayer, since they just bounce around like balls. Which of course is because the MP engine doesn't do half the stuff the SP engine does.

 

Xycaleth, do you need help porting your code?

Link to comment

I can make a video later on, I can't at the present moment, but its just something that always existed in Jedi Academy. Basically the object would rotate around one direction, the same direction, on its side, and then it will always land on its side, with half the object going through the floor. Probably where the model "center" was.

 

This always looked strange to me, especially since med packs have that trapezoid shape.

 

Just load game in single player, and force pull a medpack and watch it spin and land. Doesn't have to be a medpack, any item should do, just most noticeable with medpacks.

 

This isn't an issue in multiplayer, since they just bounce around like balls. Which of course is because the MP engine doesn't do half the stuff the SP engine does.

 

Xycaleth, do you need help porting your code?

Yes I know how it looks in SP.  Doesn't mean you have to do it that way in MP.  As previously mentioned ;)  You obviously want items to return to their place if not dropped in MP :D

Link to comment

Yes I know how it looks in SP.  Doesn't mean you have to do it that way in MP.  As previously mentioned ;)  You obviously want items to return to their place if not dropped in MP :D

In MP, I think I would just have any item that is "moved" to simply move back to its original position if left untouched, like it does normally, as well as have it respawn back if its falling for too long. "Endless pits".

 

I never intended to port my code :) if you're interested in trying or just to have a look at the code, search for "japhys source code" on google and you should find it pretty easily. It's hosted on google code.

Alright I will.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...