Demo Recording Tools/zh-tw

From Valve Developer Community
Jump to: navigation, search
Info content.png
This page needs to be translated.

本页面或包含不完全的翻译、不正确的翻译,或未有翻译。
如果本页面出于某些原因无法被翻译,或长时间地处于未翻译的状态,则应予删除。

另外,请确保文章在尽量遵守 多语言指导。

簡介

Source引擎提供了一串用來紀錄遊戲過程成Demo的工具,重現遊戲流程和編輯demo檔案。這些功能可以從控制列或GUI工具像是「Demo播放介面」、「Demo編輯介面」與「Demo平滑介面」來提供。

基本紀錄與播放

想要紀錄一個遊戲流程,在控制列輸入record "名稱"(名稱不能有特殊的字元或空格)。demo檔案 (.dem擴充)將被儲存在您目前執行的遊戲資料夾裡,如:\hl2\name.dem。您能在執行遊戲的期間開始記錄,並且使用停止指令來停止記錄。如果在紀錄期間換關卡,目前在紀錄的DEMO檔案會關閉,並一個新的DEMO檔案 名稱_2 (名稱_3、名稱_4等等)將被建立。想要重現之前紀錄的遊戲流程,輸入playdemo "名稱"。如果想要重現以系統基準為主的demo,使用timedemo "名稱"。 Timedemo將儘可能的快速播放demo並在呈現播放完成後顯示執行狀態(總共幾個遊戲框架、秒數、每秒平均幾個框架FPS與變異數).

Demo播放介面(Demo Player)

Demoplayback.jpg

在播放DEMO檔時,可以按Shift-F2或在控制列輸入demoui指令呼叫Demo播放介面。Demo播放視窗允許暫停、重新開始、調整播放速度或攝影機的觀點。

載入新的DEMO檔案可以藉由按下"Load..."按鈕,並從硬碟裡選擇一個.dem檔案。目前與總共播放時間會顯示在"Load..."下面。使用右邊的拖動條,您能夠調整播放的速度(速度調動範圍介於慢動作0%與快動作600%之間)。位於進度棒下面的按鈕為"播放"、"暫停"、"重新開始"、前進">"、回到開頭"|<"、來到結尾">|"(有些功能不能作用,像是後退"<"、快速後退"<<")。

內部紀錄DEMO檔案使用時間戳記來標記一個在播放中的遊戲框架。像是目前的框架數與總框架數(在"Goto:"按鈕得左邊)。您能跳到一個指定的框架數(輸入目標框架數到輸入欄裡,並按"Goto:"鈕)。

想要改變攝影機的觀點,按"Drive..."切換到"觀點控制模式"(Camera drive mode)。當進入"觀點控制模式",按鈕會保持在被壓下的狀態。移動滑鼠到場景上,並按下滑鼠左鍵並移動滑鼠來控制觀點方向,W、A、S、D鍵控制觀點位置。您能藉由Z和X鍵來控制觀點的上下,並按下SHIFT鍵將移動速度變慢。當暫停時,製作螢幕快照很方便(使用r_drawviewmodel 0cl_drawhud 0清除畫面)。再按一次"Drive..."將切回正常DEMO播放狀態。

Demo編輯介面(Demo Editor)

Demoeditor.jpg

在播放介面中按下"Edit..."打開Demo編輯介面。編輯介面提供在播放DEMO時新增或執行一套的指令。這些 DEMO指令能夠在畫面上顯示文字、淡出入、視角或執行其它的控制列指令。DEMO編輯介面無法改變攝影機觀點,需改為DEMO進階介面來做。DEMO指令不會被儲存在DEMO檔裡面,但會附在一個額外的文字檔上(名稱為 DEMO名稱.vdm)。這些.VDM文字檔會跟著.DEM(同名)一起被載入或被執行。

按下"New->"按鈕並選擇一個想使用的DEMO指令,如PlayCommands來執行一個控制列指令。每個DEMO指令擁有一個使用者給予的名稱和第幾個框架來執行。如果您新增一個PlayCommands,選擇一個新的名稱("My command"),設定"Start on"為"TimeUseTick",輸入一個合法的框架數並輸入控制列指令,如"echo This is my command"。並按下"OK"後會新增一個新的DEMO指令到指令清單裡。現有的指令能夠被更改("Edit...")或是被移除("Delete")。一旦完成了指令清單後,您能儲存他為demoname.vdm("Save")。

底下列出能夠使用的DEMO指令:

SkipAhead DEMO播放跳到指定的框架數並重新播放。
StopPlayback 停止播放。
PlayCommands 執行一個控制列指令。
ScreenFadeStart 畫面淡出入。
TextMessageStart 顯示一個簡單的文字訊息。
PlayCDTrackStart 播放某CD track。
PlaySoundStart 播放某.WAV或.MP3.
Pause 在指定的幾秒內暫停播放。
ChangePlaybackRate 更改播放速度。
ZoomFov 調整畫面的視角遠近。

Demo平滑介面(Demo Smoother)

Demo smoother.jpg

Note.png注意:最新版的DEMO平滑介面,已修正幾項BUG(參見下面)且取消掉了Lock cameraDrive FastDrive Slow的功能,故本翻譯將不包括跟這些有關的部份。
Note.png注意:在這篇文章裡「觀點」與「攝影機」有不同的意義,為了之後避免混淆,在此先說明一下。觀點就是螢幕畫面(在遊戲中任何時候所看到的)。而「攝影機」是指DEMO檔案所錄下的觀點。當進入DEMO平滑介面時,所編輯的攝影機路徑是DEMO中錄下的觀點。觀點可以是自由隨意的移動(透過觀點控制模式),也可是DEMO檔案中的攝影機(非觀點控制模式)。

Demo平滑介面是最複雜的DEMO工具,它允許修正原本在DEMO檔案裡面現有攝影機路徑與角度。進階介面能夠將紀錄下來的攝影機路徑更加平滑的移動或者建立一個全新的攝影機路徑。按下Demo播放介面中的"Smooth..."按鈕來開啟Demo平滑介面。

第一件事情需要做的是先暫停播放,然後按下"Reload"載入目前現有存在于DEMO檔案中的攝影機路徑資訊。將"Show All"核取方塊打勾即可看到在DEMO檔案中完整的的攝影機路徑(白線)。在Demo平滑介面的任何時候,您仍然可以進入「觀點控制模式」(DEMO播放介面中的"Drive..."按鈕)並且隨意的在地圖上移動攝影機。如果您不在「觀點控制模式」,您能夠選取"Back off"核取方塊,將觀點稍微往後(跟在攝影機後面),這樣某些攝影機的路徑就不會被遮住。

接著您必須選擇一段路徑。您可以在"Start Tick"與"End Tick"欄中填寫路徑範圍(以框架數為單位),並且按下"Select"。這個路徑範圍將是能夠被作用的範圍,而且被選上的範圍將以黃色的線來表示。按下"Show Original"按鈕後,攝影機會跟隨著被選起的原始路徑移動。注意剛剛我們把"backed off"給選起來,那是在預覽狀態,而現在可以將勾勾給取消掉。將"lock camera"打勾,並且按下DEMO播放介面中的"Drive..."按鈕,接著控制攝影機視點與位置的方式,將攝影機往後移動。

Demo smoother2.jpg

現在在看到的畫面中,標記(藍色的方塊跟紅色的方向線)代表現在的觀看位置。路徑上被選擇的路經範圍中開始與結尾白色的線為超出所選擇的範圍。按下"Process->"將會顯示目前所提供的流程型態選單。

攝影機角度 - 平滑(Smooth selection angles)

點選這項流程型態後,會取大約10個框架時間的攝影機角度,平均後將角度重新指定給這10個框架時間(10個攝影機角度都一樣),因此會將那些極端雜亂的攝影機角度會調整為平均值(將較平滑)。平滑後的路徑顯示為紫線,黃線(原始路徑)旁邊。藉由點選"Show processed"按鈕,您能夠預覽此調整後的攝影機移動(如果您想從攝影機的角度來觀看,請確保取消了"Back off",否則您將只會看到藍色的方塊跟紅色的方向線在路徑上移動)。

請注意在DEMO播放介面中的速度拖動條會影響到"Show Original"、"Show Processed"(與"觀點控制模式")。現在,攝影機角度路徑已經平滑,想要重做可以點選"Undo"按鈕。

攝影機位置 - 平滑(Smooth selection origin)

此流程型態跟上面很像,只是這次要平滑的是攝影機本身的位置。選擇這個會將某些較極端的攝影機位置給平滑化。平滑後的攝影機位置路徑將會是淡黃色的線,逸離了灰色原始路徑。這是新的攝影機移動路徑。當然,您能夠同時平滑攝影機角度與位置。

攝影機角度 - 直線(Linear Interp Angles)

選擇這項流程型態將會在選擇範圍間取第一個與最後一個的攝影機的角度,並且利用這個兩個值作選擇範圍中每個框架的線性內差值。

攝影機位置 - 直線(Linear Interp Origin)

跟上面一樣,這次則是從選起開始到結束將攝影機位置路徑改成直線。如果只有將位置路徑設為直線,則您會看到原始的攝影機角度會被保留。您能夠再選擇攝影機角度 - 線性內插(Linear Interp Angles),將角度路徑也改成直線。

Spline Angles and Spline Origin

Demo smoother3.jpg

The spline functionality, in general, requires you to mark certain samples as "Key Frames" for creating the spline. By default, the first and last samples are automatically included as "anchor" key frames, but you'll want to add at least one if not multiple additional key frames.

The best way to do this is to think of the original samples as a time reference and use the << and >> buttons to move the blue cursor to the sample at the time you want to mark as a key frame. Once you've done that, you need to unlock the camera if it's locked and then press "Set View" to put your eyes into the current sample point.

You can now move that sample point by clicking "Drive Camera" and moving with the keyboard and mouse, etc. Once you have the sample positioned and oriented (just using the camera) as you like, press the "Make Key" button. If you now back the camera up a bit more you'll see a green box which shows the current point as a key. Smoothing out the Edges

The final component of the smoother is useful for dealing with the edges left after post processing a .dem file selection. For instance, chose the last 5 frames to smooth out the right edge at the end of a sample ( type 5 in the Edge Frames box and selected Smooth Right from the Edge-> menu). As you can see in the inset, the processed/purple line is more smoothly integrated with the first non-selected white direction line. You need to use at least 3 edge frames and then select which edges(s) to smooth from the Edge-> menu.


Demo Console Commands

demo_debug <0/1> Shows additional demo debug info
demo_fastforwardstartspeed <factor> Go this fast when starting to hold FF button.
demo_fastforwardramptime <seconds> How many seconds it takes to get to full FF speed.
demo_fastforwardfinalspeed <factor> Final playback speed when holding the FF button.
demo_interpolateview <0/1> Enables/disabled view interpolation between demo ticks
demo_quitafterplayback <0/1> Quits game after demo playback
demo_recordcommands <0/1> Record commands typed at console into .dem files
demo_pause [seconds] Pauses demo playback, seconds optional
demo_resume Resumes demo playback
demo_togglepause Toggles demo pause/playback
demo_gototick <tick> [relative] [pause] Skips to a tick in demo. If the relative parameter is 1 the tick is an offset to the current tick. If the pause parameter is 1, playback while be paused when tick is reached
demo_timescale <scale> Set the demo playback speed as a factor, 1.0 is normal playback

Video Tutorial

Demo Smoother Video Tutorial

Requires Xvid codec

by Fragalishus

Notes

  • You cannot see yourself in POV demos. YOU are the camera.
  • When in drive mode, use right mouse to change demo speed.
  • If your srctv demo gets stuck on free look, try using cl_predict 0 to unlock it.


Other useful command variables
sv_cheats <0/1> Required for following commands.
r_drawviewmodel <0/1> Hides weapon model.
cl_drawhud <0/1> Hides entire hud.
hud_saytext_time 0 Hides chat text, default = 12.
hideradar Hides radar location text.
cl_radaralpha 0 Hides new radar overviews (def. = 200).
drawradar Enables radar.
thirdperson Enables third person view (firstperson to change back).
cam_command <0/1> Enables camera commands.
cam_idealyaw <value> Rotates the camera around model horizontally (0-360)
cam_idealpitch <value> Rotates camera around model vertically (0-360)
cam_idealdist <value> Sets the distance from player to camera (default = 64)
Use the "find" command to find other camera

options (+camyawleft, etc) Usage: find cam

Bugs

This bug list was compiled by Lunchtimemama on January 24, 2005 and is potentially out of date. Bugs listed here may be fixed and other bugs may exist.

Unfinished Features:

  • The step-back and rewind buttons are disabled.
  • The fast-forward, go-to-beginning, and go-to-end buttons do not work.
  • Half of the "Edit" effects are disabled.

Major Bugs

  • 1. The "Edit" effect configuration windows are immobile and have broken minimize and close buttons.
  • 2. With "lock camera" engaged in the Smoother window and "Drive" engaged in the Playback window, the "Make Key" command will incorrectly use the "driven" camera's position instead of the "locked" camera's.
  • 3. With "lock camera" and "Drive" engaged, the "Show Original" and "Show Processed" commands will not animate the "locked" camera (though the "step-forward" and "step-back" commands (in the Smoother) will).
  • 4. With "lock camera" disengaged and "Drive" engaged, the blue-box camera indicator does not update position when the camera is "driven" around.
  • 5. Some demos suffer jumpiness similar to network lag, even those exported from the Smoother.
  • 6. "Jump to" in the Smoother does not seem to work properly.
  • 7. Some demos will not allow you to make a selection, so smoothing is not possible.
  • 8. Smoother does not work on srctv demos, cannot make a selection. - Fixed in srctv updates, smoother should work now. (#7 still applies, however. Random bug, can't make a selection)
  • 9. When you die, the camera locks to your corpse in "view attacker" mode.

Minor Bugs

  • The "New ->" list in the "Edit" window always opens upward, usually extending off-screen.
  • "Goto" is very slow when going to a tick in the past.
  • If the blue-box camera indicator suffers movement lag during playback, it does not "catch up" when the demo is paused.
  • When "Drive" is engaged, clicking and dragging in VGUI windows will move the camera (making it difficult to highlight text in a textfield).

See also

Wish List

  • 1. dem_forcesrctv <0/1>
  • Requested functionality that dem_forcehltv 0/1 had.
  • Remove recoil. (true free look) Priority 1!
  • Ability to spectate 1st and 3rd person all other players. (wallhack block notwithstanding of course)
  • Remove muzzle flash and brass ejection. (not a huge deal, we can use sprites, but would be nice)
  • 2. Proper thirdperson mode.
  • Re-orient muzzle flash sprite to world model instead of first person view model.
  • 3. CVAR to override deathcam view.
  • When a player dies, any recammed smoother paths will snap back to the player when the ragdoll spawns and lock on viewing the attacker. A cvar to override that, without overriding the smoother path, would be handy.
  • 4. Timestamps on srctv demos.
  • Same as hltv had. Would be nice on POV demos, too, allowing for start/stop script recording.
  • 5. CVAR to disable flash bang effect on text/death notices.
  • Considering +/-90% of all demos are recorded for frag movie purposes, there needs to be a cvar so death notices are not affected by flash bangs. Even if it's a cheat cvar, available only during demo playback or something.
  • 6. OpenDML compliant avi files
  • Currently, Source's avi utility does not create open-dml 2.0 compliant files, meaning files over 2 gb are corrupt, and has a 4 gb cap.