Feature Request: Timestamped message logging to stdout

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
Spirit
Posts: 1065
Joined: Sat Nov 20, 2004 9:00 pm
Contact:

Feature Request: Timestamped message logging to stdout

Post by Spirit »

Since the engine I use for video capturing (Coder went AWOL and I cannot share the source <crying smilie>) does not have an option to scale the messages in the top left of the screen ("You receive 15 health") and those can be hard to read on Youtube's embedded players, I am looking for a workaround.

Youtube supports "a simple caption format that is compatible with the formats known as SubViewer (*.SUB) and SubRip (*.SRT)", see http://support.google.com/youtube/bin/a ... wer=166810

Could someone tell me how to add stdout printing of those messages including a timecode (in demo time!) in above format (or any format really)? I mean, can somebody write that and give me the lines to paste? ;)

No reference binary needed really, those small hange engine release are cluttering up my collection enough already, heh.

I guess it is fairly simple but I would not know where to start searching for the time.

Thank you!

edit: Forgot the obligatory link to http://www.youtube.com/Quaddicted

edit2: Whoever does this may decide on what I will play through next (must be something <30 minutes playtime), I will upload the full fiasco.
Improve Quaddicted, send me a pull request: https://github.com/SpiritQuaddicted/Quaddicted-reviews
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: Feature Request: Timestamped message logging to stdout

Post by r00k »

Um, DarkPlaces (and Qrack) has con_textsize, which you can use to scale the console/onscreen text. Both record to avi too. If u have the source to your own capture engine u can look at DP or I can offer u a code tut to add such a feature to THAT engine...
Last edited by r00k on Wed Sep 05, 2012 3:51 pm, edited 1 time in total.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Feature Request: Timestamped message logging to stdout

Post by Baker »

1. Scaling text. Use -conwidth and -conheight command line parameters like -width 640 -conwidth 320 ... yada, yada ...

2. Print time to stdout if playing or viewing a demo ...

Find Sys_Printf in your source, probably sys_linux.c

Code: Select all

void Sys_Printf (char *fmt, ...)
{
	va_list		argptr;
	char		text[1024];
	unsigned char		*p;

	va_start (argptr,fmt);
	vsnprintf (text,sizeof(text),fmt,argptr);
	va_end (argptr);

....
    if (nostdout)
        return;

// Add start
     if (cls.state == ca_connected && cls.signon == SIGNONS)
	{
		int minutes = cl.time / 60; // Add me
		int seconds = cl.time - 60 * minutes; // Add me
		printf ("[%d : %d ] : ", minutes, seconds);
	}
// Add end
Spirit wrote:edit2: Whoever does this may decide on what I will play through next (must be something <30 minutes playtime), I will upload the full fiasco.
If I get to pick, I'd vote for Starship 2. The early era maps often aren't well represented and this would be a diverse YouTube treat.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Spirit
Posts: 1065
Joined: Sat Nov 20, 2004 9:00 pm
Contact:

Re: Feature Request: Timestamped message logging to stdout

Post by Spirit »

Baker wrote:1. Scaling text. Use -conwidth and -conheight command line parameters like -width 640 -conwidth 320 ... yada, yada ...
I feel so stupid now. Thanks! :)


The printf change led to
[0 : 3 ] : You got the [0 : 3 ] : shells[0 : 3 ] :
[0 : 4 ] : You got the [0 : 4 ] : Grenade Launcher[0 : 4 ] :
[0 : 12 ] : You receive [0 : 12 ] : 25[0 : 12 ] : health
[0 : 12 ] : You get [0 : 12 ] : 2[0 : 12 ] : rockets [0 : 12 ] :
[0 : 20 ] : You got the [0 : 20 ] : rockets[0 : 20 ] :
[0 : 22 ] : You got the [0 : 22 ] : nailgun[0 : 22 ] :
[0 : 29 ] : You got the [0 : 29 ] : nails[0 : 29 ] :
[0 : 33 ] : You got the [0 : 33 ] : nails[0 : 33 ] :
[0 : 34 ] : You receive [0 : 34 ] : 15[0 : 34 ] : health
[0 : 35 ] : You receive [0 : 35 ] : 15[0 : 35 ] : health
[0 : 37 ] : You got the [0 : 37 ] : rockets[0 : 37 ] :
[0 : 50 ] : You get [0 : 50 ] : 2[0 : 50 ] : rockets [0 : 50 ] :
[0 : 52 ] : You got the [0 : 52 ] : nails[0 : 52 ] :
[0 : 52 ] : You got the [0 : 52 ] : nails[0 : 52 ] :
[0 : 53 ] : You receive [0 : 53 ] : 25[0 : 53 ] : health
Does it work in a vanilla source? The engine is changed a bit but I would not expect such weirdness.

Nooooooo, Neil Manke, my second nemesis. As you say! :)

r00k: DP looks too different plus I do not trust it to be "bug-free-free" enough. Qrack can probably be made look vanilla but does not run on Linux (qudos' port broke for me ages ago). DP does not have any kind of easy demo capture, I always had to manually cut away console bits at the start and beginning. It is also nowhere as fast as my engine (which is pretty much i/o limited). I doubt Qrack is much different in that regard. Thanks though!
Improve Quaddicted, send me a pull request: https://github.com/SpiritQuaddicted/Quaddicted-reviews
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Feature Request: Timestamped message logging to stdout

Post by Baker »

The QuakeC was printing that text in a series of prints. So, let's work around that. And fix-up the time display ...

Tidy up revision:

Code: Select all

void Sys_Printf (char *fmt, ...)
{
	va_list		argptr;
   char      text[1024];
	unsigned char		*p;
	static char last = 0;  // ADD

	va_start (argptr,fmt);
	vsnprintf (text,sizeof(text),fmt,argptr);
	va_end (argptr);


	if (strlen(text) > sizeof(text))
		Sys_Error("memory overwrite in Sys_Printf");

    if (nostdout)
        return;

	if (cls.state == ca_connected && cls.signon == SIGNONS && last == '\n') // THIS CHANGED
	{
		int minutes = cl.time / 60; // Add me
		int seconds = cl.time - 60 * minutes; // Add me
		printf ("[%02d:%02d] : ", minutes, seconds);  // THIS CHANGED
	}

	for (p = (unsigned char *)text; *p; p++) {
		*p &= 0x7f;
		if ((*p > 128 || *p < 32) && *p != 10 && *p != 13 && *p != 9)
			printf("[%02x]", *p);
		else
			putc(*p, stdout);
	}
	last = *p; // ADD   THIS CHANGED 
You really don't like Neil Manke? I thought that selection would be a nice one because of the trestle bridge some of the puzzles are fun. Plus it has a frozen Shammy :D
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Spirit
Posts: 1065
Joined: Sat Nov 20, 2004 9:00 pm
Contact:

Re: Feature Request: Timestamped message logging to stdout

Post by Spirit »

Couldn't get it to work properly. conwidth made the engine capture in the same resolution (glorious bug). I will revisit this some other time.

Played the map some time ago, definitely one of his better maps for me. Thanks!

http://www.youtube.com/watch?v=VhlaOI4ElfU
Improve Quaddicted, send me a pull request: https://github.com/SpiritQuaddicted/Quaddicted-reviews
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Feature Request: Timestamped message logging to stdout

Post by Baker »

Spirit wrote:Couldn't get it to work properly. conwidth made the engine capture in the same resolution (glorious bug). I will revisit this some other time.

Played the map some time ago, definitely one of his better maps for me. Thanks!

http://www.youtube.com/watch?v=VhlaOI4ElfU
Those elevators sure didn't like you. Or the button that killed you twice. "Baker made me play this one" in the YouTube description, haha :D

You know ... I didn't remember that that map was both hard and slightly on the dark and ugly side. I just remember the experience of playing it and finding the frozen shambler, the bridge, and the wanted poster. And thinking about it, the map lighting wasn't very good either. This was one of the first custom single player maps I ever played and I think back then I was attracted to novelty items in maps (like frozen Shamblers, etc.) and didn't notice the kind of things about lighting that I do now.

Thanks for playing it.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Spirit
Posts: 1065
Joined: Sat Nov 20, 2004 9:00 pm
Contact:

Re: Feature Request: Timestamped message logging to stdout

Post by Spirit »

The Shambler and the place where some music played were great touches!
The lighting is not bad, the video came out way too dark.
Improve Quaddicted, send me a pull request: https://github.com/SpiritQuaddicted/Quaddicted-reviews
Post Reply