SailorSat
-
Posts
9 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by SailorSat
-
-
Seriously... After playing with 2.0 for some days now, I really like most of the ideas.
However - I absolutely don't like being dictated how to play the game.
I don't want to be forced to use many smaller ships. I prefer to play with less, but more bulky ships.
I'd like to build a R-Miner/Freighter, out of titan, but I cannot, because adding any decent amount of cargo space boosts up the processing power so far, I cannot build the ship in the first place.
We are talking about a medium sized titan freighter/miner, that costs roughly 60k titan, but would need like 8 system slots. - If I reduce the cargo hold, I need to visit a refinery like every 10 minutes of mining.
Lock those slots (for placing systems in there) until they get them unlocked by the required tech, but don't forbid people to use (older) large blueprints.
I can build a "flying rock" to cheese my way through some certain bosses, but I am not allowed to fly a large chunk piece of scrap, because "cargo space" adds to much processing power?
-
Simple problem…
You cruise around some sector with auto-salvaging turrets, fly near a station (to dock) - and you discover there seems to be some tiny piece of wreckage near the station which your salvage laser auto targets, and although it does absolutely ZERO damage to shields, you loose all your reputation in mere seconds...
Seriously…
-
I'll wait for 0.21 before trying to update anything :)
-
I don't think so - whatever the ships do in "attack mode" is up the the core game.
-
Hm... As long as the AI switches to "attack mode" I doubt we can change that.
Same goes for salvaging I guess.
Another thing I've been thinking about are alliance ships - they currently don't report if they are done - I've seen that in the 0.17.1 beta one could send messages to a faction - on the other hand we might use the alliance chat for that.
-
I reuploaded r1 with a small bugfix (the old one would send you 15 messages if a ship is stuck)
-
Hm... Well the script sure does some additional checks (distance to asteroid, velocity of the ship). I don't know how "fly mode" compares to "attack mode" performance wise.
I guess over all the performance should be similar - but I didn't profile that script yet.
-
Hi folks,
I've tweaked the mining AI (based on beta 0.16.7).
features
-
fly towards mineable asteroids
the stock ai goes into "attack mode" right away and hence crawls slowly across a sector to reach asteroids.
this mod ai does check the distance and actually fly towards an asteroid before attacking (= way faster travel between asteroids)
-
basic stuck detection
the stock ai might get "stuck" in between other asteroids.
this mod ai does check ship movement and will switch to the nearest asteroid (even those without resources) after 15 seconds of near standstill.
if the ai is stuck for 5 minutes, a warning will be sent to the player.
known issues
- unstuck won't work if all mining turrets are on "auto fire"; have at least one of them on manual
possible features
- if there are no rich asteroids left send a message to the player and start mining the other asteroids instead of going idle.
to install
- go to data\scripts\entity\ai
- copy mine.lua to mine.old
- replace mine.lua with the mod one
history
- 2018-05-01 r1: initial release (fly, stuck detection)
package.path = package.path .. ";data/scripts/lib/?.lua" require ("stringutility") -- Don't remove or alter the following comment, it tells the game the namespace this script lives in. If you remove it, the script will break. -- namespace AIMine AIMine = {} -- start of config options local lootDistance = 150 * 150 -- 1.5km local mineDistance = 150 * 150 -- 1.5km local stuckThreshold = 1.5 * 1.5 -- 15 m/s -- end of config options local canMine = nil local minedLoot = nil local minedAsteroid = nil local lootCounter = 0 local stuckLevel = 0 local stuckCounter = 0 function AIMine.getUpdateInterval() return 1 end -- this function will be executed every frame on the server only function AIMine.updateServer(timeStep) local ship = Entity() if canMine == nil then AIMine.checkIfAbleToMine() end if ship.hasPilot or ship:getCrewMembers(CrewProfessionType.Captain) == 0 then terminate() return end -- find an asteroid that can be harvested AIMine.updateMining(timeStep) end -- check if there are mining turrets or fighters function AIMine.checkIfAbleToMine() if onServer() then local ship = Entity() if ship.numTurrets > 0 then canMine = true else local hangar = Hangar() local squads = {hangar:getSquads()} for _, index in pairs(squads) do local category = hangar:getSquadMainWeaponCategory(index) if category == WeaponCategory.Mining then canMine = true break end end end if not canMine then local player = Player(Entity().factionIndex) if player then player:sendChatMessage("Server", ChatMessageType.Error, "Your ship needs mining turrets or fighters to mine."%_T) end terminate() end end end -- check the immediate region around the ship for loot that can be collected -- if there is some, assign minedLoot function AIMine.findMinedLoot() local loots = {Sector():getEntitiesByType(EntityType.Loot)} local ship = Entity() minedLoot = nil for _, loot in pairs(loots) do if loot:isCollectable(ship) and distance2(loot.translationf, ship.translationf) < lootDistance then minedLoot = loot break end end end -- check the sector for an asteroid that can be mined -- if there is one, assign minedAsteroid function AIMine.findMinedAsteroid(checkResources) local ship = Entity() local sector = Sector() minedAsteroid = nil local asteroids = {sector:getEntitiesByType(EntityType.Asteroid)} local nearest = math.huge for _, a in pairs(asteroids) do local validCandidate = true if checkResources then local resources = a:getMineableResources() validCandidate = resources ~= nil and resources > 0 end if validCandidate then local dist = distance2(a.translationf, ship.translationf) if dist < nearest then nearest = dist minedAsteroid = a end end end if minedAsteroid then broadcastInvokeClientFunction("setMinedAsteroid", minedAsteroid.index) else local player = Player(Entity().factionIndex) if player then local x, y = Sector():getCoordinates() local coords = tostring(x) .. ":" .. tostring(y) player:sendChatMessage(ship.name or "", ChatMessageType.Error, "Your mining ship in sector %s can't find any more asteroids."%_T, coords) player:sendChatMessage(ship.name or "", ChatMessageType.Normal, "Sir, we can't find any more asteroids in \\s(%s)!"%_T, coords) end ShipAI(ship.index):setPassive() ship:invokeFunction("craftorders.lua", "setAIAction") terminate() end end -- check if we are stuck -- if stuck, try to get free by mining nearest asteroid function AIMine.checkIfStuck(timeStep) local ship = Entity() local v = Velocity(ship.index) if valid(v) then local s = length2(v.velocityf) if s < stuckThreshold then stuckLevel = stuckLevel + 1 if stuckLevel == 15 then -- no movement for 15 seconds stuckLevel = 0 stuckCounter = stuckCounter + 15 -- switch target to nearest asteroid AIMine.findMinedAsteroid(false) end if stuckCounter == 300 then -- stuck for 300 seconds stuckCounter = 0 local player = Player(Entity().factionIndex) if player then local x, y = Sector():getCoordinates() local coords = tostring(x) .. ":" .. tostring(y) player:sendChatMessage(ship.name or "", ChatMessageType.Information, "Your mining ship in sector %s may be stuck."%_T, coords) player:sendChatMessage(ship.name or "", ChatMessageType.Normal, "Sir, we may be stuck in \\s(%s)!"%_T, coords) end end else -- movement stuckLevel = 0 stuckCounter = 0 end end end function AIMine.updateMining(timeStep) -- highest priority is collecting the resources if not valid(minedAsteroid) and not valid(minedLoot) then -- first, check if there is loot to collect AIMine.findMinedLoot() -- then, if there's no loot, check if there is an asteroid to mine if not valid(minedLoot) then AIMine.findMinedAsteroid(true) end end local ship = Entity() local ai = ShipAI() if valid(minedLoot) then -- there is loot to collect, fly there lootCounter = lootCounter + timeStep if lootCounter > 3 then lootCounter = lootCounter - 3 ai:setFly(minedLoot.translationf, 0) end elseif valid(minedAsteroid) then -- check if stuck AIMine.checkIfStuck() -- check distance to asteroid local d2 = distance2(ship.translationf, minedAsteroid.translationf) if d2 <= mineDistance then -- we are close, attack it if ship.selectedObject == nil or ship.selectedObject.index ~= minedAsteroid.index or ai.state ~= AIState.Attack then ai:setAttack(minedAsteroid) end else -- too far away, approach it ai:setFly(minedAsteroid.translationf, 0) end end end function AIMine.setMinedAsteroid(index) minedAsteroid = Entity(index) end ---- this function will be executed every frame on the client only --function updateClient(timeStep) -- -- if valid(minedAsteroid) then -- drawDebugSphere(minedAsteroid:getBoundingSphere(), ColorRGB(1, 0, 0)) -- end --end
-
fly towards mineable asteroids
Avorion file hand leak?
in Bugs
Posted
Howdy! I usually play longer sessions of Avorion - and after some time (we are talking hours here) icons start to disappear, then soon after everything goes south.
2021-09-20 00-52-17| Starting thread [Stacktrace Sender]... 2021-09-20 00-52-17| Started thread [Stacktrace Sender] with id 400 2021-09-20 00-52-17| "data/scripts/entity/ai/salvage.lua":setObjectToHarvest: Remote call Error: Function doesn't exist. 2021-09-20 00-52-17| "data/scripts/entity/ai/salvage.lua":setObjectToHarvest: Remote call Error: Function doesn't exist. 2021-09-20 00-52-18| T: 1 2021-09-20 00-52-18| Object: N2cp13ClientScriptsE 2021-09-20 00-52-18| Execution Context (inner to outer): 2021-09-20 00-52-18| #0: data/scripts/entity/init.lua 2021-09-20 00-52-18| 2021-09-20 00-52-18| Error while adding file data/scripts/entity/init.lua: 2021-09-20 00-52-18| cannot open data/scripts/entity/init.lua: Too many open files 2021-09-20 00-52-18| 2021-09-20 00-52-18| Starting thread [Stacktrace Sender]... 2021-09-20 00-52-18| Started thread [Stacktrace Sender] with id 401 2021-09-20 00-52-19| failed to load texture from file "data/textures/icons/player.png" 2021-09-20 00-52-19| failed to load texture from file "data/textures/icons/sector.png" 2021-09-20 00-52-19| failed to load texture from file "data/textures/icons/strategy.png" 2021-09-20 00-52-19| failed to load texture from file "data/textures/icons/envelope.png" 2021-09-20 00-52-19| failed to load texture from file "data/textures/icons/player_trade.png" 2021-09-20 00-52-19| failed to load texture from file "data/textures/icons/robot.png" 2021-09-20 00-52-19| failed to load texture from file "data/textures/icons/drone.png" 2021-09-20 00-52-19| failed to load texture from file "data/textures/icons/flying-flag.png" 2021-09-20 00-52-19| T: 1 2021-09-20 00-52-19| Object: N2cp13ClientScriptsE 2021-09-20 00-52-19| Execution Context (inner to outer): 2021-09-20 00-52-19| #0: data/scripts/entity/init.lua 2021-09-20 00-52-19| 2021-09-20 00-52-19| Error while adding file data/scripts/entity/init.lua: 2021-09-20 00-52-19| cannot open data/scripts/entity/init.lua: Too many open files 2021-09-20 00-52-19| 2021-09-20 00-52-19| Starting thread [Stacktrace Sender]... 2021-09-20 00-52-19| Started thread [Stacktrace Sender] with id 402 2021-09-20 00-52-19| T: 1 2021-09-20 00-52-19| Object: N2cp13ClientScriptsE 2021-09-20 00-52-19| Execution Context (inner to outer): 2021-09-20 00-52-19| #0: data/scripts/entity/init.lua 2021-09-20 00-52-19| 2021-09-20 00-52-19| Error while adding file data/scripts/entity/init.lua: 2021-09-20 00-52-19| cannot open data/scripts/entity/init.lua: Too many open files
The log file at that point is spewing out loads and loads of "Too many open files" errors.
Avorion.exe at that point has like 2050+ open file handles.