Python Intro Movie problems

vincentz

Programmer
Joined
Feb 4, 2009
Messages
3,614
Location
Denmark
I get this after the movie have played the first time :

attachment.php


After the movie have played it will go into black screen and await me clicking with the mouse on the screen.

It only happens two times. after that it seem to ignore the python error.

I followed this guide :
http://forums.civfanatics.com/showthread.php?t=191978

except instead of having a customeventmanager I use the BtS' eventmanager as it is the only change I made in that file. Is it important to have your own special customeventmanager? And what would be the name/content of that?

Any clues?


This is the video (in wmv format. I binked it for the game), but I doubt there is something wrong there : Introvideo
 
Seems that something else got messed up, probably something with a hardcoded order somewhere in the .dll :think: :dunno:.

But sure isn't a problem with the CvEventManager itself, i added an intro to my mod also in the normal manager.

Did you make any .dll changes before the error appeared?
 
You are assuming that i know what i did and that i commented it :lol: ;).
And i also used this tutorial, so we both must have done something similar.
Looking at my files...hmm...:dunno: it seems, i did it exactly like in the tutorial, just added the code in the normal manager :dunno:.
 
I'll try to isolate the changes into a testmod and see if there is a conflict with some of my other python files.

Btw. I seem to have problems getting a nice 1:1 conversion on the moviefile when I bink it. To get a decent quality I need to go at least 200% (which is still not perfect) and if I just put the same datarate as my original wmv file (440 Kb/s) the size will explode from 2.4 to 24 MB.

Any good hints?
 
It still comes up with a python error.

I'll post the files and the testmod in hope that I did something wrong and it can easely be spotted :

CIV4ArtDefines_Movie.xml (cut)
Spoiler :
Code:
<?xml version="1.0"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Firaxis Games (Firaxis Games) -->
<!-- Sid Meier's Civilization 4 -->
<!-- Copyright Firaxis Games 2005 -->
<!-- -->
<!-- Movie art path information -->
<Civ4ArtDefines xmlns="x-schema:CIV4ArtDefinesSchema.xml">
	<MovieArtInfos>
		<MovieArtInfo>
			<Type>ART_DEF_MOVIE_INTRO</Type>
			<Path>Art/Movies/Intros/intro.bik</Path>
		</MovieArtInfo>
		<MovieArtInfo>
			<Type>ART_DEF_MOVIE_2K_INTRO</Type>
			<Path>Art/Movies/Intros/intro.bik</Path>
		</MovieArtInfo>
		<MovieArtInfo>
			<Type>ART_DEF_MOVIE_NVIDIA_INTRO</Type>
			<Path>Art/Movies/Intros/TheWay_720x486.bik</Path>
		</MovieArtInfo>
		<MovieArtInfo>
			<Type>ART_DEF_MOVIE_PLACEHOLDER</Type>
			<Path>Art/Movies/Placeholder.bik</Path>
		</MovieArtInfo>
......


CvIntroMovieScreen.py (all)
Spoiler :
Code:
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
from CvPythonExtensions import *
import CvUtil
import ScreenInput
import CvScreenEnums

# globals
gc = CyGlobalContext()
ArtFileMgr = CyArtFileMgr()
localText = CyTranslator()

class CvIntroMovieScreen:
	"Intro Movie Screen"
	bMovieState = 0
	def interfaceScreen (self):
		
		self.currentMovie = "ART_DEF_MOVIE_2K_INTRO"
		self.X_SCREEN = 0
		self.Y_SCREEN = 0
		self.W_SCREEN = 1024
		self.H_SCREEN = 768
		self.Y_TITLE = 12
		self.BORDER_HEIGHT = 100
		
		self.X_EXIT = 410
		self.Y_EXIT = 326
		
		game = CyGame()
		if ( game.isNetworkMultiPlayer() or game.isPitbossHost()):
			return
		
		self.createMovieScreen(self.currentMovie)
	
	def createMovieScreen(self, movieArtDef):
	
		if CyUserProfile().getGraphicOption(GraphicOptionTypes.GRAPHICOPTION_NO_MOVIES):
			return
		
		# Create a new screen, called IntroMovieScreen, using the file CvIntroMovieScreen.py for input
		screen = CyGInterfaceScreen( "IntroMovieScreen", CvScreenEnums.INTRO_MOVIE_SCREEN )
		screen.setDimensions(screen.centerX(0), screen.centerY(0), -1, -1)
		screen.setRenderInterfaceOnly(True)
		screen.showWindowBackground( False )
		screen.setShowFor( 0 )
		
		# Show the screen
		screen.showScreen(PopupStates.POPUPSTATE_IMMEDIATE, False)		
		
		screen.setButtonGFC("Exit", u"Your movies are not installed correctly.", "", #self.EXIT_TEXT,
			self.X_EXIT, self.Y_EXIT, 400, 100, WidgetTypes.WIDGET_CLOSE_SCREEN, -1, -1, ButtonStyles.BUTTON_STYLE_STANDARD)
		
		# Play the movie
		movieFilePath = CyArtFileMgr().getMovieArtInfo(movieArtDef).getPath()
		screen.playMovie( movieFilePath, -1, -1, -1, -1, 0)
		
	def createLogoScreen(self):
                return
		
		# Show the screen
		screen.showScreen(PopupStates.POPUPSTATE_IMMEDIATE, False)
		
		# Background First
		screen.setImageButton( "LogoBackground", ArtFileMgr.getInterfaceArtInfo("MAINMENU_LOAD").getPath(), screen.centerX(0)-2, screen.centerY(0)-2, 1028, 776, WidgetTypes.WIDGET_GENERAL, -1, -1 )
		
		# Logos
		screen.setImageButton( "Logos", ArtFileMgr.getInterfaceArtInfo("INTRO_LOGOS").getPath(), screen.centerX(0)+233, screen.centerY(0)+331, 549, 294, WidgetTypes.WIDGET_GENERAL, -1, -1 )
		
		screen.addMultilineText("LegalText1", "<font=1>" + localText.getText("TXT_LEGAL_LINE_1", ()) + "</font>", screen.centerX(0)+110, screen.centerY(0)+590, 804, 200, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
		screen.setLabel( "LegalText2", "Background", "<font=2>" + localText.getText("TXT_LEGAL_LINE_2", ()) + "</font>", CvUtil.FONT_CENTER_JUSTIFY, screen.centerX(0)+512, screen.centerY(0)+740, -0.1, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
		screen.setShowFor( 4000 )

	def closeScreen(self):
		screen = CyGInterfaceScreen( "IntroMovieScreen", CvScreenEnums.INTRO_MOVIE_SCREEN )
		screen.hideScreen()
		
	def hideScreen(self):
		screen = CyGInterfaceScreen( "IntroMovieScreen", CvScreenEnums.INTRO_MOVIE_SCREEN )
		screen.hideScreen()
	
	# Will handle the input for this screen...
	def handleInput (self, inputClass):
		screen = CyGInterfaceScreen( "IntroMovieScreen", CvScreenEnums.INTRO_MOVIE_SCREEN )
		if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_MOVIE_DONE or inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED or inputClass.getNotifyCode() == NotifyCode.NOTIFY_CHARACTER):
			if (inputClass.getNotifyCode() != NotifyCode.NOTIFY_MOVIE_DONE):
				setNoIntroMovie(true)
			if self.bMovieState == 3:
				return self.hideScreen()
			elif self.bMovieState == 2:
				self.bMovieState = 3
				self.currentMovie = "ART_DEF_MOVIE_INTRO"
				self.closeScreen()
				self.createMovieScreen( "ART_DEF_MOVIE_INTRO" )
			elif self.bMovieState == 1:
				self.bMovieState = 2
				self.closeScreen()
				self.createLogoScreen()
			else:
				self.bMovieState = 1
				self.currentMovie = "ART_DEF_MOVIE_NVIDIA_INTRO"
				self.closeScreen()
				self.createMovieScreen( "ART_DEF_MOVIE_NVIDIA_INTRO" )
		return 0

	def update(self, fDelta):
		return

CvEventManager.py (cut)

Spoiler :
Code:
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2006
## 
## CvEventManager
## This class is passed an argsList from CvAppInterface.onEvent
## The argsList can contain anything from mouse location to key info
## The EVENTLIST that are being notified can be found 


from CvPythonExtensions import *
import CvIntroMovieScreen
import CvUtil
import CvScreensInterface
import CvDebugTools
import CvWBPopups
import PyHelpers
import Popup as PyPopup
import CvCameraControls
import CvTopCivs
import sys
import CvWorldBuilderScreen
import CvAdvisorUtils
import CvTechChooser

gc = CyGlobalContext()
localText = CyTranslator()
PyPlayer = PyHelpers.PyPlayer
PyInfo = PyHelpers.PyInfo

......... (cut untill triggered events)


#################### TRIGGERED EVENTS ##################	

	def onGameStart(self, argsList):
		# display mod's intro movie
		introMovie = CvIntroMovieScreen.CvIntroMovieScreen()
		introMovie.interfaceScreen()
        	
		# display DoM message
		for iPlayer in range(gc.getMAX_PLAYERS()):
			player = gc.getPlayer(iPlayer)
			if (player.isAlive() and player.isHuman()):
				popupInfo = CyPopupInfo()
				popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
				popupInfo.setText(u"showDawnOfMan")
				popupInfo.addPopup(iPlayer)
				
	def __eventEditCityNameBegin(self, city, bRename):
		popup = PyPopup.PyPopup(CvUtil.EventEditCityName, EventContextTypes.EVENTCONTEXT_ALL)
		popup.setUserData((city.getID(), bRename))
		popup.setHeaderString(localText.getText("TXT_KEY_NAME_CITY", ()))
		popup.setBodyString(localText.getText("TXT_KEY_SETTLE_NEW_CITY_NAME", ()))
		popup.createEditBox(city.getName())
		popup.setEditBoxMaxCharCount( 15 )
		popup.launch()

..........
 
I appreciate the design of your movie.
fallout3_thumbsup.jpg



To the problem:
In my CvIntroMovieScreen.py is, unlike in yours and the default one, this line here:
PHP:
		screen.setButtonGFC("Exit", u"Your movies are not installed correctly.", "", #self.EXIT_TEXT,
			self.X_EXIT, self.Y_EXIT, 400, 100, WidgetTypes.WIDGET_CLOSE_SCREEN, -1, -1, ButtonStyles.BUTTON_STYLE_STANDARD)

commented out.

I also commented 3 lines in handleInput out, because i think it also created some problems:
Spoiler :

PHP:
	def handleInput (self, inputClass):
		screen = CyGInterfaceScreen( "IntroMovieScreen", CvScreenEnums.INTRO_MOVIE_SCREEN )
		if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_MOVIE_DONE or inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED or inputClass.getNotifyCode() == NotifyCode.NOTIFY_CHARACTER):
			if (inputClass.getNotifyCode() != NotifyCode.NOTIFY_MOVIE_DONE):
				setNoIntroMovie(true)
			if self.bMovieState == 3:
				return self.hideScreen()
			elif self.bMovieState == 2:
				self.bMovieState = 3
				self.currentMovie = "ART_DEF_MOVIE_INTRO"
				self.closeScreen()
				self.createMovieScreen( "ART_DEF_MOVIE_INTRO" )
			elif self.bMovieState == 1:
				self.bMovieState = 2
				self.closeScreen()
				#self.createLogoScreen()
			else:
				self.bMovieState = 1
				#self.currentMovie = "ART_DEF_MOVIE_NVIDIA_INTRO"
				self.closeScreen()
				#self.createMovieScreen( "ART_DEF_MOVIE_NVIDIA_INTRO" )
		return 0
 
Thank God!

I just stole your CvIntroMovieScreen.py and now everything is fine.

Thank you :goodjob:

edit : Ok this might sound strange, but suddenly everything is running 100% more smoothly. The graphics used to stutter a bit every 1-2 secs or so on a large map with 15 AI and high graphic settings (i only have 128 MB graphics and 1.5 GB ram)
This stutter is now completely gone. Also the response and the ai seems faster somehow. Very mysterious. Needs to be double checked tomorrow.

dbl edit : it gets stranger. I can reveal a giant map (160x100) and fly around like it was a dual map. Must be a betterAI or unofficial patch which I dont use, that made those changes. Maybe I should look into integrate those if only 1 file could make such a big change. Strange.
 
Back
Top Bottom