Forum archive
Writing a log file
- Hi,
After a bit of head scratching I've got JFDuke3d to compile. Fantastic work, thankyou so much. I'm planning to use it in some psychology studies and I need to be able to write a log file with the player's location and direction. This would need to be updated about every half a second at least. Can anyone tell me where to insert the code and roughly how to do it (I haven't written an C in years and my memory is very sketchy!).
Many thanks
John - Wouldn't recording a demo of the player's actions be more useful to you than a meaningless stream of coordinates that you'd then have to reattach some meaning to later on?
Jonathon - You may be right, but I can't see how the demo files work. In fact we've been using Duke3d for ten years for experiments and until now the only way to get the coordinates out was a version of the engine that someone had hexedited to dump coords from a demo. In fact it is exactly the coordinates we want, so it's more straightforward to write them directly into a file. We analyse the path data in matlab.
Anyway, I found a way to dump coordinates to the log using the OSDPrintf function. Clunky, but we really don't care! - Fair enough. Glad you got it working.
Jonathon - You can use EDuke32 and follow these steps:
- Open GAME.CON.
- Search for "actor APLAYER". It should look somewhat like this:
actor APLAYER MAXPLAYERHEALTH PSTAND 0 0
ifaction 0
action PSTAND - Change it to this:
gamevar x 0 2
gamevar y 0 2
gamevar z 0 2
actor APLAYER MAXPLAYERHEALTH PSTAND 0 0
getactor[THISACTOR].x x
getactor[THISACTOR].y y
getactor[THISACTOR].z z
addlogvar x
addlogvar y
addlogvar z
ifaction 0
action PSTAND
It will spit out the coordinates of the player to EDuke32.log about 26 times a second. - Open GAME.CON.