[0.12.22][Modded] [kovarex] Hard Crash with no Log Entry on Hover

This subforum contains all the issues which we already resolved.
Peppe
Fast Inserter
Fast Inserter
Posts: 223
Joined: Fri Nov 28, 2014 6:48 pm
Contact:

[0.12.22][Modded] [kovarex] Hard Crash with no Log Entry on Hover

Post by Peppe »

I was looking to try out this old mod to add a capsule shooting turret:
https://forums.factorio.com/forum/vie ... =32&t=7571

I updated it to .12 by updating to match the changes in the capsule data structure and new gun turret model.

I used the following commands to give myself the capsule turret and ammo for it and tested them in the turret.
Get turret:
game.player.insert({name="capsule-turret", count=50})

Work perfectly:
game.player.insert({name="poison-capsule-magazine", count=50})
game.player.insert({name="slowdown-capsule-magazine", count=50})
game.player.insert({name="basic-grenade-magazine", count=50})

Work, but hard crash when hovering over the turret:
game.player.insert({name="distractor-capsule-magazine", count=50})
game.player.insert({name="defender-capsule-magazine", count=50})
game.player.insert({name="destroyer-capsule-magazine", count=50})

Last line of the Factorio log is:
Factorio crashed. Generating symbolized stacktrace, please wait ...
blank line
end of file

Code: Select all

   0.000 2016-02-14 12:06:05; Factorio 0.12.22 (Build 17589, win64)
   0.000 Operating system: Windows 10 
   0.000 Program arguments: "D:\Games\Factorio\bin\x64\Factorio.exe" 
   0.000 Read data path: D:/Games/Factorio/data
   0.000 Write data path: D:/Games/Factorio
   0.000 Binaries path: D:/Games/Factorio/bin
   0.009 Available display adapters: 2
   0.009  [0]: \\.\DISPLAY1 - NVIDIA GeForce GTX 770 {0x80001, [1920,0], 1920x1080, 32bit, 60Hz}
   0.009  [1]: \\.\DISPLAY2 - NVIDIA GeForce GTX 770 {0x80005, [0,0], 1920x1080, 32bit, 60Hz}
   0.010 Create display on adapter 0. Size 1280x720 at position [310, 162]. Monitor 0
   0.054 Initialised Direct3D:[0] NVIDIA GeForce GTX 770; driver: nvd3dumx.dll 10.18.13.6143
   0.088 Desktop composition is active.
   0.088 Graphics options: [FullScreen: false] [VSync: true] [UIScale: 100%] [MultiSampling: OFF] [Graphics quality: normal] [Video memory usage: all] [Light scale: 20%] [Screen: 0]
   0.136 Loading mod core 0.0.0 (data.lua)
   0.138 Loading mod base 0.12.22 (data.lua)
   0.189 Loading mod Cannon-Turret 0.0.1 (data.lua)
   0.224 Loading mod Capsule-Turrets 0.0.1 (data.lua)
   0.570 Initial atlas bitmap size is 16384
   0.572 Created atlas bitmap 16384x7803
   5.409 Info Updater.cpp:752: Downloading https://www.factorio.com/updater/get-available-versions?username=peppe&token=<private>&apiVersion=2
   6.130 0 packages available to download (experimental updates enabled).
   6.161 Factorio initialised
   9.516 Loading map D:/Games\Factorio\saves\_autosave2.zip
   9.573 Info Scenario.cpp:123: Map version 0.12.22-0
Factorio crashed. Generating symbolized stacktrace, please wait ...

Windows logs an application error:

Code: Select all

Faulting application name: Factorio.exe, version: 0.0.0.0, time stamp: 0x56a2aac2
Faulting module name: ntdll.dll, version: 10.0.10586.103, time stamp: 0x56a8483f
Exception code: 0xc0000005
Fault offset: 0x0000000000034bbe
Faulting process id: 0x19bc
Faulting application start time: 0x01d1675c844304a6
Faulting application path: D:\Games\Factorio\bin\x64\Factorio.exe
Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll
Report Id: 7bd8d837-590d-4b6c-8163-ce782b5dad00
Faulting package full name: 
Faulting package-relative application ID: 
Windows 10
I5 4670k
16GB Ram
GTX 770

Thanks for any info/help.
Attachments
capsule_test.zip
Save game with test setup
(1.23 MiB) Downloaded 132 times
Capsule-Turrets_0.0.1.zip
Updated .12 version of mod.
(25.44 KiB) Downloaded 155 times
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.12.22][Modded] [kovarex] Hard Crash with no Log Entry on Hover

Post by kovarex »

The problem is, that there is an infinite recursion here.

The turret shoots thing that creates turret that shoots thing that creates turret etc for ever.
Peppe
Fast Inserter
Fast Inserter
Posts: 223
Joined: Fri Nov 28, 2014 6:48 pm
Contact:

Re: [0.12.22][Modded] [kovarex] Hard Crash with no Log Entry on Hover

Post by Peppe »

kovarex wrote:The problem is, that there is an infinite recursion here.

The turret shoots thing that creates turret that shoots thing that creates turret etc for ever.
Thanks for the reply.

What is creating infinite turrets? The capsule turret fires from a magazine version of a combat robot capsule. The ammo creates a modified version of the combot robot projectile at the gun that travels as projectile and when the capsule reaches it's destination it explodes and creates the modified combat robots defined by the capsule at that location. No additional turrets are ever created.

The original author copied the defender, distractor, and destroyer capsules and the corresponding projectile to modify a couple values (lifespan and entity tracking) on the summoned robots and tag them all with turret in their name, but they are not actually creating turrets. He just tacked turret on the end to mark them his version.

The projectiles that are copies of the original are the same as the core except they just spawn the no track+short lifespan version of the robots instead of the default.

If i remove the customized copy of the original robots and change the capsule magizine ammo to fire the unmodified combot-robot projectiles it still crashes on hover of a turret loaded with combat robot ammo, but the actual items still work in the turret and fire capsule that spawn robots. Without the player tracking disable the defender + destroyer fly back to the turret like it is their home base.


On hover is the turret trying to reference the entities it has spawned to track it's damage numbers and getting a null reference?
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.12.22][Modded] [kovarex] Hard Crash with no Log Entry on Hover

Post by kovarex »

The "distractor-turret" entity creates itself as an attack, this is the infinite recursion:

Code: Select all

local newunit = util.table.deepcopy(data.raw["combat-robot"]["distractor"])
newunit.name = "distractor-turret"
--newunit.attack_parameters.range=17
newunit.time_to_live = 60 * 20
data:extend( { newunit } )
newunit = util.table.deepcopy(data.raw["projectile"]["distractor-capsule"])
newunit.name = "distractor-capsule-turret"
newunit.action.action_delivery.target_effects[1].entity_name = "distractor-turret" -- it creates itself here
--error(serpent.block(newunit))
data:extend( { newunit } )
Peppe
Fast Inserter
Fast Inserter
Posts: 223
Joined: Fri Nov 28, 2014 6:48 pm
Contact:

Re: [0.12.22][Modded] [kovarex] Hard Crash with no Log Entry on Hover

Post by Peppe »

The logic used is the same as the base version.
The original dev re-used the newunit variable, so the code while not very readable is correct as far as I can tell. It creates 3 new projectiles and 3 new combot robots. The new projectiles create the new combot robots and the new robots shoot vanilla projectiles -- they do not shoot capsules.

This is a robot we will spawn "distractor-turret", it is an entity that shoots lasers the same as the base distractor and its only change from vanilla is it lasts for 20 seconds.

Code: Select all

local newunit = util.table.deepcopy(data.raw["combat-robot"]["distractor"])
newunit.name = "distractor-turret"
--newunit.attack_parameters.range=17
newunit.time_to_live = 60 * 20
data:extend( { newunit } )
This is the projectile we will shoot from the turret, it is named "distractor-capsule-turret", it's only change from the vanilla distractor capsule projectile is it creates our modified distractor instead of the vanilla one.

Code: Select all

newunit = util.table.deepcopy(data.raw["projectile"]["distractor-capsule"])
newunit.name = "distractor-capsule-turret"
-- When the projectile reaches target we create our modified distractor robot instead of the base version.
newunit.action.action_delivery.target_effects[1].entity_name = "distractor-turret" -- the projectile correctly dies and creates the combat robot entity here.
--error(serpent.block(newunit))
data:extend( { newunit } )


I have removed all that code and had the magazine ammo shoot vanilla capsules and it still crashes on hover.


Here is a reworked version of what the data.lua was doing (still crashes on hover with this):

Code: Select all

-- Customized Projectiles --
-- distractor projectile
local distractorCapsuleAsTurretProjectile = util.table.deepcopy(data.raw["projectile"]["distractor-capsule"])
distractorCapsuleAsTurretProjectile.name = "distractor-capsule-fired-from-turret"
distractorCapsuleAsTurretProjectile.action.action_delivery.target_effects[1].entity_name = "distractor-short-life"
data:extend( { distractorCapsuleAsTurretProjectile } )

-- defender projectile
local defenderCapsuleAsTurretProjectile = util.table.deepcopy(data.raw["projectile"]["defender-capsule"])
defenderCapsuleAsTurretProjectile.name = "defender-capsule-fired-from-turret"
defenderCapsuleAsTurretProjectile.action.action_delivery.target_effects[1].entity_name = "defender-short-life-no-follow"
data:extend( { defenderCapsuleAsTurretProjectile } )

-- destroyer projectile
local destroyerCapsuleAsTurretProjectile = util.table.deepcopy(data.raw["projectile"]["destroyer-capsule"])
destroyerCapsuleAsTurretProjectile.name = "destroyer-capsule-fired-from-turret"
destroyerCapsuleAsTurretProjectile.action.action_delivery.target_effects.entity_name = "destroyer-short-life-no-follow"
data:extend( { destroyerCapsuleAsTurretProjectile } )

-- Customized Combat Robots --
-- distractor shortened life
local shortLifeDistractor = util.table.deepcopy(data.raw["combat-robot"]["distractor"])
shortLifeDistractor.name = "distractor-short-life"
shortLifeDistractor.time_to_live = 60 * 20
data:extend( { shortLifeDistractor } )

-- defender shortened life no follow
local shortLifeDefender = util.table.deepcopy(data.raw["combat-robot"]["defender"])
shortLifeDefender.name = "defender-short-life-no-follow"
shortLifeDefender.follows_player = false
shortLifeDefender.time_to_live = 60 * 20
data:extend( { shortLifeDefender } )

-- destroyer shortened life no follow
local shortLifeDestroyer = util.table.deepcopy(data.raw["combat-robot"]["destroyer"])
shortLifeDestroyer.name = "destroyer-short-life-no-follow"
shortLifeDestroyer.follows_player = false
shortLifeDestroyer.time_to_live = 60 * 20
data:extend( { shortLifeDestroyer } )

kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.12.22][Modded] [kovarex] Hard Crash with no Log Entry on Hover

Post by kovarex »

This is too much info to process, it still looks like it is making infinite recursion, it shouldn't crash though, but I'm not sure if it is worth fixing it for the faulty definition.

If you can make minimal case that still crashes the game (and you believe there is no infinite recursion), I can look at it.
Peppe
Fast Inserter
Fast Inserter
Posts: 223
Joined: Fri Nov 28, 2014 6:48 pm
Contact:

Re: [0.12.22][Modded] [kovarex] Hard Crash with no Log Entry on Hover

Post by Peppe »

Ok here is a version of the mod that fires vanilla combat robot capsule projectiles using the same methods as firing grenades, slow, and poison capsules. So the data.lua is basically empty.
All we have is a modified gun turret that accepts "capsule" category ammo. And capsule ammo magazines that match that category that create a projectile the same as when a player throws the capsule.

And a save game with 6 "capsule-turrets" loaded with each type of ammo. You can walk left to trigger some bitters.

All turrets fire and work.

The 3 on the left can be hovered: they have grenades, slow, and poison capsule magazine ammo in them.
The 3 on the right cannot be hovered: they have destroyer, distractor, and defender magazine capsules in them.
Attachments
capsule_test2.zip
Save with crash prepped.
(1.34 MiB) Downloaded 184 times
Capsule-Turrets_0.0.1.zip
Fires vanilla combat robots.
(25.91 KiB) Downloaded 162 times
Peppe
Fast Inserter
Fast Inserter
Posts: 223
Joined: Fri Nov 28, 2014 6:48 pm
Contact:

Re: [0.12.22][Modded] [kovarex] Hard Crash with no Log Entry on Hover

Post by Peppe »

Tried a few random things to see if anything else will crash.

I tried land mines and enemy units and they all work. A capsule projectile fires and spawns the unit and then they fight for me. I can hover the turret and it shows what unit it will spawn and basic info about the ammo.

Crash seems to only be on hovering an ammo turret that creates an entity of type = "combat-robot".

It will happily shoot/hover correctly a random sampling of things in the entities LUA (tanks, parts of the silo rocket, enemy units).

I can create change the turret type to "turret" and have it fire combat robot capsule projectiles that spawn combat robots the same as the player throwing them. I can hover that non ammo using turret, but it has no hover info about what damage it will do and does not let you change what it shoots. type ="turret" looks to be for worms.
CmdrKeen
Long Handed Inserter
Long Handed Inserter
Posts: 98
Joined: Tue Sep 29, 2015 9:03 pm
Contact:

Re: [0.12.22][Modded] [kovarex] Hard Crash with no Log Entry on Hover

Post by CmdrKeen »

ignoring the mouse-over issue, distractor ammo works correctly:

https://gfycat.com/UnevenRealisticAfricanpiedkingfisher
Rseding91
Factorio Staff
Factorio Staff
Posts: 15924
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.12.22][Modded] [kovarex] Hard Crash with no Log Entry on Hover

Post by Rseding91 »

Thanks for the minimal mod to reproduce the issue. It's now fixed for 0.12.23.
If you want to get ahold of me I'm almost always on Discord.
Peppe
Fast Inserter
Fast Inserter
Posts: 223
Joined: Fri Nov 28, 2014 6:48 pm
Contact:

Re: [0.12.22][Modded] [kovarex] Hard Crash with no Log Entry on Hover

Post by Peppe »

Rseding91 wrote:Thanks for the minimal mod to reproduce the issue. It's now fixed for 0.12.23.
Nice. You guys are doing great work hope the steam release is everything you planned and hoped for!
Post Reply

Return to “Resolved Problems and Bugs”