Exporting Video from GameCore

GameCore supports exporting video to the MPEG format directly from the application, either exported games or when testing your game from the editor. There are a number of script commands that you can use to configure, start and stop the video export. These script commands can be activated from Button presses, or automatically from your game or controllers scripts as desired. This could be used to allow your users to export replay's of in-game segments, or you could use it to create complex machinima sequences. How it is used is very open-ended and flexible (and easy to setup!)

Configuring the video export can be done in one of two ways:

  1. From the config.cfg file for your game
  2. By calling the SetMovieResolution() function in a script.

Config.cfg Movie export configuration

There are 3 variables that you can add to your game's config.cfg file to customize the output of video:

VideoWidth - pixel width of the video to be exported

VideoHeight - pixel height of the video to be exported

VideoQuality - percentage quality of the video to be exported (0-100)

So as an example:

VideoWidth 320
VideoHeight 240
VideoQuality 100 

Would export 320x240 video at 100% quality.

Configuring Video Output from Script

SetMovieResolution() takes the same parameters as the config.cfg variables, configuring the width, height and quality settings for the video to be output. SetMovieResolution() is a function of the GameManager() class, so must be called from a handle to the GameManager(), like so:

GetGameManager().SetMovieResolution(640, 400, 100);

This would configure the video to be 640x400 at 100% quality.

Starting Movie Encoding

To begin recording of video in your game, simply call 'StartRecordMovie()' and everything that happens in your game will be output to video, until you tell the game to stop recording, or exit the application.

GetGameManager().<a href="http://www.gamecore3d.com/docs/scripting-reference/classes/GameManager/StartRecordMovie">StartRecordMovie</a>();

Stopping Movie Encoding

To stop recording video, you simply need to call 'StopRecordMovie()'. That's it!

GetGameManager().<a href="http://www.gamecore3d.com/docs/scripting-reference/classes/GameManager/StopRecordMovie">StopRecordMovie</a>();

Adjusting for Aspect Ratio differences

Please note that the video export does NOT automatically adjust the video output based on the aspect ratio that you are running your game at. So for example, if you are running the game at 1680x1050 (a 16:10 aspect ratio), but tell the engine to output video at 320x240 (a 4:3 aspect ratio), you will notice that the final output will appear 'squashed' - which it is.

What you need to do in this case is either detect which resolution the user is running the application at and adjust the MovieResolution accordingly.

Here is an very simple example function that checks a few common widescreen aspect ratios and returns true if the game is being run in widescreen or not:

bool AspectRatio() { 
int screenWidth = GetScreenPixelWidth(); 
int screenHeight = GetScreenPixelHeight(); 
if( screenWidth == 1680 &amp;&amp; screenHeight == 1050) 
    return true; 
else if( screenWidth == 1600 &amp;&amp; screenHeight == 900) 
    return true; 
else if( screenWidth == 1440 &amp;&amp; screenHeight == 900) 
    return true; 
else if( screenWidth == 1280 &amp;&amp; screenHeight == 960) 
    return true; 
else      return false; 
}