Events XML limitations

Toffer90

C2C Modder
Joined
Oct 16, 2011
Messages
8,497
Location
Norway
Events, as they are now, feels a bit lackluster and unpolished as a system.

We would need some new functions/tags:

EventTrigger:
•Requirement that the plot has been revealed for the event to trigger. Let's call it bRevealed (and be set to TRUE as default as most events don't make sense in a plot that isn't revealed)
this requirement is meant to be used for player (also AI) specific events. Some considerations would be needed for how to handle this tag when used with the already existing bGlobal which make the event be considered triggered for all civs no matter what civ actually triggered it. bGlobal should perhaps just make the event-trigger ignore the bRevealed tag, OR preferably, make the event trigger only for the civs that have revealed the trigger plot.

•Latitude/longitude tags.

• bNoMessage (bSilent? - default = FALSE) Some events may not warrant a message at all, like forests aging through new→regular→Ancient. WorldNewsTexts would still be visible if defined.

•Neutral/Hostile/Friendly/Foreign/Native cultural plot requirements
Currently, an Event-Trigger defines what events happens through an array like this:
Code:
			<Events>
				<Event>EVENT_FOREST_FIRE_1</Event>
				<Event>EVENT_FOREST_FIRE_2</Event>
				<Event>EVENT_FOREST_FIRE_3</Event>
			</Events>
When there are more than 1 event you get a choice between which one will happen.
Maybe it would be better if it was like this:
Code:
			<EventsNative>
				<Event>EVENT_FOREST_FIRE_1</Event>
				<Event>EVENT_FOREST_FIRE_2</Event>
				<Event>EVENT_FOREST_FIRE_3</Event>
			</EventsNative>
			<EventsForeign>
				<Event>EVENT_FOREST_FIRE_4</Event>
			</EventsForeign>
			<bNoMessageForeign>1</bNoMessageForeign>
			<bShowPlotNative>1</bShowPlotNative>
Where EVENT_FOREST_FIRE_4 is the event triggered outside borders and 1-3 the events triggered inside borders.

&#8226;bCoast & bRiver (e.g. for adding and removing flood plains along rivers.)

&#8226;bPrereqEventPlot (already existing) makes a continuation event (an event that require another event to have occurred) happen in the same plot as the required event happened in.
bPrereqEventPlotAdjacent (suggestion) would make the continuation event occur in one of the eight neighboring plots to the plot that the required event happened in.
Alternatively a tag called iPrereqEventPlotDistance (suggestion) could be made to set the amount of plots away, from the plot the required event happened in, that the continuation event will be at (default to 0, at the same plot). This could also be made as two tags, one maximum and another minimum distance, that defines a range it can happen in.


Events:
&#8226;Gamespeed should influence events that grants/penalize a constant amount of commerce or yield - No more "Happy Hunting" event giving 8 food to 1 city on all gamespeeds.
Spoiler :
So these tags - "iFood, iGold, iRandomGold, iCulture and iEspionagePoints" - should be possible to define in this fashion:
Code:
<Yields>
	<iYield>
		<Adapt>
			<ID>ADAPT_DEFAULT</ID>
			<Constant>10</Constant>
		</Adapt>
	</iYield>
</Yields>
&#8226; iFloodPlainChange
&#8226;<FeatureType>Z</FeatureType>; <iFeatureChange>1</iFeatureChange>
Should automatically replace any feature (except for flood plains) with a Z. [Now we need 2 events, one that removes and then a continuation event that adds]
&#8226;<iFeatureChange>-1</iFeatureChange>
If this is used without defining the features with one or more <FeatureType>X</FeatureType> it should remove any features except for flood plains.
&#8226;The same kind of logic should be applied for <iBonusChange>, <iRouteChange> & <iImprovementChange>


Other:
&#8226;Get the EraInfos tag iEventChancePerTurn (event frequency) to scale by game speed.

Hopefully, we can expand this list through discussions in this thread
 
I gotta admit I have a lot to learn regarding working with event code. It's very complex and I haven't the slightest what its current limitations on.
 
It would be great, if you could get more events to show up and also more different kinds of events to appear.

I always play with events on - but they always seem to be to sparce and not very different. If the number of events can been increased and you can increase the variability - you may get more feedback.

But it seems to me that the number of events may have been increased, but the RNG that selects them has not been changed.
 
It would be great, if you could get more events to show up and also more different kinds of events to appear.

I always play with events on - but they always seem to be to sparce and not very different. If the number of events can been increased and you can increase the variability - you may get more feedback.

But it seems to me that the number of events may have been increased, but the RNG that selects them has not been changed.
Yes, I intend to make all events be active in all games, already done this in my modmod. As it is in the SVN now, there is a chance that over half the events will not be active in games. When you start a new game the game decides what events should be included in this game (those not chosen will NEVER appear in this game), and most of them does not have a 100% chance to be included in this mix. Unless an event is too wacky (Like an easter egg) to be included in every game it should be included in every game.
 
This will reduce the number of events that happen:crazyeye: Crazy I know but it means that there will be more events that may be selected for the player that can't happen that turn.

I did not follow your reasoning, but if you're right, it's a good thing we have the capability of increasing event frequency then. ^^ <iEventChancePerTurn> Multiplier for random event chance

I have events happening very often when I have all events turned on.
 
As far as I know an event is chosen from all available events each turn for each player except the barbarian. It is then checked to see if it is valid for that player. Rather than a chance that an event occurs is determined then if it does an event is chosen for that player from a list of ones that are valid for that player.
 
As far as I know an event is chosen from all available events each turn for each player except the barbarian. It is then checked to see if it is valid for that player. Rather than a chance that an event occurs is determined then if it does an event is chosen for that player from a list of ones that are valid for that player.
I believe events are not checked every turn; but rather there is a chance for it to do the process you describe every turn, and that chance is what we can manipulate to balance out a larger event pool.
 
1) Every turn, for every player, check that events can occur in the first place (No Event Game Options, Current Game Turn, Barbarian etc)

2) Roll a number based on EVENT_PROBABILITY_ROLL_SIDES, compared to GC.getEraInfo(getCurrentEra()).getEventChancePerTurn() to determine if event should occur this turn for this player.

3) If true, loop through every event to check the weight.
Events which cannot fulfill requirements will have 0 weight regardless of iWeight in xml.
The rest are then added into a list based on the weight.
Events which iWeight = -1 will always trigger.
Events which iWeight < -1 will never trigger.

4) Choose a random value iValue based on total weight of eligible events.
Loop through that list of eligible events. Trigger the first event that is taking a slot > iValue.
Eg
Event A Weight 100, B Weight 200, C Weight 300.
Total Weight 600
A will be taking space 0 to 99
B will be 100 to 299
C will be 300 to 599.

If iValue is 250, B will trigger.
If iValue is 20, A will trigger.

To summarise,
Every turn for each player, there is a chance that event can occur.
If so, then loop through all events to see which are eligible and compile a list.
Choose one from the list, where a bigger iWeight will have a bigger chance to occur.
 
Spoiler :
1) Every turn, for every player, check that events can occur in the first place (No Event Game Options, Current Game Turn, Barbarian etc)

2) Roll a number based on EVENT_PROBABILITY_ROLL_SIDES, compared to GC.getEraInfo(getCurrentEra()).getEventChancePerTurn() to determine if event should occur this turn for this player.

3) If true, loop through every event to check the weight.
Events which cannot fulfill requirements will have 0 weight regardless of iWeight in xml.
The rest are then added into a list based on the weight.
Events which iWeight = -1 will always trigger.
Events which iWeight < -1 will never trigger.

4) Choose a random value iValue based on total weight of eligible events.
Loop through that list of eligible events. Trigger the first event that is taking a slot > iValue.
Eg
Event A Weight 100, B Weight 200, C Weight 300.
Total Weight 600
A will be taking space 0 to 99
B will be 100 to 299
C will be 300 to 599.

If iValue is 250, B will trigger.
If iValue is 20, A will trigger.

To summarise,
Every turn for each player, there is a chance that event can occur.
If so, then loop through all events to see which are eligible and compile a list.
Choose one from the list, where a bigger iWeight will have a bigger chance to occur.
Thanks, that was illuminating.
So the big reason for events not to happen (in any game, ever) would be multiple events having the same requirements and iWeight? Since the one defined earliest will always take precedence (unless there are some randomizing in the order of events in the compiled list??).
 
Nope, if 3 events have the same weight, they will have same chance of occurring.
If A, B and C all have weight 100.
Total Weight is 300

Choose random value from 0 to 299
0 to 99 will trigger A
100 to 199 will trigger B
200 to 299 will trigger C

The main reason would be step 2, where a random number is rolled out of the global EVENT_PROBABILITY_ROLL_SIDES, which is then compared to the era value.
In BTS this global value is 100.
If the random number is >= the era value, event will not trigger.
In Ancient Era of BTS, this era value is 1, which increases with era.

What is the odds that picking a number from 0 to 99 will be less than 1?

The next reason would be step 3, where events which are eligible are compiled into a list.
Some events are removed right at start due to iPercentGamesActive
Events which have tedious requirements are also gone.
Events which cannot repeat and already activated are gone also.

What you are left will probably be mostly repeating ones like Forest Fire and just a small number of events based on your era.
 
Spoiler :
Nope, if 3 events have the same weight, they will have same chance of occurring.
If A, B and C all have weight 100.
Total Weight is 300

Choose random value from 0 to 299
0 to 99 will trigger A
100 to 199 will trigger B
200 to 299 will trigger C

The main reason would be step 2, where a random number is rolled out of the global EVENT_PROBABILITY_ROLL_SIDES, which is then compared to the era value.
In BTS this global value is 100.
If the random number is >= the era value, event will not trigger.
In Ancient Era of BTS, this era value is 1, which increases with era.

What is the odds that picking a number from 0 to 99 will be less than 1?

The next reason would be step 3, where events which are eligible are compiled into a list.
Some events are removed right at start due to iPercentGamesActive
Events which have tedious requirements are also gone.
Events which cannot repeat and already activated are gone also.

What you are left will probably be mostly repeating ones like Forest Fire and just a small number of events based on your era.
Cool cool, then there is no reason that more events = less events as indicated here earlier.
Thanks again; a detailed explanaition on how events works is great to have on the first page of this thread.
 
Bump.

The bRevealed tag suggestion would allow me to use bShowPlot=TRUE on the moving animal resource event system. Right now there is almost no notification about when animals move because it is annoying to have the camera sent to the edge of the map and you still don't see the place the event happened in because it is too far off your map.
 
Bump.

The bRevealed tag suggestion would allow me to use bShowPlot=TRUE on the moving animal resource event system. Right now there is almost no notification about when animals move because it is annoying to have the camera sent to the edge of the map and you still don't see the place the event happened in because it is too far off your map.

Is this a similar thing to the recent "Herds of X animals have moved nearby...". And then there is a screen with the animal Popup pic in the upper right corner of the Black screen, but it's off in some unexplored area for your empire and isn't anywhere near you?

JosEPh
 
Thanks. :) Now I know it source.

JosEPh
 
Back
Top Bottom