StarCraft® II

[Tutorial] Ingame videos

Posts: 193
Hello mapmakers!

I'm making a tutorial where we can learn how to add a video to be watched ingame.
It is based in a post made in sc2mapster.com by the user progammer http://www.sc2mapster.com/forums/resources/trigger-libraries/13090-library-star-movie-play-a-video-inside-map/ but I've simplified it to make it work with a simple trigger and added to the tutorial the process of converting and normalizing the video.

What are we going to do?

We are going to make a texture with the video we have chosen, and apply it to a unit (more specifically the unit “SM - Mar Sara - Bar - Briefing - Center”). Then we’ll create, apply and lock a camera focused on that unit until the cinematic is complete.

How do we start?

The first thing we need is a “.ogv” video to import into the editor with the menu import (F9). In my example, I have downloaded the “Brood War” cinematic from youtube with Vdownloader and converted it with the same program to “.mpeg”.
http://i.imgur.com/X83myps.png

How do we convert the video to “.ogv”?

The program ffmpeg2theora is free and open source. It can be downloaded from
http://v2v.cc/~j/ffmpeg2theora/download.html

After downloading it, we’ll change its name to “converter.exe”, place it in the same folder of our video and open a Command prompt. In it we must go into the mentioned folder and run the script:
converter.exe --nosound “the name of the video.mpeg”
http://i.imgur.com/x93pa6Q.png

Now a video with the extension .ogv will be created in the same folder. Notice that the new file has no sound. That’s because we can’t add sound to a texture.
http://i.imgur.com/aLjgkeq.png

IMPORTANT: The filename must start with the prefix "video_" and must not have more than one word or this won’t work. I’ve renamed it in the example to “Video.ogv”.

What do we do with the sound?

The sound must be imported separately. We can use the program AoA Audio Extractor. It can be downloaded from
http://www.aoamedia.com/audioextractor.htm.

It is not complicated to use… We have to open it, click on “add files”, select the original video, and click on start. It will do the rest.
http://i.imgur.com/qk2eAyj.png

IMPORTANT: The filename must have only one word or this won’t work. I’ve called it in the example to “Audio.ogv”.

Now we have the video and the sound. Let’s go to the editor!

In it we will create a new map including the dependency of WOL, and its campaign data.
http://i.imgur.com/lJ7NZN4.png

How do we import the video and the audio?

We go to the import tab (F9) and “right click on the white space - > Import files (ctrl + I)”. We only have to select the .mp3 and the .ogv files.
http://i.imgur.com/EkOKM9y.png

We have to save the map now, or the imported items won’t be recognized.

What do we do with those files?

We need to create a texture and a sound with the data editor. For that we press F7 or open it with our mouse. We click on the tab with the sign “+” and open the tabs “textures” and “sounds”.
http://i.imgur.com/ebe6ztt.png

We will create a new texture right clicking near the list of all the existing textures, and name it Video.
http://i.imgur.com/AH0rN8Q.png

We`ll replace the field File, with the video file we’ve just imported to the map.
http://i.imgur.com/rLP1kLt.png

Now we have to make something similar with the sound. We will create a new sound and copy it from some random music file from the campaign.
http://i.imgur.com/gULl6Xv.png

We will replace the sound assets with our imported audio.
http://i.imgur.com/0I6OpQi.png

We’re done with the data. Let’s go to the terrain

We’ll place a point somewhere in the terrain and make a camera focused on it.
We will set the “distance” to “0,2693”; the “Far Clip” to “5”, the “target - Z” to “0.7698”, the objective X and Y to the exact position of the point, and the “pitch” to “0”.
http://i.imgur.com/noBillo.png

That’s all we need. Let’s go to the triggers.

The first thing we have to do is create a trigger with the event “map inicialization”.
We must set the game speed in normal, and block it. If we don’t, the video will play above the desired speed. For that we have to create an action “Set game speed – Normal” and another “Lock game speed – true”.

Then we need to start the cinematic mode, reveal the entire map, and destroy the user interface and the environment. We have to make the actions “Cinematic Mode – true”, “Reveal area – Entire map”, “Show/hide terrain cells – Entire map”, “Hide environment -All” “Silence environment –All players” and “Pause soundtrack – All players “)

First we have to calibrate the screen. We’ll add the sound later.

We’ll apply the camera, create the unit “SM - Mar Sara - Bar - Briefing – Center” in the point we placed and assign the texture with the video for it.
We have to add the actions “apply camera info – the camera we created”, “Create unit – (SM - Mar Sara - Bar - Briefing – Center) – the point we created –orientation of 130 degrees”, and “Play movie texture on unit actor – Last unit created – Video”.

• Our trigger should look like this:
http://i.imgur.com/W5LTc3q.png

Let’s test the map (F9) The video looks a little outcentered...
http://i.imgur.com/Sw3wec9.png

This is easy to solve! We have to go to the terrain editor, and try diferent “X objectives” for the camera we’ve created. In my case, I have to change the X from “16” to “15.907”.
http://i.imgur.com/FsDT3Ch.png

• The video already looks good. Let’s add the sound.

In the trigger we simply have to add an action that plays the sound imported. It is “play sound – Audio – all players”.

Here is the big problem of the video rendering inside Starcraft: the audio plays faster inside the game, so we have to reduce its speed to synchronize it with the video. In the few videos I’ve tested, I had to slowdown the audio speed in a 5,4017% to sync it. For that I’ve used the program Audacity. It can be found in:
http://audacity.sourceforge.net/

http://i.imgur.com/JyvxIKP.png

http://i.imgur.com/m4lcGHm.png

After changing the speed, we should export the file from audacity (file -> export) with the extension .mp3 (save as -> mp3) and import it replacing the previous file in the galaxy editor.

If you test it and it’s still desynchronized, you should remove the action that activates the cinematic mode in the triggers and take note of the moment when the audio finishes watching inside the game’s clock.
http://i.imgur.com/TS9Y67D.png

http://i.imgur.com/l6Gz2hw.png

For example, if the sound ends at 229 seconds, when it should end at 234, we can deduce that the game reduced the audio duration in approximately 2% (229/234).
So, we have to make the sound file last around 239 seconds (because 234/239 is approximately 2%). If we do it, the sound will play 2% faster, and will have around 234 seconds of duration.

If you have any doubt, feel free to ask it. I'll upload soon 2 maps. One has the introductory cinematic of starcraft and the other the one of starcraft: brood war.

EDIT:
Videos created:

SC http://www.mediafire.com/?lyeluanro32ake2
SCBW http://www.mediafire.com/?hdb2tyfuta8qpu3
Edited by Cacho on 1/22/2014 6:32 AM PST
Reply Quote
Developer
Posts: 222
Very cool, thanks for the explanation.
Reply Quote

Please report any Code of Conduct violations, including:

Threats of violence. We take these seriously and will alert the proper authorities.

Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

Harassing or discriminatory language. This will not be tolerated.

Forums Code of Conduct

Report Post # written by

Reason
Explain (256 characters max)
Submit Cancel

Reported!

[Close]