You must be logged in to post messages.
Please login or register

Caesar III: Game Help
Moderated by Granite Q, Gweilo

Hop to:    
loginhomeregisterhelprules
Bottom
Topic Subject: Walker behaviour
posted 04-15-01 18:34 ET (US)   

Inspired by my analogous work for Zeus, and to satisfy my own curiosity, I decided to investigate the behaviour of random walkers in C3. Of particular interest for me was the length of a random walkers patrol, since this has ramifications for the design of housing blocks.

The structure of the test was as follows: a long road was constructed, and buildings placed at one end of it, such that their entry/exit point was unambiguously fixed as the end tile of the road. To aid counting, small statues were placed at five tile intervals along the side of the road. The length of the patrol was marked using a plaza tile. As you shall see, my results were gratifyingly simple. For the sake of Forum effectiveness, they will be posted in the first reply. Any comments and corrections are most welcome.

Alan

[This message has been edited by Caesar Alan (edited 04-15-2001 @ 06:37 PM).]

Replies:
posted 04-15-01 18:39 ET (US)     1 / 14  
General Considerations
In all of my observations, which spanned several game years, I only observed four different lengths for a random walker patrol: 52 tiles, 43 tiles, 35 tiles, and 26 tiles (in all cases, this does not include the tile on which the walker is spawned). Each walker exhibited two patrol lengths, which I shall call the short and long patrol lengths. The long patrol was always in the length bracket immediately above that of the short patrol (i.e. if the short patrol length was 35 tiles, the long patrol length was always 43 tiles; if the short patrol length was 43 tiles, the long patrol length was 52 tiles). Over a period pf time, the walkers would make a long patrol approximately once in every four journeys.

The situation becomes rather more complicated when the walker is permitted to emerge from the building and head in either direction. Although the patrol lengths did tend to follow the 3 short: 1 long pattern described above, there was no discernible pattern in the combination of patrol length and direction. Sometimes walkers would repeatedly exit the buildings in the same direction, while on other occasions they would exit in either direction with almost equal probability.

Specific Patrol Lengths
The following table lists the long and short patrol lengths for all the random walkers found in the game

WalkerLong Patrol

(tiles)

Short Patrol

(tiles)

WalkerLong Patrol

(tiles)

Short Patrol

(tiles)

Prefect5243Barber3526
Engineer5243Bath Lady3526
Actor* 4335Doctor3526
Gladiator* 4335Surgeon3526
Lion Tamer* 4335Teacher3526
Charioteer* 4335Librarian3526
Tax Collector4335Market Trader3526
Priest3526Labour seeker3526

* These are the entertainment walkers generated by the venues, not those generated by performer schools, which do not behave as random walkers.

Conclusions
The most important ramification of this information is in the design of Housing Blocks. The furthest distance that you can rely on most walkers travelling is 26 tiles. Consequently, closed loop designs with a loop less than or equal to 52 tiles should guarantee walker coverage from every building except Schools (Schoolchildren do not behave as random walkers). Industrial blocks based on a 52-tile or less loop should also guarantee labour access provided there are sufficient houses (2 or 3 should suffice) on that loop.

Caesar AlanThe Appian WayThe Trojan Horse
CityBuildingContests.net
"Don't be frightened little sheep. I won't hurt you... much."

posted 04-16-01 03:49 ET (US)     2 / 14  
Nice work (as usual), Caesar Alan.

City design would be considerably easier if we were certain that random walkers would always take 1 long walk in every 4. Did you make enough observations to be fairly certain that they do? As I expect you know, Pharaoh random walkers usually take 1 long walk in every 4, but sometimes (depending on location, road network, and maybe other things) they don't. I had assumed that Caesar III random walkers behave the same as Pharaoh random walkers (as they apparently do when choosing which direction to start walking), but maybe C3 walkers are simpler.

The most important walkers for housing block design are typically market traders, especially for goods-using houses. Houses that use them stock only a 2-month supply of furniture, oil, and (usually) wine. Since the interval between walks is more than a month in a good-sized housing block, to guarantee stability a market trader must pass by all houses on every walk. (Also, to guarantee stability, a good must never run out in all markets, but that's another issue.)

Even if a random walker returned to its spawning point, a 52-tile road loop is too long to guarantee that random walkers will go around the loop each time, since after 26 tiles the distance back to the starting point is the same in both directions. And, since the starting and ending points of the walk are often not the same, in a 50-tile loop random walkers may return the way they came, as I've seen. (I discuss Pharaoh random walker start and end points in Random walker start and finish points, and it appears to me that most Caesar III random walkers behave similarly.) Even a 48-tile road loop could be too long, although I don't recall ever checking that size loop. I'd expect non-school random walkers to always circle a 46-tile or smaller loop, but I wouldn't be too surprised if an exception was found, since I don't know the formula for calculating road distances.

[Edit: fixed broken link]

[This message has been edited by Brugle (edited 09-18-2009 @ 06:39 PM).]

posted 04-16-01 17:27 ET (US)     3 / 14  
Thanks for your observations, Brugle. As usual, they are to the point. As you doubtless already suspected, I cannot confirm that walkers will always make a long patrol once every four times. They appear to do so most of the time, but even in my limited tests I observed walkers making four or more back-to-back short patrols. Irritating.

The point you make about loop size is also well made. I wouldn't be at all surprised to see 46 tile loops failing under extraordinary circumstances!

Caesar AlanThe Appian WayThe Trojan Horse
CityBuildingContests.net
"Don't be frightened little sheep. I won't hurt you... much."

posted 04-16-01 17:57 ET (US)     4 / 14  
Once again, my memory is a little fuzzy and I really should know better than to post here without first re-testing, but here goes.

I had performed virtually identical experiments (even the use of plazas and statues!) some time ago (version 1.0, no patch). My results were almost exactly the same. I had even built a 100-tile loop and had the prefectures and engineers go all the way around -- in non-desert climates, they completed the circuit in time to prevent buildings from burning or collapsing.

A significant difference in results is that the walkers would usually go the full length indicated by Caesar Alan's "Long Patrol" distance (not one time in four). But occasionally they would start off heading toward their source building, pause, and turn around. On these occasions they would go the distance indicated by the "Short Patrol". I wonder if the road's orientation (NE-SW vs. NW-SE) makes a difference along with which end of the road the building is on (my tests were done on NE-SW roads with buildings on the NE end), or if it is just another difference in the versions.

If I recall correctly, when I placed the source buildings in the middle of a length of road, the walkers always appeared on the same tile and always walked the "Long Patrol" distance from that tile. Caesar Alan, in your "mid-road" tests, did you measure the patrol from the walker's start tile or from the edge of the building?

As for school kids, they always appeared in the same place and always went by the same routes. Each went a different distance: 25 tiles, 20 tiles, 15 tiles, and 10 tiles (if memory fails me here, then they went 20, 15, 10, and 5 instead, or was it 25, 15, 10, and 5? ). Anyway, the location of the school determined the direction each kid went (sort of like whether or not four 1x1 houses form a 2x2). By carefully selecting the school's location, the two long-distance kids would run opposite directions and provide maximum coverage for a loop. For a 52-tile loop, coverage was usually only nearly complete with a few houses without coverage (I would replace those with non-housing).


quis enim ex vobis volens turrem aedificare non prius sedens conputat sumptus qui necessarii sunt si habet ad perficiendum
posted 04-17-01 01:44 ET (US)     5 / 14  
Good job, CA. I would measure something like that.
posted 06-28-12 20:29 ET (US)     6 / 14  
Hi,

I have been studying walkers recently. Below you will find some results along with a sav file that demonstrates a prefect which is not walking randomly.

Random walkers have two walking modes. I shall call them 'patrol mode' (following Caesar Alan good choice) and 'return mode'.

The differences between these two modes are as follows.

A random walker in patrol mode will;
1. always walk on all corner tiles.
2. change direction randomly every now and then
3. walk on gardens half the time
4. never walk through gatehouses

A random walker in return mode will;
1. always skip all corner tiles and will always chose to skip later rather than sooner
2. never change direction
3. always walk on gardens
4. always walk through gatehouses
5. always chose the shortest path

This image shows the difference regarding corner tiles for a prefect in patrol (it says upward in the image) and return mode.


The prefect will walk on blue tiles but will skip the white tiles (in return mode). There is a short road shown in red. Here the corner was skipped early but that won't happen because as long as it doesn't make the road any longer, the walker will chose the later tile to skip the corner as it is shown in the short blue road.

By the way, destination and forced walkers act the same as a random walker in return mode. They too will always skip corners and chose the later tile if there are two identical length options.

The prefect switches to return mode when his patrol is over. From Caesar Alan's great research we know that his short patrol is 43 tiles. If the road comes to an end before 43 tiles the prefect will turn back at the end and start walking towards his building but he will be still in patrol mode until he has finished walking 43 tiles.

The corner tile study is not an important issue by itself but it lead me to distinguish between the two modes.

Why is the return mode important? It is because after 43 tiles the prefect will stop and find the shortest way possible to return, going though gatehouses and walking on gardens. This means you can force a prefect to walk on a certain path that is important to you even if the path has a few garden tiles, a few granaries and a gatehouse. Normally the prefect would never walk straight through all of these let alone walking that path every time.

This also means you can force the prefect to walk in circles because in a loop if the shortest way to return is by walking forward then the prefect will always walk in a circle.

download circling prefect.sav

In the sav file you will see a prefect circling around a 12x39 block. This is a 98 tile loop with many small tents on it. The prefect will always walk in circles every time. I run it for 10 years and there was no fire.

This is the layout used in the sav file. The location of the prefect is unimportant. It could be anywhere on the loop as long as there is a gatehouse next to it.

Legend

[This message has been edited by Philon (edited 06-29-2012 @ 00:03 AM).]

posted 06-29-12 16:04 ET (US)     7 / 14  
Hi Philon,

You're way behind on walkers. Random walkers have 3 phases: going to their walk target, roaming for a while, and returning home. Any of these can be missing.

For random walkers, either read the paper written by StephAmon (linked from Predicting Roaming Walks, which is for Pharaoh walkers although C3 walkers are similar) or read the much abbreviated work by lemmus (aka Trurl) in reply #15 of Randomness of Random Walkers.

Some things which weren't described back then are now. For example, walkers who go 1 tile then come back are now understood (I think--I haven't looked at them closely) and walkers who come to an intersection while roaming around (I think--I haven't looked at them closely either). However, some things still aren't described correctly, but we are learning.

[This message has been edited by Brugle (edited 06-29-2012 @ 04:07 PM).]

posted 06-29-12 22:54 ET (US)     8 / 14  
Hi Brugle,

I'm sorry to hear about your health. I wish you a speedy recovery.

I had a look on both topics. These topics are about predicting where a random walker will go. This might be useful if you have many intersections. You would then put the building in the correct corner instead elsewhere so he will turn right instead left.

My study is not about that. I was particularly interested in the determination of a random walker in return mode and found a way to make use of that. When the walker switches to return mode, he always does only one thing: take the shortest way possible and return back no matter what is in the way, garden granary or gatehouse.

Now, I'm not too interested in where the walker will go during his patrol. The thing that I'm interested is where he will go during his return trip.

In other words, I'm using the return trip as the main path where he will serve.

I think the 98 tile loop with one prefect is a perfect demonstration on how you can make use of the return path determination. The gatehouse is used to leave only one direction for the prefect. The return mode is used to pass through the gatehouse.

We all know that random walkers normally don't pass through gatehouses unless they are in return mode. This means instead studying and predicting the randomness, you can use creative design with gardens and gatehouses and force the random walker to take them.

Here is another example:

In this industry block I needed the prefect to walk between the granaries and markets without getting lost in granary labirents.


In patrol mode the prefect might walk here and there and yes you could study that 29 page long document and predict where he will go but I don't need that. In return mode the walker does only one thing: go straight back. So I arrange the design and the lengths to make the return path work for me.
In other words, I make sure with the design that he doesn't return back where he came from.

In the farming block above it would be better to use a gatehouse between the blue granary and the prefects road. This would make it 100% efficient. However I didn't want to waste a building and with the garden separation it is efficient enough.

I had another situation where it was possible to provide fire and damage coverage to markets by walking through a gatehouse. I guess when working with forced walkers you have these kind problems. I'm just happy that I was able to solve it with the return mode.

[This message has been edited by Philon (edited 06-29-2012 @ 11:56 PM).]

posted 12-26-13 06:09 ET (US)     9 / 14  
Return Mode:
Here is a save file that demonstrates this topic: (Press F on your keyboard to switch to fire risk and watch the prefect)

prefect-in-return-mode.sav

The aim of return mode is to eliminate randomness of a prefect and force it to circle forever in every patrol. Why? Because in central climates the fire risk is high for small tents and if a prefect were to walk to a different direction even once, tents might catch fire.

In the example there is a lake with roads on both sides. The temple side and the oracle side are not road connected but are connected by a garden.

Why? Because sometimes you don't want a road connection. You might want to disconnect some farms or markets from a granary. But don't worry to much about disconnected paths. This method works on a connected loop like in the image above that shows a farming block.

In the save file the garden tile and the disconnected roads are to demonstrate that the method works even with disconnected paths but there is nothing preventing you from replacing all gardens with roads and it will continue working.

In this example it makes sense to have one granary on each side of the lake. You don't want a wharf to deliver to the other side. If they do, the wharf cartpusher wouldn't return back in time for the next fish delivery. So there must be no road connection between the two sides of the lake and only a garden connection is possible.

But gardens are bad for prefects. When a prefect comes to a garden they usually walk the other way. But here we want the prefect to take the garden path in every patrol. How can we do that?

Here is how:

When the prefect starts walking first he provides coverage for the oracle side. The prefect's patrol is either 52 or 43 tiles long. The garden tile is 33 tiles away. So he will definitely reach it.

When the prefect reaches the garden tile, he has two options: He can either take the garden and return from the temple road or he can continue walking upwards.

We can't control this option. It is random. But it turns out both options will work.

If he takes the garden path we have achieved what we wanted. We wanted the prefect to return from the temple road and he did. While he is in the middle of the temple road he will switch from patrol mode to return mode.

But most of the time he doesn't take the garden path which brings us to the other option. Let's assume the prefect passes by the garden. but now he reaches some dummy zigzag roads that were only added to waste his remaining patrol.

Then on tile 43 or 52 he finishes his patrol and switches to return mode. When it does the prefect is not a random walker anymore. It is a destination walker going back to the building.

Like all destination walkers the prefect will walk on gardens, through gatehouses, through granaries and will always, without exception take the shortest path possible.

So now when the prefects starts to come back from the zigzag roads towards the garden and is on the tile above the garden, he has to make a choice: He can either return from oracle side or the temple side.

This time the decision is not random. The prefect will always take the shortest path. Because the temple road is one tile shorter he will always return from there.

In this example the diagonal provided by the gatehouse makes the temple side one tile shorter.

[This message has been edited by Philon (edited 12-26-2013 @ 09:45 AM).]

posted 12-29-13 10:38 ET (US)     10 / 14  
When the prefect reaches the garden tile, he has two options: He can either take the garden and return from the temple road or he can continue walking upwards.

We can't control this option. It is random.
It may be difficult to predict without a knowledge of walker theory, but it is not random. Place a prefect next to your temple and you will see that on each occasion he sets off to NW he passes through the garden (because he is on the outbound walk to target and is in "destination" mode). When he sets off to SE he bounces back off gardens at either end (because he is in "patrol mode"). Place the prefecture a few tiles to the SE (next to the tents) and he won't pass through the single garden at all, though he will cross those at the other end every fourth walk. All this is entirely predictable and therefore not random.

I must say that studying your file I find it hard to see the point. If the dummy roads are removed and the gardens are replaced with roads the block works just fine. The gardens just make it more difficult to ensure adequate walker coverage as more buildings are added.

Maybe you just intended to demonstrate the principle, although use of "return" mode to make a walker take a different route home to the one he came out on is the very essence of "loop" design and is virtually as old as the game itself. The fact that returning walkers will pass through gardens and gatehouses is also well known.

[This message has been edited by Trium (edited 12-29-2013 @ 10:47 AM).]

posted 12-29-13 17:12 ET (US)     11 / 14  
Hi Trium,

Yes this was a simple demonstration on how the return path can be useful. This doesn't mean this technique can not be used for advanced designs.

The solution here was implemented after the fact. There were already two different road paths that needed a prefect.

What if there are many more buildings (wharves, wheat and fruit farms) and the block is not designed yet and you need to design it in such a way that one prefect will be enough?

An example of such a food block is shown in one of the images above. This is a little more advanced demonstration of return path.

However even that example is relatively simple because the wheat and fruit farms share a road connection. It gets more complicated if you want to disconnect them.

Why would you want to disconnect fruit and wheat farms that are in the same block? Because number of farm chartpushers is affected by the distance from farm to granary and if you want to keep these distances low you want wheat farms around the wheat granary and you want fruit farms around the fruit granary.

But now you can not road connect them because they are too far apart and market buyers couldn't travel between them. But you still want one prefect and one engineer because the 599 limit is going to be a problem.

Here is such a block I designed recently:


Notice how the return path was designed so that the prefect walks through the wheat and fish granary and provides coverage to all wheat farms, all wharves and the two markets.

I have a working sav file of this if interested. I later abandoned this design and switched to something else but you can see how the design focuses on keeping farms close to their granary and how this forces the granaries to be apart and why therefore you couldn't road connect all markets. I think it took me 5 hours to design and reduce the numbers to 108 and 34.

I have an excel sheet where I enter the distances of each farm and it calculates the number of cartpushers if I were to build the block. It is very accurate.
posted 12-29-13 20:51 ET (US)     12 / 14  
I should add that in the save file the garden is not supposed to be replaced with a road because the fishing lake represents a fishing block with granaries on both sides. I mentioned that you can replace the garden with roads but that would apply to a different situation.

Here if you road connect them, wharves in one side would deliver to the other side and markets from one side would buy food from the other too.

Yes you can use a single granary but that is not an effective use. Not only you are increasing cartpushers but you also lose production if you have more than 8 wharves.



The examples I gave for return path might be things other players will never build. But this technique can be useful in different situations and to me it is easier than random walker theory which I don't understand.

The design on right demonstrates the 6 tile addition rule.Wharves at the bottom are 7 tiles away from fishing point. 7+6=13 is the max they have to the reach the centre of the granary. You can't move the fishing point towards the centre of the lake to increase production because then they wouldn't reach the granary and you would lose fish that way instead. So two granaries are better if you have more than 8 wharves and obviously you can't road connect them.

[This message has been edited by Philon (edited 12-29-2013 @ 08:58 PM).]

posted 12-29-13 21:45 ET (US)     13 / 14  
Thanks for the explanations. Just one small nit-pick:
the 6 tile addition rule.Wharves at the bottom are 7 tiles away from fishing point. 7+6=13 is the max they have to the reach the centre of the granary
It's actually 14, since the boat travels 30x7=210 ticks + 200 ticks fishing and 10 ticks re-stocking = 420, so the next cartpusher spawn is 450 (always a multiple of 50). 14x30=420 + 8 ticks unloading at the granary = 428. The boat beats him back by 8 ticks, but it can't be unloaded until 450 anyway.

You can always add at least 7 tiles. If the distance to the fishing tile ends in 0, 3, 5 or 8 you can add 8.

[This message has been edited by Trium (edited 12-29-2013 @ 09:47 PM).]

posted 12-29-13 22:33 ET (US)     14 / 14  
Yes indeed. I remember now reading your research a couple of years ago. It is never 6 tiles. It is either 7 or 8 and the reason why others thought it was 6 was because the boat arrived before the cartpusher. That was a great discovery btw.

I think single granary will make more sense in population cities if I decide to build another one.
Caesar IV Heaven » Forums » Caesar III: Game Help » Walker behaviour
Top
You must be logged in to post messages.
Please login or register
Hop to:    
Caesar IV Heaven | HeavenGames