[UI] BackgroundVideo function not working anymore?

Hello everyone,

With the latest update we’ve been really busy working on our next releases at PI. Thus far most of our issues have been solved and we’re working hard on the rest.

However I can’t figure out what’s wrong with the UI and more importantly with the “BackgroundVideo” function (NewMainMenu). It doesn’t work anymore and results in a CTD (FATAL EXIT!). Strangely, the CTD occurs only after 6-7 seconds on the mainmenu. That means we can interact with the menu BEFORE the crash.

Here’s a portion of our code:

dofilepath("data:ui/newui/Examples/ExampleIncludes.lua")
dofilepath("data:ui/newui/Styles/HWRM_Style/HWRMDefines.lua")
dofilepath("data:ui/newui/Styles/HWRM_Style/ControlConstructors.lua")
dofilepath("data:ui/newui/Background/logo.lua")
dofilepath("data:ui/newui/Main/ExButtons.lua")
-- LUA CONFIG FOR THE MAIN MENU UISCREEN

NewMainMenu = {
size =  { 800, 600, }, 
	
stylesheet = "HW2StyleSheet",

RootElementSettings = {
	backgroundColor = {0,0,0,0}, -- black background for letterbox effect -- GBX:pdeupree - Changed alpha to 0 so setting in "Background.lua" shows up.
},
Layout = {
	pos_XY = {	x = 0, y = 0, xr = "scr",	yr = "scr"	},	
	size_WH = {	w = 1.0, h = 1.0, wr = "scr", hr = "scr" },							
},		

-- Flags
pixelUVCoords = 1, -- Enter pixel coords for texture coords

--Hotkeys = {
--	{ "FE_ExitToWindows()",INKE_KeyDown, 0, "Exit to operating system",    { ALTKEY, F4KEY } },
--},
;
{
	type = "Frame",
	name = "Root_Frame",
	
	Layout = {	
			pos_XY = LAYOUT_TOPLEFTSCREEN,		
			size_WH = LAYOUT_FILLSCREEN,
		},	

-- PI: Error background displayed behind the video background in case people didn't download the Cutscene patch.			
	BackgroundGraphic = {
		size = { 800, 600 },
		texture = "DATA:UI/NewUI/Background/error.tga",
		textureUV = { 0, 0, 2560, 1440},
	},
	
-- GBX:pdeupree - Uncomment the video here if you want to have a first main menu background video that is different than the rest.		
	BackgroundVideo = {
		size = { 800, 600 },
		filenameV = "data:animatics/animations/sga_gate.webm",
		loop = 1,
		fitScreen = 1,
		fixedAspectRatio = 1,
	},

},

The function “BackgroundVideo” used to work perfectly before the 2.0 update. Gearbox and @BitVenom announced that they’ve improved and optimized the User Interface so that it loads faster. Does that means we can’t add videos as backgrounds anymore ?

This is not a codec issue or anything with the file format (.WEBM) because even the Gearbox intro doesn’t work. The following comment by @pdeupree is still here in the new version of the"NewMainMenu.lua" file for the UI, so I believe we can still add background videos, right?

-- GBX:pdeupree - Uncomment the video here if you want to have a first main menu background video that is different than the rest.
--		BackgroundVideo = {
--			filenameV = "data:animatics/mainmenu.webm",
--			loop = 1,
--			fitScreen = 1,
--			fixedAspectRatio = 1,
--		},

Any idea regarding that ?
Thanks :wink:

2 Likes

@BitVenom and @pdeupree haven’t been seen for at least a month. Perhaps @thisquietreverie or @Burly could shed some light?

2 Likes

The video background support was something I put in to the game early in the development process, and at that point our plan was to use that to “animate” the menu backgrounds. However, Bitvenom added animation support to the UI code so we went away from using the background video support.

The code was still in there, but in all honesty we had not tested it once everything was changed to the animated menu backgrounds. I ran a quick debug session to see what is happening. It looks like there is a bad test in code that is causing repeated attempts to play the background video and this is fragmenting memory so it runs out, thus causing the crash. Even after fixing this, though, it appears something is wrong with the looping flag, so the background video only plays once.

As I mentioned this is, unfortunately, a feature we stopped using early in development. I’ll note the issue so we know about it.

4 Likes

Rah okay. Well at least that makes more sense now :confused:

I have a question however regarding that: [quote=“pdeupree, post:3, topic:1544045”]
Bitvenom added animation support to the UI code so we went away from using the background video support.
[/quote]

What do you mean by animations (not videos) for the menu ? Transitions and stuff like that ?

Does that mean we can still animate the background but with images etc. ?

2 Likes

@pdeupree Thanks for the response! I too would be curious about the UI animation support you mention.

1 Like

Silly question certainly, but it seems the background image is being loaded in another file since 2.0 : \ui\newui\main\background.lua instead of newmainmenu.lua

-- LUA CONFIG FOR THE FE BACKGROUND
Background = {
    size = {0, 0, 1200, 800},
    stylesheet = "HW2StyleSheet",
    
    RootElementSettings = {
        --backgroundColor = {0,0,0,255},
    },
    
    Layout = {
        sector = 1,
        size_WH = { w = 1, h = 1, wr = "scr", hr = "scr" },
    },
    
    -- Flags
    pixelUVCoords = 1, -- Enter pixel coords for texture coords
    preUI = 1,

    ;
    
    {
        type = "Frame",
        visible = 1,
        
        Layout = {
            sector = 1,
            --pos_XY = { x = 0.5, y = 0.5, xr = "par", yr = "par" },
            size_WH = { w = 1, h = 1, wr = "scr", hr = "scr" },
            pivot_XY = { 0.5, 0.5 },
            pos_XY = { x = .5, y = .5, xr = "scr", yr = "scr" },
            --size_WH = { w = 1, h = 1, wr = "scr", hr = "scr" },

            lockAspect=-2,
        },

        BackgroundGraphic = {
            type = "Graphic",
            --size = {2048, 1024},
            --textureUV = { 0, 0, 2048, 1024},
            uvRect = { 0, 1, 1, 0 },
            texture = "Data:UI\\NewUI\\Background\\main_bg.tga", -- multires texture
        
        },
        --BackgroundVideo = {
        --    filenameV = "data:animatics/mainmenu.webm",
        --    loop = 1,
        --    fitScreen = 1,
        --    fixedAspectRatio = 1,
        --},
    },
}

Did you try reactivating the BackgroundVideo portion at the end of this file instead of newmainmenu.lua ?

2 Likes

Sadly doesn’t work…

1 Like

In the same manner as @PayDay, it doesn’t work unfortunately :confused:

I understand that in version 2.0 this function BackgroundVideo was broken and the problem lies in the game engine ?
If so, this is sadness :sob: