
What makes Knights and Merchants so good?
Well maybe we should move it to the TKE thread but ok..
1) wouldn't choosing the least-idle serf result in only 1 serf being in use?
4) while that would "solve" traffic jams, it would make the serves take long routes in order to avoid a serf that was planning to walk somewhere but isn't even near yet. And anyway, you don't really want to avoid a crowded place where there isn't a traffic jam (for example, a 2way road where everyone walks on the right side and thus avoids a jam, but all squares can be occupied).
4) serfs should never take longer routes, but only decide which alternative it'd take cause its possible paths was already planned out when you add a building. (or at least, in the model i suggested it would work that way)
And on the 2 way road: Yep, i realized it too, but after i posted the previous post xD 2 person traveling the same way with the same speed shall never collide assuming they arent stacked to begin with. I guess then path choice now only apply on routes with 1-width streets cause you can default *walkring to the right* on any 2-width streets.

Posts: 3822
Joined: 16 Sep 2007, 22:00
KaM Skill Level: Skilled
ICQ: 269127056
Website: http://lewin.hodgman.id.au
Yahoo Messenger: lewinlewinhodgman
Location: Australia
Hi,
I have an idea to add to fix traffic jams, especially at the storehouse. If you have a serf inside the storehouse that wants to go out and a serf outside the storehouse that wants to go in then they should "pass in the doorway". The storehouse is one of the worse spot for traffic jams and this would fix the problem of getting 20 serfs stuck inside your storehouse with no way out because the entrance is jammed. Serfs should avoid "bumping" troops out of their positions, if there is an easy way around. Also, many people use the "cheat" so that you only have to connect roads by the corners. (because the serfs will still use it) I never do this myself and I think that unless the roads all connect by edges then it is not a valid route.
Lewin.
I have an idea to add to fix traffic jams, especially at the storehouse. If you have a serf inside the storehouse that wants to go out and a serf outside the storehouse that wants to go in then they should "pass in the doorway". The storehouse is one of the worse spot for traffic jams and this would fix the problem of getting 20 serfs stuck inside your storehouse with no way out because the entrance is jammed. Serfs should avoid "bumping" troops out of their positions, if there is an easy way around. Also, many people use the "cheat" so that you only have to connect roads by the corners. (because the serfs will still use it) I never do this myself and I think that unless the roads all connect by edges then it is not a valid route.
Lewin.

King Karolus Servant
Posts: 2154
Joined: 29 Aug 2007, 22:00
KaM Skill Level: Veteran
Location: In his dark thunderstormy castle
That ''cheat'' isn't all to handy. Watch this: http://img522.imageshack.us/img522/4148/unhandysi3.png
The red line shows the way serves walk if they want to bring something to the southern storehouse.
The red line shows the way serves walk if they want to bring something to the southern storehouse.
rephikul: I get the impression that you want to store the path from any building to any other building, while that would save on path-calculations it would be quickly get out of hand size-wise - and keep in mind that roads can change (bypasses are made and alternative routes emerge etc, roads can even disappear)
if that intersection works as intersection then I'll have to change A* a bit to allow the unit to walk over grass for 1 tile..
if that intersection works as intersection then I'll have to change A* a bit to allow the unit to walk over grass for 1 tile..
rephikul: I get the impression that you want to store the path from any building to any other building, while that would save on path-calculations it would be quickly get out of hand size-wise
A* isn't all that slow, and caching rarely hurts - but the cache will have to invalidate all paths as soon as any building or road changes (it'd take more time to figure out which entries to invalidate than to recalc them) and caching all paths would result in a huge cache. Also, new paths aren't needed extremely often (only once a serf wants to start walking somewhere, or when it it blocked by something it didn't expect (such as a new building)) and most individual paths are rarely used (once or twice (in rare cases thrice) for each thing the building at one end of it produces)
Btw, with "all paths" I mean "all paths that are used at least once" (not paths from barracks to mills for example)
So now I must wonder, will a cache really help? Often-used routes are generally short (usually people build chained industries near each other, such as farm->mill->baker), the cache can not get big in a town that you still build at (due to repeated invalidation), each cache miss will only take longer than if there were no cache, and the cache must clean itself on invalidation (which adds to the fragmentation of the heap)
A simulated village made by snorro uses an average of 1% CPU time once it is loaded - the village is rather small but 1% is not a lot, and it even shows the graphics (except the terrain) so my guess is that that will work out rather well (the terrain does not add considerable CPU load, most work is done on the GPU). Military troops movement will add a lot more A* calls but they cannot really be avoided with caching. Military units are often idle, fighting, or already walking though, but if they Do need a new path it's often a long one that can "explore" a lot of the map because it isn't limited to roads. Could become difficult and probably needs queueing of A* calls to spread them across multiple updates..
Will try all suggestions though.
Btw, with "all paths" I mean "all paths that are used at least once" (not paths from barracks to mills for example)
So now I must wonder, will a cache really help? Often-used routes are generally short (usually people build chained industries near each other, such as farm->mill->baker), the cache can not get big in a town that you still build at (due to repeated invalidation), each cache miss will only take longer than if there were no cache, and the cache must clean itself on invalidation (which adds to the fragmentation of the heap)
A simulated village made by snorro uses an average of 1% CPU time once it is loaded - the village is rather small but 1% is not a lot, and it even shows the graphics (except the terrain) so my guess is that that will work out rather well (the terrain does not add considerable CPU load, most work is done on the GPU). Military troops movement will add a lot more A* calls but they cannot really be avoided with caching. Military units are often idle, fighting, or already walking though, but if they Do need a new path it's often a long one that can "explore" a lot of the map because it isn't limited to roads. Could become difficult and probably needs queueing of A* calls to spread them across multiple updates..
Will try all suggestions though.
Speak of troop movement, there's this thing i really hate but dont know how to solve cause i dont have any experience with formation, that's when a squad arrive at destination it'd try to form up, and usually the formation could be done real fast with dynamic troop location however the AI usually have a set place of a particular troop within the squad and take an annoyingly large amount of time to sort it out. If this problem would be solved i'd be happy even when you use the original KAM's troop movement where everyone move parallel with the flag bearer to cut down on path calc 

What makes KaM so good:
- realistic living world. Every unit action is reasonable and detailed (with perhaps very few simplifications).
- indirect control on economy/village. Partly indirect control on troops fighting.
- looks and music are great aswell
- overall feeling of not-so-fast gameplay, where else one mission could take 8hours
@rephikul: Yes, that is annoying, but closer to real-life where every soldier in squad knows his place. I guess instead they should act all together when re-forming to save time instead of everyone acting for itself.
- realistic living world. Every unit action is reasonable and detailed (with perhaps very few simplifications).
- indirect control on economy/village. Partly indirect control on troops fighting.
- looks and music are great aswell
- overall feeling of not-so-fast gameplay, where else one mission could take 8hours

@rephikul: Yes, that is annoying, but closer to real-life where every soldier in squad knows his place. I guess instead they should act all together when re-forming to save time instead of everyone acting for itself.
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
Btw, with "all paths" I mean "all paths that are used at least once" (not paths from barracks to mills for example)
So caching routes cannot involve caching only routes that are used once, because even that number is too large. In my opinion caching can only be useful if you cach the top most frequently used routes.
But still I'd recommend A*.
@rephikul:
That problem also bothered me, so I've set up a system for getting in formation. The system optimizes by making the longest route as short as possible, in other words, the squadmemebers will stand in formation as soon as possible, ignoring the index in a squad.
That problem posed a fun challenge, but it's working now.
So caching routes cannot involve caching only routes that are used once
only be useful if you cach the top most frequently used routes
But still I'd recommend A*.
Why not from the barracks to the mill? That path may be used frequently
Well I'll try it, who knows, it might give a speed-up - and if not, well, ctrl-z is not hard to find 
but the reverse route could be the same, depending on the roads (it could be that there is only 1 shortest route instead of multiple shortest routes where it would find an other one first when looking from the other end)

but the reverse route could be the same, depending on the roads (it could be that there is only 1 shortest route instead of multiple shortest routes where it would find an other one first when looking from the other end)
Who is online
Users browsing this forum: No registered users and 2 guests