Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper, efficient weather system #11

Closed
thefinestsieve opened this issue Jun 12, 2014 · 12 comments
Closed

Proper, efficient weather system #11

thefinestsieve opened this issue Jun 12, 2014 · 12 comments

Comments

@thefinestsieve
Copy link
Contributor

Not entirely clear on how exactly it'd work, but it's been done in the past and it seems like it should be possible. Perhaps route through on_actions? Scheduled event loop on Isis or on a specific "handler" province? Not sure...

But I'd limit it to outliers only, so only unusually bad or unusually good weather would be worthy of attaching a province modifier. Then pull the specific modifier from a pool based on the time of year (Winter? Rats got into the grain storage! Oh gods, I'm getting Lords of the Realm flashbacks) and set modifiers to expire on their own so we don't have to run maintenance events to remove them.

@zijistark
Copy link
Member

Isis can handle global maintenance pulses to update global game state in one fell swoop on relatively accurate, periodic intervals without the duplication, missed events, and other weird issues of on_actions.

@zijistark
Copy link
Member

Yes, definitely expiring modifiers and sticking to outliers would be key. Also, these events might be perfect for the style notification = yes that I've been so wanting to use, as we don't want to add yet more pop-ups for the user to click-through when they're trying to do something.

I'm assuming they have largely economic outcomes? I could see them impacting things like effective fort readiness on coastal provinces, trade value, tax modifiers, possibly movement speed (do we have this in 2.1 already or is it one of the extensions?), and, of course, levy_sizes.

@thefinestsieve
Copy link
Contributor Author

That's a good idea about using the notification options. And yes, I'm thinking mostly economic outcomes, though I suppose particularly harsh events could result in revolt risk as well.

@zijistark
Copy link
Member

If the modifiers self-expire, then Isis will be a lot happier. She'll only have to dole out weather events on her maintenance pulses and never do global sweeps (at least, not for this mechanic-- they're not out of the question nor should by any means be considered a performance drag). They can be as short-lasting or as long as they like.

@thefinestsieve
Copy link
Contributor Author

I started up the weather module in a separate branch in my fork.

@zijistark
Copy link
Member

How are you going to go about initial modifier assignment?

Are you going to sweep all provinces on the map every quarter? Or what about doing like 30 random selections of regions, where a region is a province and all provinces that border it and evaluating them for weather events?

I recommend that you don't use any actual province_events. You can't use notification = yes on those, nor can you even hide_window = yes them (popup always gets delivered to province owner).

@thefinestsieve
Copy link
Contributor Author

I haven't yet decided how exactly I want to do it. The regions approach is tempting, but I do worry about excessive clustering of weather modifiers; though I suppose that problem could be addressed by preventing the initial province choice (the one which would define the region) from being within 3-4 provinces of a province which already has a weather modifier.

@zijistark
Copy link
Member

Since checking for "shortest distance by number of hops" is already a nontrivial problem in computer science (but easily solved in these cases with real tools), do remember that you're dealing with Paradox. The only not stupidly overcomplicated way you can check adjacency-distance efficiently really beyond just immediate adjacency is through use of nested any_neighbor_province, which means considering every neighbor province of every neighbor province's neighbor provinces (with tons of "doubling back" on your steps).

However, you can note whether independent realms (or just duke-and-above realms) have a weather modifier in them fairly cheaply.

Province sweeping with a recursive event for every province is probably your most straightforward way to go. Not the cheapest thing to do in the world every 90 days, esp. on large maps like SWMH+ will be (though vanilla is pretty fucking big too, when you line-up the numbers at this point), but I say: it's better to code it the straightforward way with full coverage and find out it makes no performance difference than to have to scale back your approach a bit later if it proves to actually make a difference. So sweep away.

@zijistark
Copy link
Member

And by "recursive event for every province," I mean hidden recursive character_event for each of all rulers' count-tier demesne titles.

@thefinestsieve
Copy link
Contributor Author

Actually, what I was thinking about doing was a pairing a major = yes narrative event which excludes players (since I don't care if AI gets a popup they have to "click") with an invisible event which only hits players.

@zijistark
Copy link
Member

If all you want is ruler-level granularity (i.e., not accounting for multiple counties in a demesne equally with the rest), that will work well.

@zijistark
Copy link
Member

And Anax delivered this long ago, stunningly. Closing.

@thefinestsieve thefinestsieve removed their assignment Aug 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants