Page 8 of 11

Posted: Wed Jul 22, 2009 11:53 am
by wombat23
i'm pleased to see we keep making progress :P

modhippy can you give okidoki my MSN or ICQ contact so that i can talk to him?

about the code base (irrlicht vs. Q3 base): this is a decision yet to make and i think it's too early. we still dont have a full understanding of skc and all the other mohaa-specific stuff so it's more important to get a decent understanding of it no matter what engine.

my vote would go for Q3 base in the early stage to get things running on a satisfactory level.
then with the knowledge gained, write it from scratch on top of irrlicht or something.

so rookie you're still welcome to help out, the current codebase is not abandoned. my GS master code is crap, it doesnt even work right...

Posted: Wed Jul 22, 2009 12:26 pm
by Aprop
Writing two openmohaa's, first q3 based, second on other engine... well pretty crazy idea. Yes, I'm confident that we can do it Wombat's way. It can cause lil duplication of work, but who cares?

nvm Ill finish the Irrlicht skc/skd test project and then see...

Posted: Mon Aug 17, 2009 11:09 pm
by Aprop
I worked recently on bsp stuff dor irrlicht...and made a small example code that use pvs system and frustum culling to determine which surfaces are visible... . Im able to pause theaction and see what being culled:
Image
its not q3 map, its m6l* but I forgot to rename the window...
whats behind the corner
Image
and behind the camera - nodes out of view frustum arent drawn
Image



And today I added preliminary skd loader to our lovable q3 base
Image
You can spot here few deformed opel trucks...yup, actually bones'rent used, gotta work on it..

Posted: Tue Aug 18, 2009 12:17 am
by m0d hippY
Excellent job and progress Aprop.

I have only 1 question, is there any chance you can implement some kind of anti wallhack\cham protection?

In MOHAA heiko and I made a fix, but it's very glitchy and we haven't had time to perfect it.

The logic is pretty simple. we use trace_t to send traces from each players eye_bone to wherever they are looking. So if what they are looking at isn't part of a player (we trace the player by their bones), we don't render any players, otherwise if we trace some part of the player then we render it.

We tested this with a few players and it seemed to work fairly well and we didn't have much lag in game.

I think working on fixing cheats atm may not need to be a priority, but perhaps should still exist on the list of things to consider as a future implementation so that you can fairly easily implement the features as opposed to having completely rewriting it later on.

Just a suggestion, other than that great job man.

Posted: Tue Aug 18, 2009 7:58 am
by Rookie One.pl
Lol, Hippy, how can you possibly talk about that when the players are not even being rendered yet? Besides, if you're talking about that script that hides players, well, it's no real good because it basically hides EVERYONE that's not looking at someone else.

Aprop, I'm glad you're adding to our Q3 codebase. :) If you'd like svn commit access and Wombat hasn't already given it to you, PM me and I'll be happy to do it for you.

Posted: Tue Aug 18, 2009 12:04 pm
by m0d hippY
Hi Rookie,
No, the script is old news, we've moved far from that script. We actually implemented it into the gamex wrapper and it worked with several people.

I know the players aren't rendered yet, but I also found that part of the rendering had to do with the bspvis, and since Aprop is currently working on the mapping maybe he can implement something with that.

For example in regards to the mapping. This may be unethical to do (I remember we talked about this earlier rookie), because basically it would require implementing the "hint" parameter throughout the map. It has some kind of parameter that blocks vis.

It was tested in a sample map, but it was unethical on stock maps because it would require massive amounts of calculations and would take forever to load and probably cause lag, but I don't know if there was an easier way to do it, aside from the above method I mentioned. Anyway here are some code samples from heiko's wrapper.

Code: Select all

static const char *tracepoints[] = {
	"Bip01 Head",
	"Bip01 Pelvis",
	"Bip01 L UpperArm",
	"Bip01 R UpperArm",
	"Bip01 L ForeArm",
	"Bip01 R ForeArm",
	"Bip01 L Foot",
	"Bip01 R Foot",
	"Bip01 Neck",
	"Bip01 Spine",
	"Bip01 Spine1",
	"Bip01 Spine2",
	"Bip01 L Thigh",
	"Bip01 R Thigh",
	"Bip01 L Hand",
	"Bip01 R Hand",
	"Bip01 L Calf",
	"Bip01 R Calf",
	"Bip01 L Clavicle",
	"Bip01 R Clavicle",
	"Bip01 L Toe0",
	"Bip01 R Toe0",
	NULL
};

Code: Select all

static qboolean IsEntitySeenByEntity(gentity_t *gEntFrom, gentity_t* gEntTo) {
	qboolean seen = qfalse;
	//static vec3_t mins = { -10, -10, 0 };
	//static vec3_t maxs = { 10, 10, 94 };
	static vec3_t mins = { 0, 0, 0 };
	static vec3_t maxs = { 0, 0, 0 };

	Entity *entFrom = gEntFrom->entity;
	Entity *entTo = gEntTo->entity;
	
	int *weaponRef = NULL;
	int index = 0;
	int count = 2;
	int playerCurrent = 0;
	int targetCurrent = 0;
	vec3_t playerOrigin;
	vec3_t playerOriginBak;
	vec3_t targetOrigin;
	vec3_t targetOriginBak;
	
	vec3_t vecToEnemy;
	vec3_t vecView;
	
	//these four are used for the offset point estimation
	float oX;
	float oY;
	float m;
	float normSqrt;
	
	//This will be the current point we trace to.
	orientation_t oTo;
		
	//This is the viewer's eye.
	//orientation_t oFrom;
	//mEntityGetTag(gEntFrom->entity, (char *)"eyes bone", &oFrom);
	
	//Now trace the eye position to "well" defined points of the
	//we take the vViewPos instead of the eye bone pos, because the view pos is most likely not solid
	VectorCopy(((Player *)gEntFrom->entity)->vViewPos, playerOrigin);
	//fprintf(stderr, "tracing from eye: %f %f %f\n", playerOrigin[0], playerOrigin[1], playerOrigin[2]);
	
	//trace from the player to the target including movement prediction for both
	for (playerCurrent = 0; !seen && playerCurrent < count; playerCurrent++) {
		
		if (gameImport.pointcontents(playerOrigin, 0) != 0) {
			fprintf(stderr, "gameImport.pointcontents(playerOrigin, 0): %f\n", gameImport.pointcontents(playerOrigin, 0));
			goto newPos;
		}
		
		//backup the original value prior to modifying it for the eyes
		//VectorCopy(playerOrigin, playerOriginBak);
		
		VectorCopy(gEntFrom->client->ps.viewangles, vecView);
		//convert to forward vector
		vecView[2] = vecView[0] * M_PI * 2 / 360;
		vecView[1] = vecView[1] * M_PI * 2 / 360;
		vecView[0] = cos(vecView[2]) * cos(vecView[1]);
		vecView[1] = cos(vecView[2]) * sin(vecView[1]);
		vecView[2] = 0.0;
		
		//VectorScalarMult(vecView, 30.0, vecToEnemy);
		//VectorSub(playerOrigin, vecToEnemy, vecToEnemy);
		VectorSub(gEntTo->s.origin, playerOrigin, vecToEnemy);
		//VectorSub(gEntTo->s.origin, vecToEnemy, vecToEnemy);
		vecToEnemy[2] = 0.0;
		VectorNormalize(vecView, vecView);
		VectorNormalize(vecToEnemy, vecToEnemy);
		
		//fprintf(stderr, "VectorScalarProduct((%f, %f), (%f, %f)): %f\n", vecToEnemy[0], vecToEnemy[1], vecView[0], vecView[1], VectorScalarProduct(vecToEnemy, vecView));
		
		//behind us, save the trace
		if (VectorScalarProduct(vecToEnemy, vecView) < 0.4) {
			goto newPos;
		}
		
		//skip solid start points
#warning FIXME
		if (true || gameImport.pointcontents(playerOrigin, 0) == 0) {
			while (!seen && index < MAX_TRACEPOINTS) {
				//orient = gameImport.TIKI_OrientationInternal(tiki, gEntTo->client->ps.clientNum, gameImport.Tag_NumForName(tiki, "Bip01 Head"), 1.0);
				//orient = gameExportBackup.TIKI_Orientation(gEntTo, index);
				
				//normal bip01 tag
				if (tracepoints[index]) {
					mEntityGetTag(gEntTo->entity, (char *)tracepoints[index], &oTo);
					VectorCopy(oTo.origin, targetOrigin);
				}
				//some other tracepoints
				else {
					//Sentient::acitveWeaponList[x] is a SafePtr<Weapon>...
					weaponRef = (int *)((SafePtr_s*) &((Sentient *)entTo)->activeWeaponList[0])->ptr;
					
					//try the other 'hand'... this happens on nade secondary fire. i dunno why and how...
					if (!weaponRef) {
						weaponRef = (int *)((SafePtr_s*) &((Sentient *)entTo)->activeWeaponList[1])->ptr;
					}
					
					if (weaponRef) {
						mWeaponGetMuzzlePosition(weaponRef, targetOrigin, NULL, NULL, NULL, NULL);
					}
				}
				
				//backup the exact point
				VectorCopy(targetOrigin, targetOriginBak);
				
				//loop over all the possible offsets and calculate the destination origin
				for (int curOffset = offsetFirst; !seen && curOffset < offsetLast; curOffset++) {
					switch(curOffset) {
						//the exact point
						case offsetNone:
							break;
						case offsetLeft:
							oX = targetOrigin[0] - playerOrigin[0];
							if (oX == 0.0) {
								targetOrigin[1] = targetOrigin[1] + ADDITIONAL_TRACE_OFFSET;
								break;
							}
							oY = targetOrigin[1] - playerOrigin[1];
							if (oY == 0.0) {
								targetOrigin[0] = targetOrigin[0] + ADDITIONAL_TRACE_OFFSET;
								break;
							}
							m = -1.0 / (oY / oX);
							normSqrt = sqrt(m * m + 2);
							targetOrigin[0] = targetOrigin[0] + (1 / normSqrt) * ADDITIONAL_TRACE_OFFSET;
							targetOrigin[1] = targetOrigin[1] + (m / normSqrt) * ADDITIONAL_TRACE_OFFSET;
							break;
						case offsetRight:
							oX = targetOrigin[0] - playerOrigin[0];
							if (oX == 0.0) {
								targetOrigin[1] = targetOrigin[1] - ADDITIONAL_TRACE_OFFSET;
								break;
							}
							oY = targetOrigin[1] - playerOrigin[1];
							if (oY == 0.0) {
								targetOrigin[0] = targetOrigin[0] - ADDITIONAL_TRACE_OFFSET;
								break;
							}
							m = -1.0 / (oY / oX);
							normSqrt = sqrt(m * m + 2);
							targetOrigin[0] = targetOrigin[0] - (1 / normSqrt) * ADDITIONAL_TRACE_OFFSET;
							targetOrigin[1] = targetOrigin[1] - (m / normSqrt) * ADDITIONAL_TRACE_OFFSET;
							break;
						case offsetUp:
							targetOrigin[2] += ADDITIONAL_TRACE_OFFSET;
							break;
						case offsetDown:
							targetOrigin[2] -= ADDITIONAL_TRACE_OFFSET;
							break;
						default:
							assert(0);
					}
					
					//trace to the calculated position for different movement points
					for (targetCurrent = 0; !seen && targetCurrent < count; targetCurrent++) {
					
						//solid endpoints are skipped
						if (gameImport.pointcontents(targetOrigin, 0) == 0) {
							//fprintf(stderr, "to point: %f %f %f\n", targetOrigin[0], targetOrigin[1], targetOrigin[2]);
							seen |= gameImport.SightTrace(playerOrigin, mins, maxs, targetOrigin, 0, 0, CONTENTS_SOLID, qfalse);
							//if (seen) {
							//    fprintf(stderr, "first saw: %s: %f %f %f\n", tracepoints[index], targetOrigin[0], targetOrigin[1], targetOrigin[2]);
							//}
						}
						
						//if we did not get to the point try to trace points with respect to movement
						if (!seen && count > 1) {
							if (entTo->velocity[0] != 0.0 || entTo->velocity[1] != 0.0 || entTo->velocity[2] != 0.0) {
								//update the position to trace to in nths of frame time
								VectorMA(targetOrigin, entTo->velocity, FRAME_TIME / (count - 1), targetOrigin);
							}
							//if the velocity is 0 there's no sense in tracing further movement points
							else {
								break;
							}
						}
						
					}
					
					//restore the exact point
					VectorCopy(targetOriginBak, targetOrigin);
				}
				
				index++;
			}
		}
		
		//VectorCopy(playerOriginBak, playerOrigin);
		
newPos:
		if (!seen && count > 1) {
			if (entFrom->velocity[0] != 0.0 || entFrom->velocity[1] != 0.0 || entFrom->velocity[2] != 0.0) {
				//update the position to trace from in nths of frame time
				VectorMA(playerOrigin, entFrom->velocity, FRAME_TIME / (count - 1), playerOrigin);
			}
			//if the velocity is 0 there's no sense in tracing further movement points
			else {
				break;
			}
		}
	}

	return seen;
}

Posted: Tue Aug 18, 2009 12:10 pm
by wombat23
he does have svn permission.
guess he wanna improve it some more before putting anything up but i also think rookie and me are eager to see it :P

Posted: Tue Aug 18, 2009 2:18 pm
by Rookie One.pl
I'm glad to hear that, Wombat. :)

Hippy, you may want to make a separate topic about that, this is a progress report thread. Though you probably know I'm skeptical about this entire kind of solutions, they're ad-hoc and have drawbacks which are IMHO unacceptable.

Posted: Wed Aug 19, 2009 4:36 am
by Aprop
I'd like get'em textured first.. there isnt much to see, anyway.
Hippy, not in present stage of development.

Posted: Mon Aug 31, 2009 11:11 pm
by Aprop
Finally figured out what was wrong with shaders...
Image
Here you can see our opel trucks and few human models...yes, human... still workin' on anim' code.

Posted: Tue Sep 01, 2009 3:19 pm
by wombat23
the picture doesn't work for me. img199.imageshack gives "connection reset by peer".
but its a hell of a good piece of news anyway!

the server net code will be done, soon.

edit: it works now. cool

Posted: Fri Sep 04, 2009 11:05 am
by wombat23
i'm still working on the server net code.

by the way: interesting that the light spots are part of the model. wouldnt have expected that. but it makes sense somehow :)

Posted: Mon Sep 07, 2009 3:15 am
by Aprop
yea, thats tricky, even faster way for dynamic lights... afair its also used for spotlights, t34 lights(?) and projector glow in m2l*.bsp... (on screenshot above it doesnt looks like too well because shader's broken)
While ago I made small map for testing models, here are two screenshots, first of old render
Image
and the current version
Image[/img]

Posted: Mon Sep 07, 2009 5:17 am
by 211476
wow thats really nice, but that test map is horrible :D

Good Job!

Posted: Mon Sep 07, 2009 9:06 pm
by Aprop
Thanks... yea map's strange, especially that wavy shadow looks wierd... its because lightmap just doesnt fit that big wall...
Im working on human animatiosn right now, basics're done however rotations are still wrong... and the helper bones are messed up
Image
huh I dont know why that one truck's turned...
Image
hmm..looks like the I should scale down the screenshots next time..