Author Topic: Amanieu's server-side demo mod  (Read 12274 times)

Amanieu

  • Posts: 647
  • Turrets: +135/-83
    • Amanieu
Amanieu's server-side demo mod
« on: October 03, 2008, 10:22:15 pm »
Server-side demos allow a server to record a complete game to a file and then play it back later. Recording and playback are both done on the server. When a demo is being played, every player on the server will be forced into the spectators team. They will be able to spectate all players which were recorded in the demo.

Now, to set up server-side demos on your server, you need 2 things: A patched game.qvm, and a tremded with server-demo support.
So far, only tremfusion and fsm-trem have server-side demo support. You will need to use one of these two in order to have server-side demos.
I have provided a patched version of Lakitu7's qvm with server-side demo support, but the patch can be applied to any other qvm.

Lakitu7's qvm with server-side demos
Patch

Cvars:
sv_autodemo: Set to 1 to automatically record a demo at the start of each map
sv_demostate: Current demo state: 0 = none, 1 = playing, 2 = recording
sv_democlients: Must be >= to the value of sv_maxclients used when recording a demo in order to play it

Commands:
demo_record <name>: Records a demo
demo_stoprecord: Stops recording a demo
demo_play <name>: Plays a demo
demo_stop: Stops playing a demo

If you would like admins to be able to record and play demos, you can make commands in admin.dat by following this tutorial
« Last Edit: October 09, 2008, 11:44:21 pm by Amanieu »
Quote
< kevlarman> zakk is getting his patches from shady frenchmen on irc
< kevlarman> this can't be a good sign :P

David

  • Spam Killer
  • *
  • Posts: 3543
  • Turrets: +249/-273
Re: Amanieu's server-side demo mod
« Reply #1 on: October 04, 2008, 01:40:24 am »
Nice.
Whats the status on client playback?
Where are the files stored, what format, and how big are they?  (And does it record when the server is empty?)
Any maps not in the MG repo?  Email me or come to irc.freenode.net/#mg.
--
My words are mine and mine alone.  I can't speak for anyone else, and there is no one who can speak for me.  If I ever make a post that gives the opinions or positions of other users or groups, then they will be clearly labeled as such.
I'm disappointed that people's past actions have forced me to state what should be obvious.
I am not a dev.  Nothing I say counts for anything.

SlackerLinux

  • Spam Killer
  • *
  • Posts: 555
  • Turrets: +41/-62
Re: Amanieu's server-side demo mod
« Reply #2 on: October 04, 2008, 01:57:28 am »
Nice.
Whats the status on client playback?
Where are the files stored, what format, and how big are they?  (And does it record when the server is empty?)
client playback is nonexistant
and itll record anything thats happening when you issue the command so if the servers empty and you tell it to record it will. there not too big ive got a few min demos and there only 300-500 kb not much at all their stored in ~/.tremulous/base/svdemos
Slackware64 13.1
SlackersQVM/

Sap

  • Posts: 42
  • Turrets: +2/-8
Re: Amanieu's server-side demo mod
« Reply #3 on: October 04, 2008, 03:54:06 am »
I think this is a great addition and will be especially helpful in analyzing scrims , just like they do in a real world professional game  .
"The views & opinions expressed above are solely of a Dretch and not endorsed by a Dragoon or a Rant. However, ocassional Mara zaps might have had some influence in it. "

David

  • Spam Killer
  • *
  • Posts: 3543
  • Turrets: +249/-273
Re: Amanieu's server-side demo mod
« Reply #4 on: October 04, 2008, 11:05:31 am »
I was meaning does sv_autodemo record empty games?
And 300-500 for a few mins?  Thats still ~72MB per server per day.  Not masses but it'll add up fast.
Any maps not in the MG repo?  Email me or come to irc.freenode.net/#mg.
--
My words are mine and mine alone.  I can't speak for anyone else, and there is no one who can speak for me.  If I ever make a post that gives the opinions or positions of other users or groups, then they will be clearly labeled as such.
I'm disappointed that people's past actions have forced me to state what should be obvious.
I am not a dev.  Nothing I say counts for anything.

Amanieu

  • Posts: 647
  • Turrets: +135/-83
    • Amanieu
Re: Amanieu's server-side demo mod
« Reply #5 on: October 04, 2008, 12:50:40 pm »
sv_autodemo will record empty games, but the demos will take almost no space at all.

It is possible to have client-side playback, all you need is a client and game.qvm that supports it. The tremfusion client supports it, and tremfusion-base.pk3 comes with the patched version of Lakitu7's qvm.
Quote
< kevlarman> zakk is getting his patches from shady frenchmen on irc
< kevlarman> this can't be a good sign :P

remember

  • Posts: 10
  • Turrets: +1/-0
Re: Amanieu's server-side demo mod
« Reply #6 on: October 08, 2008, 06:53:53 pm »
Hi,

When i want to play a demo with this qvm i need to set sv_democlients >= to the value of sv_maxclients.
So, is it possible to modify this (nice) patch in order to do it automaticly?

After playing a demo the value of sv_maxclients changed.
For example, before playing a demo sv_maxclients=15 and sv_democlients=15 and there is only one player recorded in the demo, then, when the demo is finished sv_maxclients=16.
So, is it possible to restore the first value of sv_maxclients ... automaticly ?

I am a bad programmer but i am very curious.
In the file 'sv_demo.c' in the source of Tremfusion, the line after ' Cbuf_AddText(va("devmap %s\ndelay 20000 %s\n", s, Cmd_Cmd())); ' (SV_DemoStartPlayback) is ' SV_DemoStopPlayback(); ' => Why?
And the line before ' #ifdef DEDICATED ' (SV_DemoStopPlayback) is ' if (sv.demoState != DS_PLAYBACK) ' , but 2 lines before ' Cvar_SetValue("sv_demoState", DS_NONE); ' => So sv_demoState is always != DS_PLAYBACK , no?

Please, don't flame me with my bad english and my lack of programmation but anyway your patch is very nice and very useful i think, so THANK YOU Amanieu.


Amanieu

  • Posts: 647
  • Turrets: +135/-83
    • Amanieu
Re: Amanieu's server-side demo mod
« Reply #7 on: October 09, 2008, 12:12:45 am »
When i want to play a demo with this qvm i need to set sv_democlients >= to the value of sv_maxclients.
So, is it possible to modify this (nice) patch in order to do it automaticly?

After playing a demo the value of sv_maxclients changed.
For example, before playing a demo sv_maxclients=15 and sv_democlients=15 and there is only one player recorded in the demo, then, when the demo is finished sv_maxclients=16.
So, is it possible to restore the first value of sv_maxclients ... automaticly ?
Yes, I'll do that. But the patch in the patch tracker is a little old, it's hard for me to keep it up-to-date all the time. The most recent version will always be in tremfusion.

I am a bad programmer but i am very curious.
In the file 'sv_demo.c' in the source of Tremfusion, the line after ' Cbuf_AddText(va("devmap %s\ndelay 20000 %s\n", s, Cmd_Cmd())); ' (SV_DemoStartPlayback) is ' SV_DemoStopPlayback(); ' => Why?
And the line before ' #ifdef DEDICATED ' (SV_DemoStopPlayback) is ' if (sv.demoState != DS_PLAYBACK) ' , but 2 lines before ' Cvar_SetValue("sv_demoState", DS_NONE); ' => So sv_demoState is always != DS_PLAYBACK , no?
So the map doesn't restart if it failed to start the demo.
Quote
< kevlarman> zakk is getting his patches from shady frenchmen on irc
< kevlarman> this can't be a good sign :P

rotacak

  • Posts: 761
  • Turrets: +39/-64
Re: Amanieu's server-side demo mod
« Reply #8 on: October 09, 2008, 07:12:58 pm »
This is very good thing, server demo. But I think there is one problem and that is harddisk size :-) If all games will be recorded.

Is possible to add feature like this?: sv_max_demo_files = 50 And that will allow only last 50 demos recorded. Older will be automaticaly deleted.

Also good thing would be some administration for this. For example when is someone banned, then admin is noticed and that demo have to be deleted by admin, not automatically.

What do you think?

David

  • Spam Killer
  • *
  • Posts: 3543
  • Turrets: +249/-273
Re: Amanieu's server-side demo mod
« Reply #9 on: October 09, 2008, 07:19:30 pm »
Use log-rotate, or a simple shell script.
No need to add bloat when there are tools to do it already.
Any maps not in the MG repo?  Email me or come to irc.freenode.net/#mg.
--
My words are mine and mine alone.  I can't speak for anyone else, and there is no one who can speak for me.  If I ever make a post that gives the opinions or positions of other users or groups, then they will be clearly labeled as such.
I'm disappointed that people's past actions have forced me to state what should be obvious.
I am not a dev.  Nothing I say counts for anything.

Amanieu

  • Posts: 647
  • Turrets: +135/-83
    • Amanieu
Re: Amanieu's server-side demo mod
« Reply #10 on: October 09, 2008, 11:46:37 pm »
I fixed some bugs and added support for recording stage changes. Here is the updated qvm with the patch:
Lakitu7's qvm with server-side demos
Patch

I also added automatic maxclients and democlients changing to tremfusion, it will be in the next release.
Quote
< kevlarman> zakk is getting his patches from shady frenchmen on irc
< kevlarman> this can't be a good sign :P