[MOD 0.14] AAI Programmable Vehicles

Topics and discussion about specific mods
KyleSpades
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sat Dec 16, 2017 10:00 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by KyleSpades »

Earendel wrote:
It will be updated. 0.16 should let me make some changes that weren't possible before so the update will probably have some new features.
That's very good to hear! Will be looking forward to it!
Earendel wrote: Unfortunately I've been ill recently so haven't been able to make a start yet.
Wish you the best, dude. Hope you get better soon

raiyuza
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Apr 27, 2017 5:49 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by raiyuza »

Any word, waiting in anticipation of the golden god.

User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 715
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Earendel »

Alien Biomes v3 is around 90% done so it will be soon.

I was planning on adding some new features as I updated the programmable AAI stuff, but I think I'll just do a plain update to avoid any more delays.

User avatar
grauerkoala
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sat Jan 06, 2018 9:29 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by grauerkoala »

Finally registered to report a bug with scanners: In "complex" setups, when removing the scanner the signal input and output terminals will remain and become unremovable:
aai-remaining-terminal.png
aai-remaining-terminal.png (697.63 KiB) Viewed 8724 times
Miner Controller and Dezoner
This happens reliably for that particular setup; however, other setups involving scanners appear to be unaffected by that:
Explorer
I'm using most AAI mods I could find on mods.factorio.com and additionally the Creative Mode mod. If you need any details I'm happy to try and provide them. :)

Also (apologies if this has been asked before): the forums seem a little cumbersome for providing bug reports and suggestions while taking care to not post duplicates. How would you feel about utilizing Github or something similar, if only for the bug tracker?

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 »

grauerkoala wrote:Finally registered to report a bug with scanners: In "complex" setups, when removing the scanner the signal input and output terminals will remain and become unremovable:
aai-remaining-terminal.png
Miner Controller and Dezoner
This happens reliably for that particular setup; however, other setups involving scanners appear to be unaffected by that:
Explorer
I'm using most AAI mods I could find on mods.factorio.com and additionally the Creative Mode mod. If you need any details I'm happy to try and provide them. :)

Also (apologies if this has been asked before): the forums seem a little cumbersome for providing bug reports and suggestions while taking care to not post duplicates. How would you feel about utilizing Github or something similar, if only for the bug tracker?
Do you use any mod that make blueprint instant when you place them ? if yes, it migth be the same things as https://mods.factorio.com/mods/Earendel ... sion/17197
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 !

User avatar
grauerkoala
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sat Jan 06, 2018 9:29 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by grauerkoala »

Neemys wrote:Do you use any mod that make blueprint instant when you place them ? if yes, it migth be the same things as https://mods.factorio.com/mods/Earendel ... sion/17197
The Creative Mode mod does precisely that, that's probably the issue then. I'll see about having it not do that. Thanks a bunch! :)

User avatar
CakeDog
Inserter
Inserter
Posts: 22
Joined: Sun Jun 25, 2017 12:48 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by CakeDog »

Glad to see you've been updating your other mods. Can't wait for the 0.16 version of programmable vehicles.
Still, coasting along on a hand updated version myself, I noticed a few things...

AI controlled vehicles didn't seem to play any gun sound when firing. Took a look at line 1103:

Code: Select all

    if unit_type.gun.attack_parameters.sound and game.entity_prototypes["gunsound-"..unit_type.gun.name] then
For some reason, the former always returned nil even though the required detached gun sounds mod checks pretty much the same code to create its sound entities. Commenting that half out works just fine as the latter half checks for the entity the required other mod creates for the same purpose anyhow.


AI controlled vehicles recenter their turrets immediately after killing/losing their targets.
Player vehicles don't. So changed line 1842 to this:

Code: Select all

                  elseif game.tick >= unit.attack_last_tick + 150 then
I chose 150 as the ticks to wait to recenter as it seems to be the average between both your vehicles and the vanilla ones.


AI controlled vehicles do not gain the ammo speed research modifiers.
You already seemed to want to add it, so quickly added this to lines 1182 and 1183

Code: Select all

        local multiplier = 1
        if unit_type.gun.attack_parameters.ammo_category then
          multiplier = multiplier + unit.vehicle.force.get_gun_speed_modifier(unit_type.gun.attack_parameters.ammo_category)
        end
        local reload_time = unit_type.gun.attack_parameters.cooldown / multiplier
Now they shoot as fast as your tank does. Which is awfully fast, so I divided the gun speed modifier by 2 just to keep AI vehicles from being ridiculously powerful in massed numbers.


When adding an explosion effect and radius damage to your laser tank's focused ammo, it worked fine. Except for AI controlled laser tanks. On those, the explosion effect appeared ON THE TANK. No clue why the code does this, but flipping lines 997 to 999 like so:

Code: Select all

            position = target_point,--source_point,

            target = source_point}--target_point}
fixed it, while leaving all other behavior I can even find unchanged.


That's about all I could find/think of.

User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 715
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Earendel »

CakeDog wrote:Glad to see you've been updating your other mods. Can't wait for the 0.16 version of programmable vehicles.
Still, coasting along on a hand updated version myself, I noticed a few things...

AI controlled vehicles didn't seem to play any gun sound when firing. Took a look at line 1103:

Code: Select all

    if unit_type.gun.attack_parameters.sound and game.entity_prototypes["gunsound-"..unit_type.gun.name] then
For some reason, the former always returned nil even though the required detached gun sounds mod checks pretty much the same code to create its sound entities. Commenting that half out works just fine as the latter half checks for the entity the required other mod creates for the same purpose anyhow.


AI controlled vehicles recenter their turrets immediately after killing/losing their targets.
Player vehicles don't. So changed line 1842 to this:

Code: Select all

                  elseif game.tick >= unit.attack_last_tick + 150 then
I chose 150 as the ticks to wait to recenter as it seems to be the average between both your vehicles and the vanilla ones.


AI controlled vehicles do not gain the ammo speed research modifiers.
You already seemed to want to add it, so quickly added this to lines 1182 and 1183

Code: Select all

        local multiplier = 1
        if unit_type.gun.attack_parameters.ammo_category then
          multiplier = multiplier + unit.vehicle.force.get_gun_speed_modifier(unit_type.gun.attack_parameters.ammo_category)
        end
        local reload_time = unit_type.gun.attack_parameters.cooldown / multiplier
Now they shoot as fast as your tank does. Which is awfully fast, so I divided the gun speed modifier by 2 just to keep AI vehicles from being ridiculously powerful in massed numbers.


When adding an explosion effect and radius damage to your laser tank's focused ammo, it worked fine. Except for AI controlled laser tanks. On those, the explosion effect appeared ON THE TANK. No clue why the code does this, but flipping lines 997 to 999 like so:

Code: Select all

            position = target_point,--source_point,

            target = source_point}--target_point}
fixed it, while leaving all other behavior I can even find unchanged.


That's about all I could find/think of.
Thanks for those notes. I'm hoping to be able to bypass those problems by putting a dummy character in the vehicle and using http://lua-api.factorio.com/latest/LuaC ... ting_state

User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 715
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Earendel »

I'm probably about 75% of the way through the update. Vehicles now shoot and drive using a dummy character so things like range, shooting speed, and fuel speed bonus are taken care of. There was a huge amount of code to fake this stuff before so it was nice to remove that.

You can now get a vehicle to drive while you are a passenger. You have to switch off the AI using the remote controller to drive manually.

Most of the dependencies have been removed.

I haven't done any testing with unit data, inventory transfer, or the structures so they might cause errors. If you want to play around and give me a list of bugs to work on tomorrow then go ahead.

Also I know that vehicles are getting stuck in trees more, not sure why :?
Attachments
aai-programmable-vehicles_0.4.1.zip
(437.6 KiB) Downloaded 198 times

User avatar
CakeDog
Inserter
Inserter
Posts: 22
Joined: Sun Jun 25, 2017 12:48 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by CakeDog »

Well, it looks good so far, with a few notable issues/probables:

Vehicles can pass through objects/over water. Not sure with objects yet, but with water it looks like it's only in situations where the vehicle comes to a split in terrain and can't determine a proper path in time, so it just continues straight ahead and thus violates physics. It can't turn or accelerate while driving on water, and if given a new destination with unit controller it just decelerates to a stop and gets stuck there.

+EDIT: Enabling AAI on a vehicle while inside it OR entering an enabled vehicle, then giving it a move order via controller, causes the player to become invulnerable.

User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 715
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Earendel »

Some good news and bad news.

The good news is that I've added orders / pathfinding visualisation for selected units so you can see where they're going and if / where they are pathfinding. This was a feature planned for a while, but also helps me debug problems which has become necessary as part of this update.
pathfinding-vis.jpg
pathfinding-vis.jpg (548.88 KiB) Viewed 8420 times
The bad news is that cliffs are really messing with pathfinding. It seems that if a unit is spawned too close to a cliff it just won't start finding a path.
I've already tried making sure that the unit spawns further away from the nearest obstacle. That's risky because it can glitch vehicles through walls and put your base at risk. Unfortunately putting the buffer value past the "too risky" point is no where near enough to completely avoid the cliff problem. It's serious because once a vehicle gets stuck like this and the final destination is in the cliff direction then it will never escape.
pathfinding-fail.jpg
pathfinding-fail.jpg (420.15 KiB) Viewed 8420 times
You can see the thicker red square as the invisible navigator unit. The path to find is the the red arrow direction. Even though there is no obstacle the pathfinding won't start. After a few seconds the vehicle gives up and tries 'direct drive' and ignores pathfinding heading straight for the target. In the case above that solves the problem, but if the destination is in the other direction it will probably never escape.

It seems that normal biters also get stuck like this but either despawn or wander in circles to find a way out.

orzelek
Smart Inserter
Smart Inserter
Posts: 3919
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by orzelek »

If you suspect that this can happen to biters maybe try to bug report it?

User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 715
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Earendel »

I made a bug report but it seems like a bit of a long shot seeing as it affects vanilla biters less severely. You never know though, the devs are good.

I've found some settings where the cliff problem is rare in low-cliff areas and won't glitch the vehicles too much. It still happens though.

Anyway there's an updated version here that has the pathing indicators:
[edit] Removed Link
Please report bugs here.

It also has a new feature: The ability to cycle vehicle AI through: Auto, Always ON, Always OFF.
ON means that the AI controls the Driving and Guns. If you enter the vehicle you'll be a passenger, the AI will still drive but you control the gun. The AI can drive you around this way if you want.
OFF means that the AI won't do anything, it's like a braindead vanilla vehicle. All driving shooting must be manual.
Auto (default) means that the AI controls the Driving and Guns, but if you get in the AI switches off so you control both. This is similar to the V2 functionality.

User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 715
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Earendel »

Update:
Another version. If there are no major problems reported I'll put it on the mod portal.
AAI Programmable Vehicles: https://drive.google.com/open?id=1s5wxo ... tS_6LqpV3X

There's also a structures version ready for additional testing.
AAI Programmable Structures: https://drive.google.com/open?id=1fpoQE ... riCyxubU1e

User avatar
CakeDog
Inserter
Inserter
Posts: 22
Joined: Sun Jun 25, 2017 12:48 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by CakeDog »

Haven't had any ocean crossing events since the previous update, and the auto/on/off system is very neat.

The pathfinding indicators are nice, but can be extremely hard on fps when doing group moves.

Also, you added the unit scanner (player scanner? same building) to both techs. (programmable-structures and programmable-vehicle-structures)

User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 715
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Earendel »

CakeDog wrote:Haven't had any ocean crossing events since the previous update.
Yeah that should be fixed now.
CakeDog wrote:The pathfinding indicators are nice, but can be extremely hard on fps when doing group moves.
Good to know. How many units were selected and roughly how far were the paths?
I'll make the path indicators optional so people can save fps.
CakeDog wrote:Also, you added the unit scanner (player scanner? same building) to both techs. (programmable-structures and programmable-vehicle-structures)
Ok I'll fix that.

jmattspartacus
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Jul 09, 2016 2:59 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by jmattspartacus »

I'm not sure what all is possible within the API (I'm still learning the file structure, and LUA to mod things for myself), but you might be able to put a hook in to catch whenever it tries direct pathfinding, and try periodically to assign a new path, or stop the vehicle altogether, so as to prevent vehicles from rampaging through bases, or otherwise

Definitely looking forward to the update!

Moneyone2
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sun Jan 21, 2018 10:01 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Moneyone2 »

Bug Report

Error while running event aai-programmable-vehicles::on_tick (ID 0)
__aai-programmable-vehicles__/control.lua:1000: bad argument #-1 to 'remove' (string expected, got nil)

occured while using controller to move chaingunners

IanRaven
Inserter
Inserter
Posts: 20
Joined: Fri Jan 19, 2018 9:58 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by IanRaven »

Would it be possible to add a mod setting for the mod to ignore aircraft mod vehicles?
Or one for the mod to work with only AAI vehicles?

Thank you for the great mods you make.

Skeletpiece
Long Handed Inserter
Long Handed Inserter
Posts: 82
Joined: Sat Jul 08, 2017 6:26 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Skeletpiece »

Great

Post Reply

Return to “Mods”