Tracking players


(DanteX) #1

Hi, there’s a modding mewbie behind the keyboard here!

Anyway, I wonder if there is a way to track the players’ positions during the game and export it to for instance an extrenal log file.

The export is no problem, locating where the players position can be extracted from is, and determining which type of entity we are tracking is somewhat problematic too.

Thankful for any help…


(IneQuation) #2

If you are running etpro then all of this is no problem when using etpro-lua.


(DanteX) #3

hmmm…I can’t use ETpro (sadly), I’m doing this as part of a school projectso there are restrictions to what I can or can’t use.

Any ideas how to find and track the position of a player without resorting to ETpro? I mean, it must be possible, right?

Clarification: I need to find outwhere the variables that contain the positions of a player are located so I can export them.


(SCDS_reyalP) #4

Clarification: I need to find outwhere the variables that contain the positions of a player are located so I can export them.

I’m confused… are you trying to do this as a mod (from gamecode) or what ? Doing it from server gamecode is trivial.


(Nail) #5

hmm, sounds like part of the ultimate mortar script :lol:


(DanteX) #6

As I wrote, I’m pretty new to the modding scene, but yeah, this is supposed to be a mod for the server. The idea is to be able to export the positions and some other stats of the players to a external application. The problem right now is trying to find a good place to extract the positions.

I realize that this may sound like a way to keep an eye on opponents, but the idea is to use ET as a way to demonstrate the extrenal application’s ability “connect” to any source.


(SCDS_reyalP) #7

Well, assuming you know a little bit of C, that should be very easy. Download the game source ( ftp://ftp.idsoftware.com/idstuff/et/sdk/ ), and add a bit of code to send the players origins to your external program (by writing to a file or pipe or something like that).

I would start by looking at src/game/g_main.c as that is where all the server code runs from. You could get the origins in G_RunFrame

The sticky threads should tell you how to get your mod compiled an running.


(Nail) #8

sorry to sound so cynical, I’m old


(DanteX) #9

Well, I managed to find a place and a way to “dump” the origins of the players to an extrenal source. The problem I have now is that the numbers I get make no sense to me. what I believe to be xyz co-ordinates are in the range of gianormous numbers and seem to change with the movement in odd ways.

I’m I missing someting crucial, reading the positions at the wrong place or am I just waaay off?


(IneQuation) #10

It would help a lot if you explained how are you obtaining these origins. And it’s quite possible that those numbers go up to teen-thousands (1 foot = 16 units = 30.48 cm), both positive and negative.


(DanteX) #11

Ok, that’s my newbness showing I guess, I currently obtain the origins from this simle line place in PmoveSingle in bg_pmove. (S_log is my own functionfor dumping the info to the file).



void PmoveSingle (pmove_t *pmove) {
// RF, update conditional values for anim system
	BG_AnimUpdatePlayerStateConditions( pmove );

	pm = pmove;
/*	
#ifdef GAMEDLL
	S_LogPrintfts("Position: {%i} (%i, %i, %i)
", pm->ps->clientNum, pm->ps->origin[0], pm->ps->origin[1], pm->ps->origin[2]);
#endif

There’s “reaction” every time a player moves, but as I said, the numbers are quite odd, if they ranged in the ten-thousands I wouldn’t be as puzzled as I am now, they actually range in well millions.

Now I have to thank you for the info on the “scale”, I’ve been looking for that info but haven’t been able to find it.


(SCDS_reyalP) #12

vec3_t is an array of floats.


(DanteX) #13

That it is, my mistake.

Well, let’s jst say that the numbers make a fair bit more sense now…thanks a bunch!


(IneQuation) #14

Damn type casting. :stuck_out_tongue:

As for the scale… :wink: