Community Patch: Events System

Gazebo

Lord of the Community Patch
Supporter
Joined
Sep 26, 2010
Messages
18,399
Location
Little Rock
Hello all! I posted this in the Community Patch Project subforum, but – since it is actually a modding tool – I felt it prudent to post this here as well.

Community Patch: Events

Events and Decisions is a fantastic project, and Sukritact's work inspired me to take the concept of Events to the next level by creating an entirely-new DLL-based Events system. This system is fully integrated into the Community Patch, has tons of options and flexibility, and - the best part - events can be created using nothing but XML. That's right, you will not need to use LUA or C++ to generate new events for Civ!

Events are broken down into two categories: Player-level events, and City-level events. Here are two examples of City Events:

City Events Album

These events fired because the city had a market and monument (respectively), and - once the choice is taken - the yield change is made permanent for that city. There are quite a few options available for the creation of events, ranging from simple building yield changes like this, to complete chaos-inducing disaster events that can practically level the city! Complexity and variability are all up to the event designers themselves.

At the player-level, the event XML looks largely the same, though many of the Event attributes affect all cities, not just one, thus the risk/reward is higher. Player-level events can also be made global, thus - for example - you can create events that, once triggered by any player, are also sent to other players that the original player knows.

Examples: If you want an event that can only happen in the Classical Era, with Greece, if Greece has a coastal city and 20 total national population...you can do that! If you want an event choice to have a 20% chance to spawn barbarian units near every city, another to give you a free barracks in every city for 30 turns, and a third to give you a golden age if you pay 500 gold...you can do that too! If you want a horrific demon comet to appear in the night sky that leads to mass rebellions and unrest in all cities, that's also possible! There are innumerable options, and I've heavily documented all event attributes and their effects in the event tables in the CP.

The city events above, for example, were created using the following XML:

Spoiler :
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 3/31/2016 12:07:24 AM -->
<GameData>
	<CityEvents>
		<Row>
			<ID>0</ID>
			<Type>CITY_EVENT_MARKET_DEVELOPMENT</Type>
			<RandomChance>5</RandomChance>
			<RandomChanceDelta>1</RandomChanceDelta>
			<RequiredBuildingClass>BUILDINGCLASS_MARKET</RequiredBuildingClass>
			<Description>TXT_KEY_CITY_EVENT_MARKET_DEVELOPMENT</Description>
			<Help>TXT_KEY_CITY_EVENT_MARKET_DEVELOPMENT_HELP</Help>
			<NumChoices>2</NumChoices>
		</Row>
		<Row>
			<Type>CITY_EVENT_MONUMENT_DEVELOPMENT</Type>
			<RandomChance>5</RandomChance>
			<RandomChanceDelta>1</RandomChanceDelta>
			<IsOneShot>true</IsOneShot>
			<RequiredBuildingClass>BUILDINGCLASS_MONUMENT</RequiredBuildingClass>
			<Description>TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT</Description>
			<Help>TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT_HELP</Help>
			<NumChoices>3</NumChoices>
		</Row>
	</CityEvents>
	<CityEventChoices>
		<Row>
			<ID>0</ID>
			<Type>CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_1</Type>
			<Description>TXT_KEY_CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_1</Description>
			<Help>TXT_KEY_CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_1_HELP</Help>
			<IsOneShot>true</IsOneShot>
		</Row>
		<Row>
			<Type>CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_2</Type>
			<Description>TXT_KEY_CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_2</Description>
			<Help>TXT_KEY_CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_2_HELP</Help>
			<IsOneShot>true</IsOneShot>
		</Row>
		<Row>
			<Type>CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_1</Type>
			<Description>TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_1</Description>
			<Help>TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_1_HELP</Help>
			<IsOneShot>true</IsOneShot>
		</Row>
		<Row>
			<Type>CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_2</Type>
			<Description>TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_2</Description>
			<Help>TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_2_HELP</Help>
			<IsOneShot>true</IsOneShot>
			<RequiresPantheon>true</RequiresPantheon>
		</Row>
		<Row>
			<Type>CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_3</Type>
			<Description>TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_3</Description>
			<Help>TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_3_HELP</Help>
			<IsOneShot>true</IsOneShot>
		</Row>
	</CityEventChoices>
	<CityEvent_ParentEvents>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_1</CityEventChoiceType>
			<CityEventType>CITY_EVENT_MARKET_DEVELOPMENT</CityEventType>
		</Row>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_2</CityEventChoiceType>
			<CityEventType>CITY_EVENT_MARKET_DEVELOPMENT</CityEventType>
		</Row>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_1</CityEventChoiceType>
			<CityEventType>CITY_EVENT_MONUMENT_DEVELOPMENT</CityEventType>
		</Row>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_2</CityEventChoiceType>
			<CityEventType>CITY_EVENT_MONUMENT_DEVELOPMENT</CityEventType>
		</Row>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_3</CityEventChoiceType>
			<CityEventType>CITY_EVENT_MONUMENT_DEVELOPMENT</CityEventType>
		</Row>
	</CityEvent_ParentEvents>
	<CityEventChoice_BuildingClassYieldChange>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_1</CityEventChoiceType>
			<BuildingClassType>BUILDINGCLASS_MARKET</BuildingClassType>
			<YieldType>YIELD_GOLD</YieldType>
			<YieldChange>-1</YieldChange>
		</Row>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_1</CityEventChoiceType>
			<BuildingClassType>BUILDINGCLASS_MARKET</BuildingClassType>
			<YieldType>YIELD_CULTURE</YieldType>
			<YieldChange>1</YieldChange>
		</Row>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_2</CityEventChoiceType>
			<BuildingClassType>BUILDINGCLASS_MARKET</BuildingClassType>
			<YieldType>YIELD_GOLD</YieldType>
			<YieldChange>1</YieldChange>
		</Row>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_1</CityEventChoiceType>
			<BuildingClassType>BUILDINGCLASS_MONUMENT</BuildingClassType>
			<YieldType>YIELD_CULTURE</YieldType>
			<YieldChange>1</YieldChange>
		</Row>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_2</CityEventChoiceType>
			<BuildingClassType>BUILDINGCLASS_MONUMENT</BuildingClassType>
			<YieldType>YIELD_FAITH</YieldType>
			<YieldChange>1</YieldChange>
		</Row>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_3</CityEventChoiceType>
			<BuildingClassType>BUILDINGCLASS_MONUMENT</BuildingClassType>
			<YieldType>YIELD_GOLD</YieldType>
			<YieldChange>1</YieldChange>
		</Row>
	</CityEventChoice_BuildingClassYieldChange>
	<CityEventChoiceFlavors>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_1</CityEventChoiceType>
			<FlavorType>FLAVOR_CULTURE</FlavorType>
			<Flavor>20</Flavor>
		</Row>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_2</CityEventChoiceType>
			<FlavorType>FLAVOR_GOLD</FlavorType>
			<Flavor>20</Flavor>
		</Row>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_1</CityEventChoiceType>
			<FlavorType>FLAVOR_CULTURE</FlavorType>
			<Flavor>20</Flavor>
		</Row>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_2</CityEventChoiceType>
			<FlavorType>FLAVOR_RELIGION</FlavorType>
			<Flavor>20</Flavor>
		</Row>
		<Row>
			<CityEventChoiceType>CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_3</CityEventChoiceType>
			<FlavorType>FLAVOR_GOLD</FlavorType>
			<Flavor>20</Flavor>
		</Row>
	</CityEventChoiceFlavors>
	<Language_en_US>
		<!-- Market Development -->
		<Row Tag="TXT_KEY_CITY_EVENT_MARKET_DEVELOPMENT">
			<Text>Crowded Markets, Foreign Tongues</Text>
		</Row>
		<Row Tag="TXT_KEY_CITY_EVENT_MARKET_DEVELOPMENT_HELP">
			<Text>Crowds gather in your city's marketplace, voices from many different lands ringing out as deals are struck and bargains made. Some are angry about this, and believe that foreigners will destroy our trade. Others, however, encourage the foreign business, hoping to learn from their culture.[NEWLINE][NEWLINE]How do you feel about this? Choose from the following options:</Text>
		</Row>
		<Row Tag="TXT_KEY_CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_1">
			<Text>Let the foreigners continue to trade.</Text>
		</Row>
		<Row Tag="TXT_KEY_CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_1_HELP">
			<Text>Market in City: +1 [ICON_CULTURE] Culture, -1 [ICON_GOLD] Gold.</Text>
		</Row>
		<Row Tag="TXT_KEY_CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_2">
			<Text>Implement heavy taxes on imported goods.</Text>
		</Row>
		<Row Tag="TXT_KEY_CITY_EVENT_MARKET_DEVELOPMENT_CHOICE_2_HELP">
			<Text>Market in City: +1 [ICON_GOLD] Gold.</Text>
		</Row>
		<!-- Monument Development -->
		<Row Tag="TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT">
			<Text>Icons of Our Past</Text>
		</Row>
		<Row Tag="TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT_HELP">
			<Text>Monuments represent the most important symbols of your culture. Your people seek to celebrate this by dedicating the City's Monument to either their ancestors, or to their gods.[NEWLINE][NEWLINE]How do you feel about this? Choose from the following options:</Text>
		</Row>
		<Row Tag="TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_1">
			<Text>Dedicate the Monument to our ancestors.</Text>
		</Row>
		<Row Tag="TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_1_HELP">
			<Text>Monument in City: +1 [ICON_CULTURE] Culture.</Text>
		</Row>
		<Row Tag="TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_2">
			<Text>The gods are what is important now.</Text>
		</Row>
		<Row Tag="TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_2_HELP">
			<Text>Monument in City: +1 [ICON_PEACE] Faith.</Text>
		</Row>
		<Row Tag="TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_3">
			<Text>Neither will suffice. The Monument should generate revenue.</Text>
		</Row>
		<Row Tag="TXT_KEY_CITY_EVENT_MONUMENT_DEVELOPMENT_CHOICE_3_HELP">
			<Text>Monument in City: +1 [ICON_GOLD] Gold.</Text>
		</Row>
	</Language_en_US>
</GameData>

That really is all you need - everything else (the UI, the notifications, the AI, etc.) is all handled in the DLL.

Making new events is just as easy as making a new building, or creating a new belief, as it uses the same basic XML structure (for more advanced users, there are lua hooks that you can use to create events that go beyond the XML variants included in Community Patch:Events system. JFD and Enginseer are already involved in this process). The system is fully AI supported, has robust notification and UI support, and is very easy to test and debug.

Now, how is this going to affect the Community Patch? The system will be off by default for users of the Community Patch, as Events constitute a significant gameplay change. For the CBP, however, I intend to have a modest collection of events (some with choices, others without choices) ready for the next release. The system's core files, and event files, will be included with the Community Patch, thus users of just the CP will be able to use the events if they like, and users of the Community Balance Patch will be able to disable the system if they like.

Stay tuned for updates on this, as well the next major CPP update, which will be coming soon. I should also note that JFD and Enginseer are in the process of converting over their Events from E&D to this system, a step that should reduce instabilities, increase performance, and (in some cases) lower the number of 'dummy' buildings/policies used by their mods. If you are interested in the core tables of the events system, and/or wish to start working on your own events right away, I'll be posting a developer's beta of the latest CP very soon.

Cheers,
Gazebo
 
I should also note that JFD and Enginseer are in the process of converting over their Events from E&D to this system, a step that should reduce instabilities, increase performance, and (in some cases) lower the number of 'dummy' buildings/policies used by their mods. If you are interested in the core tables of the events system, and/or wish to start working on your own events right away, I'll be posting a developer's beta of the latest CP very soon.

Cheers,
Gazebo

Will this be usable in conjunction with Sukritact's Events and Decision for the "decisions" aspect? Never mind. I stumbled across this thread before I found the one in the CPOP forum. I was wondering why such a huge announcement had 0 responses :crazyeye:
 
Hi
Sorry, where I can find the description of the tables of this system?
 
Top Bottom