• Welcome to SC4 Devotion Forum Archives.

How to make automata follow routes? By blockers or attractors?

Started by littlewhitebutterfly, January 12, 2011, 01:46:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

littlewhitebutterfly

Troubles with automata -again! :) Apparently, unlike "regular" trucks generated by factories, the trucks generated by LUA files just ignore blockers, they pass through TE lots that should allow transit only to cars and peds. So I tried to go around the problem and added an attractor to the LUA file, taking example from the one for school children. However, even the attractor doesn't seem to work at all, as trucks keep turning at random and ignoring the target. Let's say I plop a generator on a tile and the attractor 15 tiles away on a straight road with lateral streets. The trucks take every possible side street and hardly ever get to the attractor. On the NAM automata-tuning file I set the number of look-ahead tiles just to 15, but it apparently has nothing to do with the problem.
Is there a command line I can add to the generator script so that a specific group of automata "see" blockers and don't go through?
Alternatively, how do I get attractors to work? Many thanks, hope you can help :)

vil

Blocking trucks usually means blocking truck paths, not truck automata.

Anyway "trucks" generated by custom LUA files dont usually have the truck occupant group but rather are just generic automata with a special OG (so that a particular LUA will spawn them, while generic industrial buildings will not). They may look like trucks but the game doesnt know they are trucks.

If youre trying to attract these "trucks" you have to attract the correct automata_group

I tried this for Simgoobers Pepsi plant "trucks":

{
   strength = {100,100},
   
   radius = 400,            -- influence radius, in meters
   automata = { "pepsi_semi" },      -- automata_groups this attractor affects
   behavior = {               
      {   
         radius = 30,
         state = BehaviorState.DISAPPEAR,
      },
   },
}

And it works, which was a welcome surprise for me, as LUA most often doesnt like me enough to work.

Theres no pathfinding, the behaviour of the automata is that of a blind mouse in a maze, but they try to get there until they succeed or run away (get out of range, miss the target and have no way to turn around).

littlewhitebutterfly

#2
Hi Vil, thank you for replying. :) Now I know why my LUA trucks ignore blockers: they are not generated by factories so they do not look for the exit and don't have path finding: got it! So nothing can be done about them.
However I wonder why my custom busses, which replace the in-game ones, have the same occupant group (4200) and are generated by bus stops (1926), still ignore bus blockers. They should look for other stops and have a path finding, right? Freight trucks automata change route altogether when I plop a blocker, and I do mean the automata, not just the real route; whereas busses totally ignore their specific blocker.  &mmm
There is also a problem with attractors: even when I create attractors for a specific group ID, the automata apparently don't get there any sooner or more often than without any scripts. I thought attractors may be a different way to have busses travel from stop to stop, however in this case the trouble may also be that the stops should work both as generators and as attractors which perhaps is not possible, is it?
Lastly, could you please suggest some more possible behaviour states, besides DISAPPEAR, DEFAULT and QUEUE? It would be great for testing. Again thank you!

vil

Actually i should not have said the trucks that follow paths are generated by buildings. I should have said they appear along paths. So when you block a path you stop automata from appearing in certain places.

Once automata appear they seem to take random turns (ive looked at cars, busses and trains), the only exception i can see are trucks (the ones that do spawn along paths then follow them). With busses and cars there may be a difference between those spawned by lots and those that appear along paths, but im not sure about the details - my interest has been roused however. :thumbsup:

States:
BehaviorState = {
   DEFAULT = 0,               -- resume default behavior (e.g. walk or drive along road paths)
   DISAPPEAR = 1,            -- fade out
   BEE_LINE = 2,               -- break from paths and head straight towards/away from attractor
   CROWD = 3,               -- stop at current location, watch attractor
   QUEUE = 4,                  -- line up along closest path and wait
   STRIKE = 6,               -- striking sim behavior
   IDLE = 7,                  -- wait for some event
   RIOT_LEADER = 8,               -- move in random directions in riot mode
   RIOT_FOLLOWER = 9,               -- follow another automaton in riot leader mode
   SCRIPTED = 10,                -- tick behavior implemented by a lua script
   RANDOM_WALK = 11,       -- move in random directions
   IGNITE_OCCUPANT = 12, -- used for arsonist automata, USE WITH CAUTION :) 
(SIC)
   PLOP_JUMP = 15,         -- jump in response to a building plop (special purpose event)
   PLAYER_DRIVE = 16,      -- controlled by player
   BUMPED = 17,               -- collided with another automaton
   MAGNET = 18,               -- pulled towards (or away from) attractor, regardless of elevation
   COLLIDE = 20,         -- vehicle is controlled by particle collision system
   PULLOVER = 21,         -- vehicle pulls to the side and stops
}


Attractors attract, but since there is no pathfinding, they dont work very well. Automata trying to head towards an attractor only appear to look 1 square ahead so they can easily miss their target (even repeatedly)
And you have to remember that the game grid is square, so only 4 directions really exist (even if it looks like there are diagonals) so sometimes even a diagonal that is actually aiming away from an attractor may appeal to an attracted automaton. The diagonal is actually a "staircase" and if the first step looks good... :satisfied:


littlewhitebutterfly

Awsome list, thank you!  :thumbsup: I tried QUEUE, BEE_LINE and MAGNET, but there's no way bus automata follow any routes even with straight intersections, so I guess it's like you said: the only exception to random wandering is trucks that appear along paths, and perhaps commute cars.
While we are at it, I would like to better understand how some properties may affect automata behaviour, in particular:
-Occupant Trip Noise Range
-Path Lookahead Tiles
-Spawn/Recall and Congestion to CPS  -I thought I knew what the latter ones are for, but when I change their values I don't seem to get effects on the game. Was trying to increase traffic on roads and highways without resorting to traffic generators, but automata just don't appear. Come to think now, I get scarce effects even when I vary the traffic settings on the default Options panel. Perhaps my computer is simply not powerful enough to handle a higher number of automata? &mmm