Movement Rules in the dll

Thunderbrd

C2C War Dog
Joined
Jan 2, 2010
Messages
29,979
Location
Las Vegas
I said:
Could it be done easier by simply tracking a Z axis placement for the unit on the plot? Another reason for the setup was to eventually (very soon) enable a High Altitude Hovering layer and an Underwater (perhaps more than one) layer for more intricate late-game naval maneuvering. If it could be more generalized to a Z axis tracking effect, perhaps visibility and grouping rules for units could be more streamlined.

A bit more involved solution but ultimately, after some thought, it's the point of the sea tunnel interaction differences as they are now.
Alberts said:
Ok if they are essential they stay but it will be lots of work to really fix them. Maybe there is a simple solution but at the moment i can't think of one. Whatever it is it can only have an tiny impact on the turn times and memory usage because of the huge numbers of plots and units in the game. That means turn times should get faster as they are now with your changes because otherwise C2C will become even more unplayable.



I figured we should open up this discussion to those who have some know how in the code.

So the main problem here is that the original method of quickly determining combat interaction was:
1) Can your unit attack?
2) Is the unit your unit is moving onto visible (by you, the player, thanks to the whole sum of visibility accessed by all units and other causes, not specifically if the UNIT could see the other) and an enemy?
3) Yes - Attack, No - Allow overlap.

We were shortcutting a lot of obvious possibility here for the sake of incredible simplicity that was speeding up the evaluation of unit possibilities in the code.

Admittedly there were a few more complexities to the above but simplified that's pretty much it.

What I've done was introduce:
1) Can your unit attack?
2) Is the unit your unit moving onto visible (to the unit) and compatible with the state of the unit to enable an attack and an enemy?
3) Yes - Attack, No - Allow overlap.

For all that we want to enable and allow strategically, both of the critical changes are necessary.

The problem is how to simplify this.

I wanted to allow:
1) two units that aren't able to attack, despite being enemies, capable of sharing the same space
2) units that are specifically able to be attacked while not attacking when moving into a space with an enemy yet still being allowed to do so.
3) Layers of existence that can exist on a particular plot that would not allow for combat interaction between units that could see each other and were enemies, despite enabling the sharing of the same space (tunnels/hovering layers/submerged yet differing from being a land unit in a tunnel etc...)

And probably more I can't think of at the moment.

Is there an easier way and faster way to enable this kind of movement rule changes becomes the question. And this is the forum to suggest methods.
 
If you are going to add another dimension to the plot ie Z. It would be useful to add another as well for map. It is something that is needed if we are going to implement multi-maps. I think, I have figured where about the python would need to change to support this.

I assume the Z would not be used in the display at this time.
 
Is it possible to make units invisible if they are on a certain tile? For example, Hunters are only invisible in Forests, all land units are invisible while on a tile with a tunnel...?
 
Do we have temporary promotions yet? I know other mods have them (eg. FFH). They even have mission buttons that remove one promo and replace it with another (FFH ship cargo configs). That may not be relevant, but it's an example of what's possible...

If we do, we can give units in tunnels a promotion that makes them 'invisible' (a new type of invisible) to the other domains.

How doable is that?:)
 
My time is limited at the moment but i have a few things to consider.

  1. How to handle units in tunnels next to each other built by different players.
  2. There are other things that need to be aware of those rules e.g. city danger evaluations.
  3. The impact on turn times in a worst case szenario like six stacks with 2500 units per stack atacking each other.
 
First of all, this is just a discussion at the moment. But it does bring up some very interesting points.
If you are going to add another dimension to the plot ie Z. It would be useful to add another as well for map. It is something that is needed if we are going to implement multi-maps. I think, I have figured where about the python would need to change to support this.

I assume the Z would not be used in the display at this time.
It's basically there already thanks to Koshling's work on Multi-Maps. There's 2 hurdles in the code though:
1) Getting someone to understand how it works enough to continue making adaptations that support it.

2) Making sure it hasn't already been messed with by recoding efforts since.

As for Z, It would be an answer to some things. While it seems like it would be an up/down measurement, I'm thinking it would really be a numeric indication of the 'state', or 'plane' of the unit. Units would not be able to interact with each other if not on the same 'plane' (except for perhaps some missions might allow some interactivity.)

In theory it would potentially simplify some things. I'd probably want the unit hover to either show the plane, or for the player to only see units on the board in one plane at a time with a toggle arrow to traverse through them. Perhaps it would be interesting if the Z display for the unit was modified by the Z plane its on. I'm not sure - and it plays heavily into python considerations which is one reason I avoided this approach.

This also doesn't answer everything, like the defensive only or invisible unit interaction. I do not know how much of the slowdown Alberts has found is a result of that.

Is it possible to make units invisible if they are on a certain tile? For example, Hunters are only invisible in Forests, all land units are invisible while on a tile with a tunnel...?
I had thought of requiring tunnels to connect to cities and they could not be entered anywhere else. Entering the tunnel would be an action like boarding or unboarding. When in the tunnel, the unit would be invisible.

Problem is, I wanted enemy units that met down a tunnel to be able to fight there. Imagine an enemy unit picking away at your city and there's nothing you can do to make it visible. So if I were to make them visible to each other, the old 'rules' would trump the whole intent because at that point naval units would interact with the units in the tunnels. Old rule: If any of your units can see an enemy unit, any of your units that can attack at all, can attack it.

So I got away from this line of thinking.

Do we have temporary promotions yet? I know other mods have them (eg. FFH). They even have mission buttons that remove one promo and replace it with another (FFH ship cargo configs). That may not be relevant, but it's an example of what's possible...

If we do, we can give units in tunnels a promotion that makes them 'invisible' (a new type of invisible) to the other domains.

How doable is that?:)
See the last comment.

My time is limited at the moment but i have a few things to consider.

  1. How to handle units in tunnels next to each other built by different players.
  2. There are other things that need to be aware of those rules e.g. city danger evaluations.
  3. The impact on turn times in a worst case szenario like six stacks with 2500 units per stack atacking each other.
1) Is the big one that puts us in a position of needing to cause the potential for slowdown. Moving away from, if any of your units can see it, any of your units can attack it (which is just a HORRIBLE simplification sadly) seems to be the root of the issue here.
2) That probably plays into making things a lot more complex for the code with any other approach yeah.
3) Keeping units in a particular Z phase state unable to group with units that aren't may be a key element to helping with this.
 
My time is limited at the moment but i have a few things to consider.

  1. The impact on turn times in a worst case szenario like six stacks with 2500 units per stack atacking each other.

Do stacks really get that big? If so, at some stage it's going to get impossible to process all that quick enough, is it not?

Is there ever any need for stacks that big? If not we could enforce a units per tile of 2-300 or so...

Come to think of it, there is already a BUG option of units per tile isn't there? I somehow think if someone has 2500-unit stacks interacting, and they don't turn that option on, then perhaps they like waiting multiple hours between turns...:p

I had thought of requiring tunnels to connect to cities and they could not be entered anywhere else. Entering the tunnel would be an action like boarding or unboarding. When in the tunnel, the unit would be invisible.

Problem is, I wanted enemy units that met down a tunnel to be able to fight there. Imagine an enemy unit picking away at your city and there's nothing you can do to make it visible. So if I were to make them visible to each other, the old 'rules' would trump the whole intent because at that point naval units would interact with the units in the tunnels. Old rule: If any of your units can see an enemy unit, any of your units that can attack at all, can attack it.

So I got away from this line of thinking.

Yeah but TB I said invisible to other domains. Land units from different nations could still interact in the tile.
 
1) Is the big one that puts us in a position of needing to cause the potential for slowdown. Moving away from, if any of your units can see it, any of your units can attack it (which is just a HORRIBLE simplification sadly) seems to be the root of the issue here.

The simplification is already there, in that if you have two adjacent tiles of tunnels, they are assumed to be connected. And a tunnel is assumed to be connected to all adjacent land tiles, no tunnel mouth location is defined.

I say let the not-so-horrible simplification stand, that all adjacent tunnel tiles are connected, no matter who owns them. You will still be unable to access your neighbour's tunnel in peacetime without Open Borders (actually that's only if it's in their culture... or do tunnels have to be?).

And to be clear I am not saying that ships and aircraft can attack units in tunnels - that's a separate issue. Here I'm just dealing with the question of "which tunnels are connected?".
 
Do stacks really get that big? If so, at some stage it's going to get impossible to process all that quick enough, is it not?

Is there ever any need for stacks that big? If not we could enforce a units per tile of 2-300 or so...

I'd say so, too. If stacks get THIS big, this is more of a balance issue and unit costs in later eras need to be drastically increased. Or better, the costs for an army this big needs to be adjusted aswell.
 
Do stacks really get that big? If so, at some stage it's going to get impossible to process all that quick enough, is it not?

Is there ever any need for stacks that big? If not we could enforce a units per tile of 2-300 or so...

Come to think of it, there is already a BUG option of units per tile isn't there? I somehow think if someone has 2500-unit stacks interacting, and they don't turn that option on, then perhaps they like waiting multiple hours between turns...:p


<snip>.

Yes they do. Talin's savegame that has made it to the Industrial Era plainly shows it. (Savegame is in the Bug thread).

The BUG Option about Stacks Koshling warned about this very problem of outrageous stacks forming several years ago. Don't set too high (10-20 was the highest he advocated at the time) or at -1 (unlimited). But this was never put out In the FAQ and soon players that never saw the thread that discussed this continued to leave at -1. It seems to me it would've been much easier to put a Warning hover over for this Option at -1 Unlimited was Not Recommended. Neve was done because back then getting Hover Overs to show up right seemed to be a Problem.

That reminds me to recheck my settings on that BUG Option as there have been changes that may have "cleared" the setting.

Now back to your regular scheduled discussion on keeping Tunnels and Movement Rules.

JosEPh
 
I'd say so, too. If stacks get THIS big, this is more of a balance issue and unit costs in later eras need to be drastically increased. Or better, the costs for an army this big needs to be adjusted aswell.

This is maybe over reaction when a simple adjustment to the Stack Limits in BUG Option would reduce this type of behaviour. You are not going to stop Deity Players from amassing huge amounts of :gold: while at the same time the Noble level player is drowning in a sea of Red Ink ( On Strike). And those Deity players that insist on playing Eternity Gamespeed just exacerbate the problem.

JosEPh
 
Yes they do. Talin's savegame that has made it to the Industrial Era plainly shows it. (Savegame is in the Bug thread).

The BUG Option about Stacks Koshling warned about this very problem of outrageous stacks forming several years ago. Don't set too high (10-20 was the highest he advocated at the time) or at -1 (unlimited). But this was never put out In the FAQ and soon players that never saw the thread that discussed this continued to leave at -1. It seems to me it would've been much easier to put a Warning hover over for this Option at -1 Unlimited was Not Recommended. Neve was done because back then getting Hover Overs to show up right seemed to be a Problem.

That reminds me to recheck my settings on that BUG Option as there have been changes that may have "cleared" the setting.

Now back to your regular scheduled discussion on keeping Tunnels and Movement Rules.

JosEPh

Okay so it happens, but in a tiny minority of cases. Admittedly my Aotearoa game is only on a Large map, but in Modern Era I only have (as by far largest civ) under 4000 units. And I would never have a reason to stack more than 100 or so in a tile.

So as I said, when your stacks get above 200 or so (ie. in one game in a million), that's the time to turn the unit per tile limit on. Not to enforce it against every player in ancient who is lucky enough to have got 30 units together for a rush.:rolleyes:
 
So as I said, when your stacks get above 200 or so (ie. in one game in a million), that's the time to turn the unit per tile limit on. Not to enforce it against every player in ancient who is lucky enough to have got 30 units together for a rush.

I don't quite get the last part about "enforcing it". If you can muster 30 units in ancient why do they all need to be on the same tile? The 10-20 range was koshlings suggestion not mine. I took it as just be reasonable about how many units you put on a tile. Maybe you can take that same inference too? Maybe?

JosEPh :)
 
Okay so it happens, but in a tiny minority of cases. Admittedly my Aotearoa game is only on a Large map, but in Modern Era I only have (as by far largest civ) under 4000 units. And I would never have a reason to stack more than 100 or so in a tile.

So as I said, when your stacks get above 200 or so (ie. in one game in a million), that's the time to turn the unit per tile limit on. Not to enforce it against every player in ancient who is lucky enough to have got 30 units together for a rush.:rolleyes:


It's a good worst case szenario.

Since Size Matters it is even possible to split units so not only production causes high numbers of units.
 
It's a good worst case szenario.

Since Size Matters it is even possible to split units so not only production causes high numbers of units.

It's good to know that it can happen - now we can tell players: put a unit per tile limit on long before this happens, or deal with waiting several hours between turns.

I don't know if tile limits can save Talin's game - it may be too late. But it is an extremely rare occurrence that the mod cannot be expected to cater for.

I suggest that stacks of more than 150-200 (okay this figure is negotiable) add nothing to the game, so take this as your worst case, rather than setting yourself to do the impossible.
 
It's good to know that it can happen - now we can tell players: put a unit per tile limit on long before this happens, or deal with waiting several hours between turns.

I don't know if tile limits can save Talin's game - it may be too late. But it is an extremely rare occurrence that the mod cannot be expected to cater for.

I suggest that stacks of more than 150-200 (okay this figure is negotiable) add nothing to the game, so take this as your worst case, rather than setting yourself to do the impossible.

And maybe set the max units per tile to 200 as default with a warning.
 
And maybe set the max units per tile to 200 as default with a warning.

I would suggest a bit lower like no more than 100. You could still conceivably have, with this limit, 800 units surrounding a city.

JosEPh

EDIT" Max units per tile has a Range of 0 to 100 already. The 0 means Unlimited and in the working files is represented by the -1 I was referring to.

I try to keep mine at 20, but with the last SVN update I did (alberts2 last fixes) I forgot to save my User Settings Folder and overwrote it with the default Empty one. SO I had to reset ALL my settings again and then Save and then resave to lock them in.

See Screenies.
 
The AI does not understand stack limits at all.

-1 is the only recommended value as it is the only value the AI understands and does not cause infinite loops. (Waiting for Civs) eg the AI makes a unit in a city which can't stay in the city because of the stack limit but can't move to any other terrain because they are full or are of the wrong terrain type (sea for land units...)

If you get a Waiting for Civs infinite loop you need to set the stack limit to -1 for a few turns before you turn it back to what ever value you had it on.
 
Yeah but TB I said invisible to other domains. Land units from different nations could still interact in the tile.
Invisibility to a particular domain may be a way to simplify. But it still opens up the main degree of complexity, which is an evaluation of can my UNIT see your unit or not - not can any of my units see your unit or not. The distinction is profound when you consider that it has never been made previously and that the real processing shortcut in use prior to these changes was to track only what the player's worth of units can see or not with rare recalculations of the whole map and once done, if your unit can attack and the enemy is among those visible to the player is all that was ever determined to decide if the attack could be made, the visibility determination made very infrequently, not each time a unit wanted to determine if it could attack.

It's a little hard to explain. I hope I've been able to express it effectively. In short, this means that even making a unit invisible to a particular domain may well not bring us back to enough efficiency. Perhaps it would help to explain that the whole of the code assumes that if an enemy unit is visible to any of your units, it is visible, and thus attackable, to them all, regardless of the domain, what types of units they are, gamestates, etc... and the biggest delay generating hitch here is trying to break that rule at all. As soon as you do, you have to let each unit figure out if it can attack a particular unit or not. This is the basis of the problem.

However, it's similar to the answer I was considering with the Z layers perhaps. With that method I was thinking that visibility determinations may be able to be made just as infrequently as it ever was but made for each Z layer and those Z layers isolated in the attack considerations.

Perhaps, then, you can see how,
The simplification is already there, in that if you have two adjacent tiles of tunnels, they are assumed to be connected. And a tunnel is assumed to be connected to all adjacent land tiles, no tunnel mouth location is defined.

I say let the not-so-horrible simplification stand, that all adjacent tunnel tiles are connected, no matter who owns them. You will still be unable to access your neighbour's tunnel in peacetime without Open Borders (actually that's only if it's in their culture... or do tunnels have to be?).

And to be clear I am not saying that ships and aircraft can attack units in tunnels - that's a separate issue. Here I'm just dealing with the question of "which tunnels are connected?".
Isn't addressing the issue. The issue is the moment where we say its possible for one of your units to be able to attack a unit, but not all of your units may be able to. The game code has always assumed that if one can attack, all can, and where it may not seem this way you'll find its because its quick to establish that some units cannot attack at all - that doesn't cause the unit to have to evaluate the enemy - it's a factor on the unit taking action, and thus checked quickly and patently.

The same problem would exist if you wanted to make it possible for say, only hunters, to attack animals. (Not saying you'd want to) The code has never allowed a gamestate of the enemy unit to determine attackability for some units and not for others.

Since Size Matters it is even possible to split units so not only production causes high numbers of units
Something isn't quite right about how it's working. It's enabling units to split under conditions that units should've merged to compensate but don't. This is incorrect but I can't find the logic flaw. It shouldn't split any units until 4 units that can merge with each other are on the same tile and thus naturally 3 of them merge and one of them splits. Then, when this process has caused enough 'lesser' size units to co-habitate the same space that they reach again that magical count of 4,3 merge and 1 further splits. Without a merge being legal, a split shouldn't take place. But if a split is not legal (min size) then a merge should still be able to take place. This was intended to eventually weight a bit towards merging over splitting. 4 units thus should never split into more than 4 units since 3 merge into one and 1 is left to split into 3 making it still 4.

However, there's also the attempt units may make to split to fit onto a transport. I rather figured that once they were dropped off the above method would stratify them towards a greater amount of merged units again.

But something's not quite working about all that and sometimes you see huge amounts of split units. This shouldn't even be possible for so many split units to be on the same tile without merging as soon as they can. I don't know what's not working right there... maybe you can spot it.

This was intended to be a base rule for the AI from which some more advanced splitting and merging might take place to react to or plan for a situation for specific unit types, more often this would mean merging than splitting.


I wonder if assigning to units the basic chart base values as was redetermined in the modder's documentation recently would help to balance unit production. And then again, the AI shouldn't WANT to build such amazingly large stacks either. it's simply bad strategy to be that over the top because at a point it gets economically impacting and if they were to have that many units, it should be in more large stacks rather than less gargantuan stacks, some being held back as reinforcements or sent towards other targets to split enemy focus. It's also a bad strategy since there's nukes and so much that can quickly tear down the whole stack on one specific tile.

aka, stack limits are a poor bandaid for what's basically AI and game balance flaws.
 
The AI does not understand stack limits at all.

eg the AI makes a unit in a city which can't stay in the city because of the stack limit but can't move to any other terrain because they are full or are of the wrong terrain type (sea for land units...)

Why can't the AI be recoded so that it does not try to build a unit if the stack limit in a city is already reached. Or is this in the unobtainable part of the code? Just asking.:confused:

Something like:

If units in city = stacklimit
Do not select a unit
select a building/wonder etc.
else select anything.

I am assuming the dispersal code to move units out of a city works.

This is just a quick thought. :)
 
Back
Top Bottom