Last Two Actions


As it is now becoming tradition, over the past two weekends, I spend the first just fixing bugs I introduced two weeks ago, then the second working on completing remaining items on my checklist. I couldn't solve all the problems I encountered on the first week, but I don't want to be stuck forever fixing issues, so I'll let them simmer for a while and I'll return to them once I have completed what's left of the feature.

I started working on the last two actions I wanted to implement for this release. The first one will let players improve relationships with neighboring factions that do not belong to the tribe they control. The second will let them invite said neighboring faction to join the tribe once the relationship value is high enough.

The hardest part has been implementing the necessary mod elements that will make those two actions work. One is needed to allow players to choose from the map a neighboring tribe, and a similar one is needed to select a clan within the target tribe. Most of the code infrastructure is already in place since the operation is very similar to the one I'm implemented to select neighboring regions for tribal expansion. But still, there a a few critical differences between tribal territories and geographical regions that make everything a bit harder. For one, regions are immutable. Once generated, they never change. So it's easy to calculate certain properties for a region like its geometric centroid or their total area. Tribal territories are constantly changing. So I need to use algorithms that can account for these changes when calculating their geographical properties. The last thing I want to do is recalculate the values for those properties from scratch every single time an action occurs, as this would slow down the game noticeably.

In any case, I think I'll be done with these actions in a week or two. Then I'll start a new closed test alpha period while I work on the remaining items for this release.

Get Worlds - History Simulator

Comments

Log in with itch.io to leave a comment.

(1 edit) (-1)

"So I need to use algorithms that can account for these changes when calculating their geographical properties. The last thing I want to do is recalculate the values for those properties from scratch every single time an action occurs, as this would slow down the game noticeably." - Am I right in understanding that you are not going to introduce any other ways to optimize these processes yet? I am a person far from the code and it is difficult for me to judge, but it seems to me - correct if I am wrong - it would be possible to carry out the work of this code at the time of the player's call by making a cooldown of diplomatic actions, and the AI could directly interact with the factions in the tribe, so that do not overload the simulation. I could misunderstand the meaning of the sentence, since I translate everything through Google's auto-translator. Sorry for the inconvenience.

(+1)(-1)

Hello Werdin!

So, the values that I need to calculate can be calculated on demand when the player performs the action. The game is currently designed to stop simulating until all decisions are resolved. So I could use a naïve algorithm to calculate those values. What the player would experience is one second pause (approximately) while the game calculates the values before presenting the player with a choice. This doesn't seem like big deal, but this precludes me from ever using that same algorithm in situations that do not involve pausing the game.

What I want (and I already have a solution in mind. I just haven't written the code yet) is an algorithm that updates those values on-the-fly while minimizing the recalculations. This way, the values will be already calculated before the player performs the action and there will be no delays in presenting the player with a choice. If this works, then I will be able to use that same algorithm in situations that do not require the simulation to pause.

Like I said, I already have a solution in mind. It's not perfect and will require a bit of work. But it's a decent solution that solves the bigger problem: What I need is something that gives me the bounds of a polity (in map squares) without going through every cell. That is, without doing 'n' checks (where n is the number of cells in the polity). If my solution works, I will be able to do it by performing roughly sq(n) checks (where 'sq' is the square root). Also, this is an operation that I will only need to do very occasionally. 90% of the time, I will only need to perform one check when I need to update the bounds of the polity.

(-1)

Your comment is really expanded, and I am glad that you responded. Thank you very much, now it became a little easier for me to understand and present your choice.