Natural wonders development thread

dacubz145

Deity
Joined
Jun 21, 2010
Messages
3,730
Location
Windy City
Download

------Info------
At the begining of the game, 8 natural wonders are randomly spawn througout the map. They are assigned to a specific terrain, as well as other specifics. When you discover a wonder, you get a 5 turn golden age, as well as a movie plays. If you own the city, a free random specialist is given to that city.
----------------

--Wonders--
Uluru
Victoria Falls
Sugarloaf Mountain
Devil's Rock
Nukuoro
Klyuchevskaya Sopka
Landscape Arch
Pamukkale
------------

This mod uses both SDK and Python

---Credits---
J_mie6 - SDK and python work
Platyping - Python Work
HROCHland - Art
Dacubz145 - Art, organized mod
Voyhkah - Art
The_J - Helped get the mod going
Arian - Movies
 
yup you can display the movie and a message

would be interesting to see the results of this code!
 
Hey J, got this idea for a mod and wondering if its doable via python

Basically just natural wonders, similar to Civ 5. I already got two things of art for it, and I can make more.

So what I would do is add features, that are natural wonders. I would have it so that they would never appear on the map. Then via python on game start, it would find a plot that is not seen by any player, find a good spot (so for a natural wonder in the dessert, it would find a dessert plot) remove the current terrain, and add the wonder. Im pretty sure that is dable via python

You'll laugh, but I have nearly exactly that in my mod :lol:.
Doing the same for normal BtS is more or less just prevented by the lack of graphics. If we had more, I'd put something together.

The other thing im curious, is there anyway it can play a movie or atleast show a message when you discover it?? Also possible a cultural bonus if you have it in your city radius, or anothe bonus like that

Message yes, movie no idea (I trust j_mie, but have no idea how to do it myself), city bonus for settling is also possible.
 
I could supply the graphics, I'm making most of them myself, since Google Warehouse does not have a lot of natural wonders. There are a couple i will borrow, I can probably get it done in a couple days or so, maybe 5-10 wonders?? If I come up with the graphics think we can get this mod done?
 
lemme see I can't find out how to do the movie :p I know I have seen it somewhere (probably when we were searching for how to play sound files :p)

edit: wait I saw it while reading the python code for wonder movie popups :lol: I will go and fetch the code :p

edit edit:

Code:
	def playMovie(self):
			
		screen = CyGInterfaceScreen( "WonderMovieScreen" + str(self.iWonderId), CvScreenEnums.WONDER_MOVIE_SCREEN )
		screen.setRenderInterfaceOnly(True)
		screen.show("Background")

		# Play the movie
		if self.iMovieType == MOVIE_SCREEN_RELIGION:
			screen.addReligionMovieWidgetGFC( "ReligionMovie", self.szMovieFile, self.X_WINDOW + self.X_MOVIE, self.Y_WINDOW + self.Y_MOVIE, self.W_MOVIE, self.H_MOVIE, WidgetTypes.WIDGET_GENERAL, -1, -1)
			CyInterface().playGeneralSound(gc.getReligionInfo(self.iWonderId).getMovieSound())		
		else:
			screen.playMovie(self.szMovieFile, self.X_WINDOW + self.X_MOVIE, self.Y_WINDOW + self.Y_MOVIE, self.W_MOVIE, self.H_MOVIE, -2.3 )
			
		screen.setButtonGFC("WonderExit" + str(self.iWonderId), localText.getText("TXT_KEY_MAIN_MENU_OK", ()), "", self.X_EXIT, self.Y_EXIT, self.W_EXIT, self.H_EXIT, WidgetTypes.WIDGET_CLOSE_SCREEN, -1, -1, ButtonStyles.BUTTON_STYLE_STANDARD )

it's in there somewhere (see CvWonderMovieScreen.py), however it will most likely take a lot of digging (and the creation of a screen) it could be possible to hack into the CvWonderMovieScreen though :mischief:
 
see edit :p

I think either a new screen will have to be assembled or you hack into it (I would be prepared to wonder about the python interface files and find out exactly how to make it/break in)
 
see edit :p

I think either a new screen will have to be assembled or you hack into it (I would be prepared to wonder about the python interface files and find out exactly how to make it/break in)

Oh, great :ack: -> not a priority :mischief:.
 
well when I get time I am going to either

a) find a way into that file :mischief:
b) make a python class to recreate that screen

but at least you can still do the message solution in the mean time :p

edit: oooo hello

in the CyGInterfaceScreen class (api) there is a method:

playMovie (STRING szMovieName, FLOAT fX, FLOAT fY, FLOAT fWidth, FLOAT fHeight, FLOAT fZ)

what it does I don't know... you could try it... could be called on a simple popup box?


bold so you don't miss it :lol:
 
Hope it's not too complicated :).
Will sure try it :).

I have converted from Google Warhouse Uluru, and honustly it looks insanely good and its only 60KB so one of my favorites so far (credit would go to saikindi from Google warhouse)

Good start. Should be the most obvious choice. Will see if I can start in the next days.

Editr: And now I have to go off for some hours.
 
Here is what i completed so far:
Uluru from Australia
Sugarloaf Mountain from Brazil
Devil's Table, i beleive this is from Germany from some googling, but its not on wikipedia so maybe you know something about it J since your location does say germany:lol:

Those three plus the crater from the age of ice mod, plus there is a geyser out there i beleive by hrochland, should be enough to start, but I will make some more
 

Attachments

By the way, forgot to put in the files so the files are in the post you just responded to if you want to check them out

Basically I see most of them giving a gold/culture bonus, with a happiness bonus if you settle by it. And of course certain bonuses to specific ones (ie religion bonus to Mt. Olypmus)
 
Code:
def onPlotRevealed(self, argsList):
		'Plot Revealed'
		pPlot = argsList[0]
		iTeam = argsList[1]

		iPlayer = gc.getTeam(iTeam).getLeaderID()
		if pPlot.isPeak():
			capital = gc.getPlayer(iPlayer).getCapitalCity()
			if ((not gc.getGame().isNetworkMultiPlayer()) and (iPlayer == gc.getGame().getActivePlayer())):
				# If this is a wonder...
				popupInfo = CyPopupInfo()
				popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
				popupInfo.setData1(gc.getInfoTypeForString("BUILDING_ORACLE"))
				popupInfo.setData2(capital.getID())
				popupInfo.setData3(0)
				popupInfo.setText(u"showWonderMovie")
				popupInfo.addPopup(iPlayer)

Done, every time you reveal a plot with a mountain, it will display movie for oracle lol
But it is now only displaying for the team leader. If you want to display it for all members not hard as well. So when your natural wonders are out, then just do necessary adjustments to the codes

Platyping helped out with a code for movies :D

also J, could you add another post in begining of my buildings thread please
 
Nothing interesting, just a copy and paste from onBuildingBuilt default codes :D
But since you are developing a new way of playing movies, it may be better, because this is using the Movie tag in buildings.
Thus, for it to work with Natural Wonders which are not buildings, you have to end up making dummy buildings to use it
 
yeah, the playMovie method seems to take


playMovie (STRING szMovieName, FLOAT fX, FLOAT fY, FLOAT fWidth, FLOAT fHeight, FLOAT fZ)

and a Movie name doesn't have to come from the xml (though it would result in an If tree...) however I believe it is a simple C++ change to put the movie tag into the feature/plot xml or whatever...
 
Done :D

I broke in :mischief:

However Dacubz, for this to work at maximum efficiency (ie no hardcoding) I will need to make a small change to the sdk and xml schema (basically giving features a movie tag in the xml, but you will then have a custom dll) so if you will let me that will be the natural wonder movie code (currently it works on the descriptions of the feature and that is dangerous to do...)

The J and Platyping meet my masterpiece :D:

I edited the CvWonderMovieScreen.py file to be able to display feature movies:

Spoiler :

Code:
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
from CvPythonExtensions import *
import PyHelpers
import CvUtil
import ScreenInput
import CvScreenEnums

PyPlayer = PyHelpers.PyPlayer
PyInfo = PyHelpers.PyInfo

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

MOVIE_SCREEN_WONDER = 0
MOVIE_SCREEN_RELIGION = 1
MOVIE_SCREEN_PROJECT = 2
[B]#Natural Wonders - Start 
MOVIE_SCREEN_NATURE = 3
#Natural Wonders - End [/B]

class CvWonderMovieScreen:
	"Wonder Movie Screen"

	def __init__(self):
		self.fDelay = -1.0
		self.fTime = 0.0
		self.bDone = false

	def interfaceScreen (self, iMovieItem, iCityId, iMovieType):
		# iMovieItem is either the WonderID, the ReligionID, or the ProjectID, depending on iMovieType [B](or the feature id :p)[/B]
		
		if CyUserProfile().getGraphicOption(GraphicOptionTypes.GRAPHICOPTION_NO_MOVIES):
			return
		
		self.Z_CONTROLS = -2.2

		self.X_SCREEN = 0
		self.Y_SCREEN = 0
		self.W_SCREEN = 1024
		self.H_SCREEN = 768

		self.X_WINDOW = 250
		self.Y_WINDOW = 40
		self.W_WINDOW = 760
		self.H_WINDOW = 590
		self.Y_TITLE = self.Y_WINDOW + 20
		self.iWonderId = iMovieItem
		
		self.X_EXIT = self.X_WINDOW + self.W_WINDOW/2 - 50
		self.Y_EXIT = self.Y_WINDOW + self.H_WINDOW - 50
		self.W_EXIT = 120
		self.H_EXIT = 30
		
		self.X_MOVIE = 20
		self.Y_MOVIE = 50
		self.W_MOVIE = 720
		self.H_MOVIE = 480
		
		self.iMovieType = iMovieType
		self.fTime = 0.0
		self.fDelay = 1.5
		self.bDone = false
		
		# not all projects have movies
		self.szMovieFile = None
		if self.iMovieType == MOVIE_SCREEN_PROJECT:
			szArtDef = gc.getProjectInfo(iMovieItem).getMovieArtDef()
			if (len(szArtDef) > 0):
				self.szMovieFile = CyArtFileMgr().getMovieArtInfo(szArtDef).getPath()
		elif self.iMovieType == MOVIE_SCREEN_WONDER:
			self.szMovieFile = gc.getBuildingInfo(iMovieItem).getMovie()
		elif self.iMovieType == MOVIE_SCREEN_RELIGION:
			self.szMovieFile = gc.getReligionInfo(iMovieItem).getMovieFile()
 [B]               #Natural Wonders - Start 
                elif self.iMovieType == MOVIE_SCREEN_NATURE:
                        wonderInfo = gc.getFeatureInfo(iMovieItem).getDescription() #this is risky so I want a DLL change to accomodate the movie file!
                        if wonderInfo == gc.getInfoTypeForString("FEATURE_?").getDescription():
                                self.szMovieFile = getMovieArtInfo("ART_DEF_MOVIE_?").getPath() #define this in ArtDefinesMovie.xml
                        self.iCityId = gc.getActivePlayer().getCapitalCity().getID() #the screen is centered around player's capital :p
                #Natural Wonders - End[/B]
		if (self.szMovieFile == None or len(self.szMovieFile) == 0):
			return
		
		player = PyPlayer(CyGame().getActivePlayer())
		
		# move the camera and mark the interface camera as dirty so that it gets reset - JW
		if self.iMovieType == MOVIE_SCREEN_WONDER:
			CyInterface().lookAtCityBuilding(iCityId, iMovieItem)
		else:
			CyInterface().lookAtCityBuilding(iCityId, -1)
		CyInterface().setDirty(InterfaceDirtyBits.SelectionCamera_DIRTY_BIT, True)
		
		screen = CyGInterfaceScreen( "WonderMovieScreen" + str(iMovieItem), CvScreenEnums.WONDER_MOVIE_SCREEN )
		screen.addPanel("WonderMoviePanel", "", "", true, true,
			self.X_WINDOW, self.Y_WINDOW, self.W_WINDOW, self.H_WINDOW, PanelStyles.PANEL_STYLE_MAIN)
		
		screen.showWindowBackground( True )
		screen.setDimensions(screen.centerX(self.X_SCREEN), screen.centerY(self.Y_SCREEN), self.W_SCREEN, self.H_SCREEN)
		screen.setRenderInterfaceOnly(False)
		screen.showScreen(PopupStates.POPUPSTATE_IMMEDIATE, False)
		screen.enableWorldSounds( false )
		                		
		# Header...
		szHeaderId = "WonderTitleHeader" + str(iMovieItem)
		if self.iMovieType == MOVIE_SCREEN_RELIGION:
			szHeader = localText.getText("TXT_KEY_MISC_REL_FOUNDED_MOVIE", (gc.getReligionInfo(iMovieItem).getTextKey(), ))
		elif self.iMovieType == MOVIE_SCREEN_WONDER:
			szHeader = gc.getBuildingInfo(iMovieItem).getDescription()
		elif self.iMovieType == MOVIE_SCREEN_PROJECT:
			szHeader = gc.getProjectInfo(iMovieItem).getDescription()
		[B]#Natural Wonders - Start 
		elif self.iMovieType == MOVIE_SCREEN_NATURE:
                        szheader = gc.getFeatureInfo(iMovieItem).getDescription()
                #Natural Wonders - End        [/B]

		screen.setLabel(szHeaderId, "Background", u"<font=4b>" + szHeader + "</font>", CvUtil.FONT_CENTER_JUSTIFY,
				self.X_WINDOW + self.W_WINDOW / 2, self.Y_TITLE, self.Z_CONTROLS, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
				
		screen.hide("Background")

		screen.playMovie("", 0, 0, 0, 0, 0) # dummy call to hide screen if no movies are supposed to be shown

	def playMovie(self):
			
		screen = CyGInterfaceScreen( "WonderMovieScreen" + str(self.iWonderId), CvScreenEnums.WONDER_MOVIE_SCREEN )
		screen.setRenderInterfaceOnly(True)
		screen.show("Background")

		# Play the movie
		if self.iMovieType == MOVIE_SCREEN_RELIGION:
			screen.addReligionMovieWidgetGFC( "ReligionMovie", self.szMovieFile, self.X_WINDOW + self.X_MOVIE, self.Y_WINDOW + self.Y_MOVIE, self.W_MOVIE, self.H_MOVIE, WidgetTypes.WIDGET_GENERAL, -1, -1)
			CyInterface().playGeneralSound(gc.getReligionInfo(self.iWonderId).getMovieSound())		
		else:
			screen.playMovie(self.szMovieFile, self.X_WINDOW + self.X_MOVIE, self.Y_WINDOW + self.Y_MOVIE, self.W_MOVIE, self.H_MOVIE, -2.3 )
			
		screen.setButtonGFC("WonderExit" + str(self.iWonderId), localText.getText("TXT_KEY_MAIN_MENU_OK", ()), "", self.X_EXIT, self.Y_EXIT, self.W_EXIT, self.H_EXIT, WidgetTypes.WIDGET_CLOSE_SCREEN, -1, -1, ButtonStyles.BUTTON_STYLE_STANDARD )

	# Will handle the input for this screen...
	def handleInput (self, inputClass):
		if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_MOVIE_DONE):
			if (not self.bDone):
				screen = CyGInterfaceScreen( "WonderMovieScreen" + str(self.iWonderId), CvScreenEnums.WONDER_MOVIE_SCREEN )
				if self.iMovieType == MOVIE_SCREEN_WONDER:
					szHelp = CyGameTextMgr().getBuildingHelp(self.iWonderId, False, False, False, None)
				elif self.iMovieType == MOVIE_SCREEN_PROJECT:
					szHelp = CyGameTextMgr().getProjectHelp(self.iWonderId, False, None)
				[B]#Natural Wonders - Start
                                elif self.iMovieType == MOVIE_SCREEN_NATURE:
                                        szHelp = CyGameTextMgr().getFeatureHelp(self.iWonderId, False, None)
                                #Natural Wonders - End[/B]
				else:
					szHelp = ""
				
				if len(szHelp) > 0:
					screen.addPanel("MonkeyPanel", "", "", true, true, self.X_WINDOW + self.X_MOVIE + self.W_MOVIE / 8 - 10, self.Y_WINDOW + self.Y_MOVIE + 90, 3 * self.W_MOVIE / 4 + 20, self.H_MOVIE - 180, PanelStyles.PANEL_STYLE_MAIN_BLACK50)	
					screen.addMultilineText("MonkeyText", szHelp, self.X_WINDOW + self.X_MOVIE + self.W_MOVIE / 8, self.Y_WINDOW + self.Y_MOVIE + 100, 3 * self.W_MOVIE / 4, self.H_MOVIE - 200, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)	
				self.bDone = true

		return 0

	def update(self, fDelta):
	
		if self.fDelay > 0:
			self.fTime += fDelta
			if self.fTime > self.fDelay:
				self.playMovie()
				self.fDelay = -1
		return


then in EventManager:

Spoiler :

Code:
                #Natural Wonders - Start
		wonder = gc.getInfoTypeForString("BUILDING_PARTHENON") #this would be the discovered feature ID :p
		CvScreensInterface.showWonderMovie((wonder, gc.getActivePlayer().getCapitalCity().getID(), [B]3[/B])) #the 3 is the Nature Wonder type don't change it!
		#Natural Wonders - End


Any questions :p

btw if you give me some natural wonder XML definitions I can write this code out properly :p

edit: I found a method in CyCamera: JustLookAtPlot (CyPlot pPlot) I can put this in the WonderMovieScreen to focus on the plot instead of city... I will attach the CvWonderMovieScreen.py here when I am finished completely (ie dacubz has given permission for the custom DLL)
 
The_J just so you know:

I am adding two new methods to the CvFeatureInfos class, the first you don't need to worry about it just gets the movie define for the feature but the second might come in useful.

isNaturalWonder()

you could probably use it somewhere in your code ;)
 
@ dacubz

interesting code, personally i was interested to see the results of

CyGInterface().playMovie() but if this works thats good (and I think the code you posted could actually be the backdoor into that file I mentioned before...)
 
Back
Top Bottom