[MOD 0.14] AAI Programmable Vehicles

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

Re: [MOD 0.14] AAI Programmable Vehicles

Post by mrvn »

Earendel wrote:
Nightinggale wrote:Sure there are performance issues regarding adding more signals, but how is performance for one modded combinator vs 5 vanilla ones?
Vanilla vs modded combinator speed, I'm not sure what the exact value is but the ballpark is closer to 50000 than 5.

Also, the actual calculations can be done quickly, it's reading each incoming signal and writing each outgoing signal that takes the most time. So for example, custom combinator plugged into you logistic system would be way slower due to reading lots of signals.

A case where you only write the output if the input changes only solves half the problem because just reading the incoming signal and looking for a change is also quite inefficient. For this reason most modded combinator-like systems are restricted to only run once per second.
I wonder why there is no API hook for this, so the lua code only gets called when the signal input changes. I'm pretty sure the vanilla combinators work that way (and they flash a nice LED on every update too). Checking the signals on every tick seems pretty braindead.
mrvn
Smart Inserter
Smart Inserter
Posts: 5904
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by mrvn »

Why do programmable structures have 2 entities?
When you look at a decider combinator it is one entity with one hit box and 2 pairs of (2 red, 2 green) circuit network terminals.

When you look at a depot or any of the scanner they are 2 entities with 2 hit boxes that each have just one pair circuit network terminals each. I think this makes probelms for blueprinting because you can remove the main entity from the blueprint but leave the hidden one for example.

I recently figured out how to do multiple circuit network terminals. Is there any reason for the split entities or did you just not know how to do multiple pairs of terminals?
Nightinggale
Fast Inserter
Fast Inserter
Posts: 120
Joined: Sun May 14, 2017 12:01 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Nightinggale »

Debating Factorio mod support and how the API should be better should not really take place here. For that reason I created a thread in the Ideas and Suggestions subforum.

Since it's about a new API, I merged performance with ideas to make wire connections easier to use. This is based on issues with various mods (not AAI) as well as my own struggles with the learning curve to even get anything working at all.

Feel free to contribute. In fact I will encourage it as I view this as more like a request from the modding community than a personal request from me personally.
viewtopic.php?f=6&t=52463
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 »

mrvn wrote:
Why do programmable structures have 2 entities?
When you look at a decider combinator it is one entity with one hit box and 2 pairs of (2 red, 2 green) circuit network terminals.

When you look at a depot or any of the scanner they are 2 entities with 2 hit boxes that each have just one pair circuit network terminals each. I think this makes probelms for blueprinting because you can remove the main entity from the blueprint but leave the hidden one for example.

I recently figured out how to do multiple circuit network terminals. Is there any reason for the split entities or did you just not know how to do multiple pairs of terminals?
There are a number of reasons. I don't think it was possible to do multiple circuit network terminals when it was coded. I also need to make sure that I can write to the output which requires the output to be a constant combinator. The central building in many cases needs to be animated in a way that a constant combinator cannot be. Also in the case of the depot the content signals cannot mix with the exchange data signals. Ideally all the structures would be 1 entity, but the scanner for example is actually 4: input, output, animation, settings storage. I'd like to know what your approach is because there may be a structure that can make use of it.
mrvn
Smart Inserter
Smart Inserter
Posts: 5904
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by mrvn »

Earendel wrote:
mrvn wrote:
Why do programmable structures have 2 entities?
When you look at a decider combinator it is one entity with one hit box and 2 pairs of (2 red, 2 green) circuit network terminals.

When you look at a depot or any of the scanner they are 2 entities with 2 hit boxes that each have just one pair circuit network terminals each. I think this makes probelms for blueprinting because you can remove the main entity from the blueprint but leave the hidden one for example.

I recently figured out how to do multiple circuit network terminals. Is there any reason for the split entities or did you just not know how to do multiple pairs of terminals?
There are a number of reasons. I don't think it was possible to do multiple circuit network terminals when it was coded. I also need to make sure that I can write to the output which requires the output to be a constant combinator. The central building in many cases needs to be animated in a way that a constant combinator cannot be. Also in the case of the depot the content signals cannot mix with the exchange data signals. Ideally all the structures would be 1 entity, but the scanner for example is actually 4: input, output, animation, settings storage. I'd like to know what your approach is because there may be a structure that can make use of it.
I was playing with the decider combinator, which has both input and output connections, to implement a trigonometric combinator. I'm still new to modding and just trying to figure stuff out. Last I got stuck trying to override the symbols of the combinator. Overloading a decider combinator gives an error if you don't add icons for all the functions it originally has. Not sure if they can be turned off or replaced at all.
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 »

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.
Keio
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Apr 01, 2016 9:35 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Keio »

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
Keio
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Apr 01, 2016 9:35 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Keio »

So I've come across a game-crash bug of sorts...

I try to move the miner (in the screenshot below) to the left onto some more ore to continue mining... the moment I give a manual move command to it, the game instantly crashes (comes up with a "Factorio is not responding")

Image

I've noticed that if I move the hauler away, it still crashes, but if I move the turret cars away, it does not crash.
I'm guessing it's something to do with collisions or pathing.

The hauler is being commanded by programmable buildings to hunt down the miner when it's inventory is empty, sit in place until it has x items, then go to the depot.
One of the gun cars is being manual-commanded to follow the miner (click on miner to trigger direct goto/follow)
The other gun car is being manual-commanded to follow the first gun car (same as above)

Current-log https://pastebin.com/w8R5CGiH

Previous-log https://pastebin.com/tesFSBfF
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Nexela »

Can you upload your save and mod pack that crashes?
Keio
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Apr 01, 2016 9:35 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Keio »

Nexela wrote:Can you upload your save and mod pack that crashes?
Here is the mod-list (if that's what you meant by mod pack?)

Code: Select all

aai-programmable-structures
aai-programmable-vehicles
aai-signals
aai-vehicles-chaingunner
aai-vehicles-flame-tumbler
aai-vehicles-hauler
aai-vehicles-laser-tank
aai-vehicles-miner
aai-zones
advanced-logistics-system
angelsaddons-oresilos
angelsaddons-pressuretanks
angelsaddons-warehouses
angelsbioprocessing
angelscomponents
angelsinfiniteores
angelslogistics
angelspetrochem
angelsrefining
angelssmelting
angelstrigger-petrochem-showconverterrecipe
autofill
beltSorter
bobassembly
bobelectronics
bobenemies
bobgreenhouse
bobinserters
boblibrary
boblogistics
bobmining
bobmodules
bobores
bobplates
bobpower
bobrevamp
bobsflowcontrol
bobtech
bobvehicleequipment
bobwarfare
Bottleneck
bullet-trails
clock
color-coding
data-raw-prototypes
detached-gun-sounds
Enhanced_Map_Colors
EquipmentHotkeys
EvoGUI
Factorissimo2
FARL
Fastforward-Start-2
Flare Stack
Flow Control
GDIW
helmod
KS_Power
LoaderRedux
long-reach
More_Floors
Nanobots
nixie-tubes
off-grid-effects
Orbital Ion Cannon
PickerExtended
quarry
Reactor Interface
Renamer
research-queue
rso-mod
ScoreExtended
SmarterBotRecharge
Squeak Through
Teleportation
textplates
tree_collision
upgrade-planner
VoidChestPlus
Warehousing
WaterWell
what-is-it-really-used-for
YARM
Save is here: https://www.dropbox.com/s/s4ja9xi12ujpt ... 2.zip?dl=0
Note that it's not the save at the time of the crash, but it's the same game, I moved all the gun turrets away from the miners.

Also, the crash with miners around it (like in the screenshot) was happening to at least three miners which were all in similar positions on different ore fields.
mrvn
Smart Inserter
Smart Inserter
Posts: 5904
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by mrvn »

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.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Nexela »

Keio wrote: Here is the mod-list (if that's what you meant by mod pack?)

Please zip and upload the complete mod pack. Thanks
User avatar
withers
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Apr 08, 2016 4:54 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by withers »

Vehicles use biter AI when commanded with Unit Remote Controller or sent to an XY-Tile with a Unit Controller. The biter AI can be a bit derpy.
How'd you guys get the AI to not start wandering around when idle?
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 »

withers wrote:
Vehicles use biter AI when commanded with Unit Remote Controller or sent to an XY-Tile with a Unit Controller. The biter AI can be a bit derpy.
How'd you guys get the AI to not start wandering around when idle?
If it find it's target location it should stop, but if all else fails you can set a speed signal of 1.
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 »

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).
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 »

Solved Leaving it as originally asked as it may help others.

I'm new to using AAI Vehicles and ran into something that's not making sense.

As shown in the lower left corner, Hauler ID #1 is parked at a Depot, which for my own reference is Depot #1. Using a CC, I set the location of the Depot to the current position of the Hauler and then pass them as Signals 6, 7, 8 & 9. From the Scanner I pass the current position of the Hauler as G, H, I & J.

In upper right they are all shown together, and appear to be the same. However, when I subtract them into Q, R, S & T respectively, there is a difference.

Edit: Yes, I spelled appears incorrectly, it's an image and I'm not going back to change it. :)

Ding! Just posting and asking I may have figured it out myself. I set the Depot position, manually, to 11K (11,000 even). I didn't check the exact X & Y sub tile positions... *sigh*

Image
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 »

I just noticed Earendel already made a spiral scanner in his demo-file. And its much better than mine. :cry:
TopLad
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun Sep 17, 2017 4:00 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by TopLad »

Earendel,

I have been using your mod and it's fantastic. However, as I'm sure you're aware, the biter AI can be a bit derpy. Since I was using your mod together with the Aircraft mod, I wondered why aircraft (which have no collision) don't simply go straight to their destination, bypassing biter pathfinding. As I explored control.lua, however, I saw a section of code that seemed to be meant to do just that (overwrite pathfinding for aircraft), in the local function unit_set_target_position:

Code: Select all

    local unit_type = unit_get_type(unit)
    if direct or unit_type.is_flying then
        unit.target_position = position
        unit.safe_target_position = position
        unit.stuck = 0
        unit_set_mode(unit, "vehicle_move_to")
However, at least in my game, all the planes still seem to use biter pathfinding and, therefore, not take direct paths to their destinations. Exploring more of the code, I think the problem might be in the section of code that identifies flying units in the local function unit_setup_vehicle(vehicle):

Code: Select all

    if vehicle.collision_mask then
        local is_flying = true
        for _, layer in pairs(vehicle.collision_mask) do
            if layer == 'ground-tile' then
                unit_type.collides_with_ground = true
            end
            if layer ~= 'ghost-layer' then
                is_flying = false
            end
        end
        if is_flying then
            unit_type.is_flying = true
        end
    end
I don't know if I'm simply doing something wrong, or if some update of the aircraft mod or Factorio itself broke this part of code, or even if it's a conflict with another mod (the only other mod I'm using that should affect aircraft is Additional Turrets, though removing it seems to have no affect on the planes' pathfinding). However, I thought you should know about this.

If support for the Aircraft mod is not a priority, I totally get it. Sorry for troubling you, I apologize if it's some mistake on my part, and thank you for your work!
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 »

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
mrvn
Smart Inserter
Smart Inserter
Posts: 5904
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by mrvn »

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.
Post Reply

Return to “Mods”