Page 19 of 44

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Fri Jun 23, 2017 1:18 pm
by Skeleton Man
you can already provide distance and angle signals to a follow unit or player signal to make a custom formation

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Sat Jun 24, 2017 6:09 am
by dgw
I guess it's questionable whether this is a mod issue, but when I removed the AAI mod set from my save (since I wasn't using it this game), Factorio deleted my cars & tanks, including trunk contents (fuel & ammo stockpiles, mostly). I assume this is because AAI replaced the vanilla versions I had built before installing the mods with custom entities (would explain why my tank went from three weapons to one). Not sure if there's anything to be done from the mod side about this (since by the time the mod is deleted, you can't run any migration scripts!), but thought it warranted a mention.

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Sat Jun 24, 2017 9:09 am
by whitecold
Something seems wrong with blueprint building. I managed to gather up some virtual objects somehow, and the scanners on my stamped down blueprint don't seem to work.

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Mon Jun 26, 2017 2:00 am
by sumdawgy
sumdawgy wrote: IT worked fine before i got a decider connected to it....hm. :ugeek:
I finally got back into the save.... :oops:
IT WAS the decider...must've been half asleep. I inserted it into the logic flow in an off cycle/tick from the rest of the data. Did it twice...but got lucky with the first one's timing....

thanks guys!

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Tue Jun 27, 2017 1:30 am
by Mobius1
Found a bug with Aircraft Mod and AAI PV:
I built an airplane with rocket weapon, placed it down, put "Vehicle Fuel" on it, after it used fully the 2nd unit of fuel, the vehicle just stop completely and didn't want to move again even picking it up and popping it down didn't make it move. The vehicle could turn but not move forward or backwards. Vehicle itself is the Flying Fortress. Tried putting other types of fuel on it and it didn't fill the fuel bar. I installed Electric Vehicles mod, put the electric engine on the plane and then it filled the fuel bar and started to move again.

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Wed Jun 28, 2017 4:17 pm
by Earendel
Mobius1 wrote:Found a bug with Aircraft Mod and AAI PV:
I built an airplane with rocket weapon, placed it down, put "Vehicle Fuel" on it, after it used fully the 2nd unit of fuel, the vehicle just stop completely and didn't want to move again even picking it up and popping it down didn't make it move. The vehicle could turn but not move forward or backwards. Vehicle itself is the Flying Fortress. Tried putting other types of fuel on it and it didn't fill the fuel bar. I installed Electric Vehicles mod, put the electric engine on the plane and then it filled the fuel bar and started to move again.
Did you already have the Electric Vehicles mod or did you only install that after the problem started?

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Wed Jun 28, 2017 10:00 pm
by Mobius1
Earendel wrote:Did you already have the Electric Vehicles mod or did you only install that after the problem started?
After the problem. Also I'm running a shitload of mods:
mods

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Thu Jun 29, 2017 5:32 pm
by regedit2000
Earendel wrote:
Mobius1 wrote:Found a bug with Aircraft Mod and AAI PV:
I built an airplane with rocket weapon, placed it down, put "Vehicle Fuel" on it, after it used fully the 2nd unit of fuel, the vehicle just stop completely and didn't want to move again even picking it up and popping it down didn't make it move. The vehicle could turn but not move forward or backwards. Vehicle itself is the Flying Fortress. Tried putting other types of fuel on it and it didn't fill the fuel bar. I installed Electric Vehicles mod, put the electric engine on the plane and then it filled the fuel bar and started to move again.
Did you already have the Electric Vehicles mod or did you only install that after the problem started?
fixed function in control.lua:

Code: Select all

local function consume_fuel_or_equipment (unit)

    if unit.vehicle.grid and unit.vehicle.grid.available_in_batteries > 10000 then
        --Added by Undarl; basic battery fueling logic courtesy of Sirenfal
        ---Modified by the Nexela
		local player = game.players[1]
		player.print("consume_fuel_or_equipment")
        unit.vehicle.burner.currently_burning = high_fuel_item
        local energy_deficit = game.item_prototypes[high_fuel_item].fuel_value - unit.vehicle.burner.remaining_burning_fuel
        local batteries = table.filter(unit.vehicle.grid.equipment, function(v) return v.type == "battery-equipment" end)
		if batteries then player.print("batteries is present(" .. #batteries .. ") energy = " .. unit.vehicle.grid.available_in_batteries) end
        local num_batteries = #batteries
        while num_batteries > 0 and energy_deficit > 0 do
			
            local battery = batteries[num_batteries]
            local energy_used = math.min(battery.energy, energy_deficit)
			player.print("energy_deficit(" .. energy_deficit .. ") energy battery = " .. battery.energy)
			player.print("energy_used(" .. energy_used .. ")")
            battery.energy = battery.energy - energy_used
            unit.vehicle.burner.remaining_burning_fuel = unit.vehicle.burner.remaining_burning_fuel + energy_used
            energy_deficit = energy_deficit - energy_used
            num_batteries = num_batteries - 1
        end
    else
        for _, inv_num in pairs(inv_nums) do
            local inventory = unit.vehicle.get_inventory(inv_num)
            if inventory then
                local contents = inventory.get_contents()
                local fuel_item = get_fuel.item(contents)
                if fuel_item then
                    if inv_num ~= defines.inventory.fuel then
                      if contents[fuel_item.name] > 1 then
                        -- move fuel to fuel inventory
                        unit.vehicle.burner.currently_burning = fuel_item.name
                        unit.vehicle.burner.remaining_burning_fuel = unit.vehicle.burner.remaining_burning_fuel + fuel_item.fuel_value
                        local fuel_inv = unit.vehicle.get_inventory(defines.inventory.fuel)
                        local inserted = fuel_inv.insert{name = fuel_item.name, count = contents[fuel_item.name] -1}
                        if inserted > 0 then
                          inventory.remove({name = fuel_item.name, count = inserted})
                        end
                      else
                        unit.vehicle.burner.currently_burning = fuel_item.name
                        unit.vehicle.burner.remaining_burning_fuel = unit.vehicle.burner.remaining_burning_fuel + fuel_item.fuel_value
                        inventory.remove({name=fuel_item.name, count=1})
                      end
                    else
                      -- burning from correct slot
                      unit.vehicle.burner.currently_burning = fuel_item.name
                      unit.vehicle.burner.remaining_burning_fuel = unit.vehicle.burner.remaining_burning_fuel + fuel_item.fuel_value
                      inventory.remove({name=fuel_item.name, count=1})
                      return true
                    end
                end
            end
        end
    end

end

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Fri Jun 30, 2017 9:19 pm
by whitecold
My game currently crashes a few moments in this savegame. No entry in the log is detectable, unfortunately. I strongly suspect it is AAI, as some tanks are getting orders right then, but I have no idea how to debug it.
Edit: It does seem to happen when one tank paths into some walls

Idle Signal.

Posted: Sat Jul 01, 2017 8:51 pm
by Sworn
Would be possible to add one more signal to the unit scanner reads. An IsIdle signal? so you don't have to "guess" base on the last command or with some math on the X and Y if the last command was done.

Something like a signal that appears as 1 [or total idle time] since the last command was completed (when the unit has stopped all actions like [not shotting, not moving, not mining, or whatever]).

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Sun Jul 02, 2017 2:45 pm
by Berkys32
How to setup vehicle color? I see colored vehicles on your screens, but cant get it too.

And is there any signal to cancel current order? I wanted to send Speed 0 but than realized its not signal at all, than I tried signal X and Y of that vehicle, but instead of just stop its "moving" on place...

And is there any Discord channel for AAI?

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Sun Jul 02, 2017 4:36 pm
by Earendel
regedit2000 wrote: fixed function in control.lua:
Thanks, added.
Sworn wrote:Would be possible to add one more signal to the unit scanner reads. An IsIdle signal? so you don't have to "guess" base on the last command or with some math on the X and Y if the last command was done.

Something like a signal that appears as 1 [or total idle time] since the last command was completed (when the unit has stopped all actions like [not shotting, not moving, not mining, or whatever]).
There is time since last moved and time since last targeted enemy. It's not aware of things like mining or other things that special vehicles do.
Berkys32 wrote:How to setup vehicle color? I see colored vehicles on your screens, but cant get it too.

And is there any signal to cancel current order? I wanted to send Speed 0 but than realized its not signal at all, than I tried signal X and Y of that vehicle, but instead of just stop its "moving" on place...

And is there any Discord channel for AAI?
The API limitation means that the vehicle color can only be changed by a player getting in, there's not much I can do about that.

A speed of 1 or -1 is so slow that it will never actually move (due to pixel snapping) so that's effectively stopped.

There's no discord channel, but I am discord.

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Sun Jul 02, 2017 6:16 pm
by Sworn
Earendel wrote:
regedit2000 wrote:
Sworn wrote:Would be possible to add one more signal to the unit scanner reads. An IsIdle signal? so you don't have to "guess" base on the last command or with some math on the X and Y if the last command was done.

Something like a signal that appears as 1 [or total idle time] since the last command was completed (when the unit has stopped all actions like [not shotting, not moving, not mining, or whatever]).
There is time since last moved and time since last targeted enemy. It's not aware of things like mining or other things that special vehicles do.
Could you explain how the [Time since moved tile] is updated? I was making some test with it and build the following setup:

GO: define if an hauler is idle.

Test: At first I tried with the speed signal [speed signal = 0], but some times the vehicle stop during turns [maybe for path finding].
So i tried to combine the [speed] signal with the [Time since moved tile] signal. That seems to work but some times it gave me a false idle hauler.

Setup: First decider output A = 1 when the speed = 0, second decider output A = 1 when [Time since moved tile] > 400. Final the last decider output I = 1 when A = 2.

But sometimes the [Time since moved tile] has pass the 400 before reseting during the path and once it hits more then 1k.

I'm currently using the [Time since moved tile] greater then 1k, but it depends on how the signal is updated.

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Sun Jul 02, 2017 8:07 pm
by Berkys32
Signal "Time since moved tile" > 500 seems quite enough for me, even in case it got stuck bcs of tree...

Im not sure what do you mean by "move to tile" signal. You mean go to x/y pos?

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Sun Jul 02, 2017 9:18 pm
by Sworn
Berkys32 wrote:Signal "Time since moved tile" > 500 seems quite enough for me, even in case it got stuck bcs of tree...

Im not sure what do you mean by "move to tile" signal. You mean go to x/y pos?

ops, was supposed to be "Time since moved tile", forgot the name of the signal, thanks i'll correct it.

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Mon Jul 03, 2017 6:35 pm
by Earendel
The movement timer gets reset if the XY tile changes. Subtile changes don't reset it, it has to actually move from 1 square to another on the grid that you see with F5. If a vehicle is slow the timer can get higher. If a vehicle gets nudged by damage it usually won't reset the timer but can if it was on the edge.

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Tue Jul 04, 2017 1:40 am
by Sworn
Got it. thanks that explain why some times it goes really high and some times reset before 10.

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Tue Jul 04, 2017 8:14 am
by buggy123
Would it be possible to add a setting to toggle the 1-weapon-per-vehicle mechanic? It's possible to disable it by deleting a few bits in entity-update and entity-update-external but its kind of annoying doing it after every update.

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Tue Jul 04, 2017 1:30 pm
by Skeleton Man
how feasable is it to allow vehicles with a color signal or something similar to take on that color on their exterior, similar to how when a player of a particular color is controlling them?

it would be nice to visually organize them

Re: [MOD 0.14] AAI Programmable Vehicles

Posted: Tue Jul 04, 2017 6:15 pm
by whitecold
buggy123 wrote:Would it be possible to add a setting to toggle the 1-weapon-per-vehicle mechanic? It's possible to disable it by deleting a few bits in entity-update and entity-update-external but its kind of annoying doing it after every update.
Which bits exactly have to be deleted? I broke the mod trying to accomplish that.