[MOD 0.14] AAI Programmable Vehicles

Topics and discussion about specific mods
mrvn
Smart Inserter
Smart Inserter
Posts: 5877
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by mrvn »

Helickron wrote:
mrvn wrote:
Keio wrote:
Helickron wrote:Hey guys,
I've some severe problems with my fps/ups, although having a gaming laptop. AAI is just bending my laptop, giving it a hard time. Is there a thread or a list of tips how to handle that and what to avoid? I made some really nice complex setups, only to delete them afterwards.
If you watch Arumba and Steejo's "refactorissimo" campaign (around episodes 30-40ish), they go through making AAI more UPS-friendly... stuff like having timers so that commands are only sent to/from the programmable structures once every 5-10 seconds etc. https://www.youtube.com/watch?v=3d4WWdk ... U1HGufATF1
I also try to share control structures. So I have only one control structure to send a hauler to a miner and have it cycle through all my miners and haulers processing one per second. For ore mining you don't need to check often.
What I'm doing at the moment is reducing the update rates of my structures and their amount. The complexity is increasing but the UPS are too. Is there a difference between 2 buildings every 60 ticks vs. 1 building every 30 tick?
1. My biggest problem is the setup for my attack formation. Waypoints are calculated every tick for the formation. I've changed half of them to "follow unit id" which seems to work better overall. I'm thinking about changing it to a "set angle and speed" command, but I don't know how that should work properly.
2.My second project is redoing the zone scanner to not randomly scan tiles but going in circles. To be precise in squares.
3.Zone Cleaning is now done by a single setup and only for zone 1/101/201 where my miners are sitting.
4.I use 3 Haulers that drive to (circle through) every miner and then go back to the depot. Thats a mess. They are often stuck on the map, not moving anymore, not even searching for a path (seen in debug mode).
Every AAI building has an on_tick function that gets called every single tick. In that function it checks if the buildings tick count is reached and if not exits. So 1 building every 30 ticks will be faster since you avoid the on_tick lua call of the other building even if it just does on comparison.

1. For attack formations I really miss a cos, sin and atan2 function. I want a chaingunner at 60° 3m distance to the direction my warden is facing.
Maybe the unit controller could be extended to allow to set follow-unit-id, angle and distance to make units behave that way automatically.

I noticed that when you select multiple units with the remote control and set them to follow another unit then they will form a circle around that unit. So there already is some code there for this (just not relative to the direction the unit is facing).

2. I've made one that goes in a spiral where each new loop is 5m wider than the previous. I've also patched the zone tool to have buttons to mark zones as lines, alternative lines, spiral or hilbert curve. Will post patches soon.

4. It helps to play with water only in the starting area.
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 716
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Earendel »

@TopLad Aircraft support was working but it's done in a fairly generic way so changes have probably broken the flying detection. I will get that to work again, and hopefully getting complicated helicopters to work too, but that will wait till Factorio 0.16 comes out because with that release I can stop using dummy turret objects and will be recoding the way layers are done anyway. It just makes sense to do the changed once.
mrvn wrote:I want a chaingunner at 60° 3m distance to the direction my warden is facing.
Does specifying the warden follow-unit-id with a sub-x offset of 200 and sub-y of 300 do roughly what you want?
subbob
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Oct 11, 2016 3:32 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by subbob »

mrvn wrote:
subbob wrote:LUA Command to Delete all Zones?

I've been doing a lot of experimenting and have not been able to delete all of the zones I laid out manually. Some were in forests and not easy to visually locate.

Now that I've figured out a system, I'd like to start fresh with all zones deleted.a
I used 2 ways:

1) just mark everything with the zone tool using shift to delete zones. This assumes zones are not totally of the map so you can find the general area where they are at. And you want to delete all zone types.

2) Connect a constant provider (output zone) to a zone scanner (turn of the current zone, leave x/y) to a zone controller. Now one zone a tick dissappears. When the zone count reaches 0 you can turn it off. This takes some time and only works one zone type at a time.
Thanks. I think I finally removed them all manually. However I'll try that 2nd method just to be sure.
subbob
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Oct 11, 2016 3:32 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by subbob »

mrvn wrote:
Helickron wrote: 1. For attack formations I really miss a cos, sin and atan2 function. I want a chaingunner at 60° 3m distance to the direction my warden is facing.
Maybe the unit controller could be extended to allow to set follow-unit-id, angle and distance to make units behave that way automatically.
You could approximate those functions with a few decider combinators. I created this Google Sheet to demonstrate what I mean. That link includes permission to add comments.

In the Navy we used thumb rules based upon the range of angles.
subbob
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Oct 11, 2016 3:32 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by subbob »

Is there any documentation for this mod?

I'm old school, I'd much rather read text than watch someone's video. Short of looking at the actual code, is there any documentation for this mod?
Helickron
Burner Inserter
Burner Inserter
Posts: 9
Joined: Fri Apr 01, 2016 2:16 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Helickron »

Earendel wrote:Does specifying the warden follow-unit-id with a sub-x offset of 200 and sub-y of 300 do roughly what you want?
Ah that's great. Unfortunately it's crashing my game. Would anybody mind recreating the crash? I would like to know if it's only my problem. :cry:

Blueprint: https://gist.github.com/Helickron/11f42 ... 1b023d1918

Code: Select all

0eNrtXM2O2zYQfhcBvaR2KkoiKS3aQ7BJkR6CXnJIWmwNrc3dFSJLhixvYgR+gL5Hn6xPUsnWZv1DSt/QWjtpe0nglf2ZnG++4cyQ5mfnOl2oWZFkpXPx2UnGeTZ3Ln7/7MyT2yxO67+Vy5lyLpykVFNn4GTxtH51r+6ScaqGH+NiojJnNXCSbKI+ORdsNYA/PL6Lk+x2kWWq2ELwjkbwj0YIVlcDR2VlUiZqY4/1i+UoW0yvq3desC9A82mcpsNxPpupYvix+oJZPq8+lmf1V1dQQzlwlvV/Ffp9XCTx5tnaTnugnh401oAKGNTXgxYaUA6DBnrQiQY0gEG5HjTTgHowqNCDKg2oD4NKA1FFkX8caaBdGDnUI8+SmW7EDMaNYMJw0zIX9ld8oIzBoLhnMYOy7g9BcSdgPuyvuLCYQVnjQ1A8BDAOsx/ioLiy8AjIDMoa57c692/cigPAIQU4xHENwro1LwQCWAhcPGgLHNUgrYU5aiOoBm3l5gUGQTWIa2aO2wiqQV3MvMQgqNxuOUCghc16APitJ22AkRGHdsZAxhzBPoGT57uw++J+5huUNjcuYgioQWilcWlAQA06S4yLGAIawDYNcVAOjxQPtL6A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gzVgjVIKul8W5AyAIcloCLD5Vwwy/DUaXNgigQ5BB32WZFhGAjiyUGAWauxRoDARNUJnBU/JbEJnZDqD7uZAGOalDZ1BgTD1CvBpt7zS+27nEfOGl8raqc2HlRTJfDn/Niun7/s9cqTcYfirxeHe6rBHrTFwoCT0hfChGsVv8AOELODw==
Image
mrvn
Smart Inserter
Smart Inserter
Posts: 5877
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by mrvn »

subbob wrote:
mrvn wrote:
Helickron wrote: 1. For attack formations I really miss a cos, sin and atan2 function. I want a chaingunner at 60° 3m distance to the direction my warden is facing.
Maybe the unit controller could be extended to allow to set follow-unit-id, angle and distance to make units behave that way automatically.
You could approximate those functions with a few decider combinators. I created this Google Sheet to demonstrate what I mean. That link includes permission to add comments.

In the Navy we used thumb rules based upon the range of angles.
Hmm, decider combinators. So you would use 2 decider combinators to check if the angle is between 45-2.5 and 45+2.5 and then output 0.71. For 5° accuracy that would be 36 decider combinators and 18 constant combinators. Then add a few more to do angle % 360 and fold around 180° and 90°. So maybe 40 decider combinators, 10 arithmetic combinators and 18 constant combinators.

You call that a few? And you need that many for every cos/sin and atan2.
subbob
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Oct 11, 2016 3:32 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by subbob »

mrvn wrote:
Hmm, decider combinators. So you would use 2 decider combinators to check if the angle is between 45-2.5 and 45+2.5 and then output 0.71. For 5° accuracy that would be 36 decider combinators and 18 constant combinators. Then add a few more to do angle % 360 and fold around 180° and 90°. So maybe 40 decider combinators, 10 arithmetic combinators and 18 constant combinators.

You call that a few? And you need that many for every cos/sin and atan2.
Sorry I was not more clear. I bracketed it by 5 degrees to show the trends. I was thinking maybe (at the most) 4 or 5 ranges of degrees. I can't recall the thumb rules we used in the Navy for Target Motion Analysis (TMA), but I think it was only 4.
subbob
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Oct 11, 2016 3:32 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by subbob »

Direct vehicles with remote controller while occupied?

Would it be possible to provide option to use the remote control unit to direct a vehicles path while occupying it?
mrvn
Smart Inserter
Smart Inserter
Posts: 5877
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by mrvn »

subbob wrote:Direct vehicles with remote controller while occupied?

Would it be possible to provide option to use the remote control unit to direct a vehicles path while occupying it?
I think it would be best if vehicles had an automatic/manual slider like trains do. Sometimes I want to ride along with a vehicle and sometimes I want to override a vehicles programming, e.g. when they insist on driving over a belt and get stuck. Or when a (wood) miner finds some aliens and I need to make it run away.
In both cases you have to walk to the right unit controller, somehow turn if off and only then can override the vehicles programming. By that time the damage is usually done.
subbob
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Oct 11, 2016 3:32 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by subbob »

mrvn wrote: I think it would be best if vehicles had an automatic/manual slider like trains do.
I like that idea.
mrvn
Smart Inserter
Smart Inserter
Posts: 5877
Joined: Mon Sep 05, 2016 9:10 am
Contact:

path finding is totally screwing up

Post by mrvn »

I've marked trees south of my base with zones in parallel lines and have a miner drive to the first zone field, at which point it gets cleared.

So I would expect the miner to drive west and east in more or less straight lines and harvest all the trees. But on the way from one end of a line to the start of the next the path looks more like this:

Code: Select all

     ______
    /      \
   /        \
  /          \
 /            \
/              \
Apart from being wasteful the bigger problem is that it crosses a mining outpost and gets stuck on some belts

I wonder if this is a bug in the path finding? Does it consider going diagonal as one step so it's still finding the "shortest" path? Or does the biter AI have a tendency to run towards the players base until it gets too far of course?
RenewU
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Sep 08, 2017 11:26 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by RenewU »

Hey guys! Love the mod, it's really something! But I cat find how to program the vehicle depots to request an amount specified by a circuit network signal :/ I'm trying to make a hauler run long distance coal retrieval from a miner but when the vehicle returns to the depot it unloads all of it's coal and hence fuel. I'm looking into the option of using coal as fuel for a coal hauler and not have it run off of e.g. solid fuel. Anyone got a solution to my problem? Thanks!

RenewU
Helickron
Burner Inserter
Burner Inserter
Posts: 9
Joined: Fri Apr 01, 2016 2:16 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Helickron »

There is a Signal for Minimum Fuel. Just set that to whatever you want the hauler to keep. You can look at my Hauler-Load-Manager.https://www.reddit.com/r/factorio/comme ... s_for_bob/
RenewU
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Sep 08, 2017 11:26 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by RenewU »

Helickron wrote:There is a Signal for Minimum Fuel. Just set that to whatever you want the hauler to keep. You can look at my Hauler-Load-Manager.https://www.reddit.com/r/factorio/comme ... s_for_bob/
Huh... I will look for that signal! Maybe need to get my eyes, checked... I will also have a look at you AAI book, looks very nice! :)

Thanks!
Neemys
Filter Inserter
Filter Inserter
Posts: 461
Joined: Sat Apr 09, 2016 6:16 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Neemys »

I ran into a problem lately. In my game (big railworld with angels/bobs) I use miners and hauler to get differents resources. The circuit that control them have no problem. It's a simple, if hauler resource go over a threshold it go unload, otherwise stay next to the miner. Using go to pos order, so they need to pathfind but the distance is really short as the depot is usually next to the mining field.
Example of hauler circuit for crotinnium
Example of hauler circuit for crotinnium
circuit hauler.jpg (63.62 KiB) Viewed 8931 times
The first constant combinator is for the hauler id (I normally use unit id instead of hauler id, but I changed it to see if it changed something). I get his inventory and check with the four combinator on the left. The second constant combinator is for the mine the hauler should go to get resource and the zone to go to unload. We get position of both to pass the one we need. The arithmetic combinator is here to offset the position so it don't get stuck on the miner if he come too close to it. That setup is not optimized, I have better plan for later but since this problem doesn't seem related to circuit it doesn't matter.

Each resources have a specific miner and hauler and controlled by their distinct circuit (no optimization for now) and order are issued every 1000 ticks (using building own tick limitation). Everything went fine for 10+ hours but problem rose lately.

Some hauler stop moving and do nothing even when they receive order periodically by unit controller. To unlock them I need to select them with the unit remote controller and issue multiple order directly to unstuck them, after that they will work for a random period of time and again stop moving. It's not a regular problem and happen randomly for multiple hauler some happen more frequently than other. Since after moving them by remote controller make them work again it's not a circuit problem.
The hauler on the left is not moving since 5 minutes even after checking that  the unit controller receive the good ID and coordinate to go near the miner. You can also see, nothing between miner and hauler so no obstacle problem.
The hauler on the left is not moving since 5 minutes even after checking that the unit controller receive the good ID and coordinate to go near the miner. You can also see, nothing between miner and hauler so no obstacle problem.
hauler stuck.jpg (288.62 KiB) Viewed 8931 times


I tried without success :
  • Changing the circuit to issue order every 60 ticks (more often).
  • Changing hauler for new one in case old one are bugged.
  • Changing the order to use hauler id instead of unit id to assign order.
  • Offset the target position by different value to avoid being blocked by getting stuck.
It's getting tedious to check for hauler stuck so I set up alert if hauler/miner have too many resource to detect when they are stuck. But it 's also tedious to go to map and manually move them to unstuck them everytime one decide to not move.

The max structure par tick in mod option is set to 0.

Someone have a solution to that ? Maybe I have done something wrong ?
Want more space restriction ? Or maybe you want to be forced to use train for other thing than ore and oil ? Try Building Platform Mod !
Helickron
Burner Inserter
Burner Inserter
Posts: 9
Joined: Fri Apr 01, 2016 2:16 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Helickron »

When you press F4 and activate all pathfinding options (or simply press F5) you'll see if the hauler is looking for a path. Sometimes they are not, they usually will start working again after some time. Near aliens haulers often behave weird. Driving in the opposite direction for no reason and getting stuck. I would also be keen about a solution here.
Neemys
Filter Inserter
Filter Inserter
Posts: 461
Joined: Sat Apr 09, 2016 6:16 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Neemys »

Helickron wrote:When you press F4 and activate all pathfinding options (or simply press F5) you'll see if the hauler is looking for a path. Sometimes they are not, they usually will start working again after some time. Near aliens haulers often behave weird. Driving in the opposite direction for no reason and getting stuck. I would also be keen about a solution here.
He is not looking for a path. I tried something else. While one hauler was stuck, I ploped down a constant combinator and a unit combinator and try sending him an order by setting the order on the combinator and wiring it to the unit controller, the hauler don't move an inch. Oddly enough, he doesn't even respond to direct remote controller order anymore after doing this. The hauler seem to ignore/don't receive order.

Yes I also saw hauler behaving oddly when biter where near but's that maybe because as it use biter AI, it use previous path for his own. My hauler have a tendency to go near enemy bases to follow what could be an attack path to go to the base
Want more space restriction ? Or maybe you want to be forced to use train for other thing than ore and oil ? Try Building Platform Mod !
Bizobinator
Fast Inserter
Fast Inserter
Posts: 193
Joined: Fri May 06, 2016 10:35 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Bizobinator »

Mod author & folks: How suitable would this mod be for implementing cargo ships? Would it be better/easier to use its own control logic & stuff?
mrvn
Smart Inserter
Smart Inserter
Posts: 5877
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by mrvn »

Neemys wrote: I tried without success :
  • Changing the circuit to issue order every 60 ticks (more often).
  • Changing hauler for new one in case old one are bugged.
  • Changing the order to use hauler id instead of unit id to assign order.
  • Offset the target position by different value to avoid being blocked by getting stuck.
It's getting tedious to check for hauler stuck so I set up alert if hauler/miner have too many resource to detect when they are stuck. But it 's also tedious to go to map and manually move them to unstuck them everytime one decide to not move.

The max structure par tick in mod option is set to 0.

Someone have a solution to that ? Maybe I have done something wrong ?
Unlikely but make sure neither X nor Y are 0.
Post Reply

Return to “Mods”