!bZkoSqWsCTysAjmRaC:matrix.org

OpenMW Lua

237 Members
3 Servers

Load older messages


SenderMessageTime
1 Aug 2021
@_discord_228460481331855362:t2bot.iosjek#1254 yep. and local scripts are run once per onactive event, printing a log,
after first global script run.
then global list all items(weapons) by onUpdate.
18:49:43
@_discord_228460481331855362:t2bot.iosjek#1254 every frame 18:50:11
@_discord_228460481331855362:t2bot.iosjek#1254 * yep. and local scripts are run once per onactive event, printing a log,
after first global script run.
then global list all items(weapons) by onUpdate.
18:53:11
@_discord_695357027072999617:t2bot.ioptmikheev#0216 Currently engine expects that only actors can walk. TES3MP synchronizes only actor movements. If we decide that local scripts on items should be able to perform any movement, then TES3MP would need to synchronize everything. And it can be costly. 18:56:38
@_discord_695357027072999617:t2bot.ioptmikheev#0216 I think that all cyclic movements that have only visual effect (like weapon rotation) should be done via animation. This way it is simpler and more performance efficient. 18:59:16
@_discord_654120370235768832:t2bot.ioHemaris#9366 I think sjek’s eventual goal is to make weapons fly around the player, not only spin in place 19:31:46
@_discord_648127597397409793:t2bot.ioQuote#8404

not really a gravity gun alltho it would be cool xD
the weapons would spin around player in circular motion (on a plane or something simple enought code vise) and do aoe damage depending of distance from the player so there wouldn't be physics involved. tho this might indeed need a way to turn collision of from those weapons.

path of exile very likely do this by texture around player and calculates just the distance for performance reasons.

on gravity gun: if there is or gonna be a way to get player/camera position and rotation, it would just need a way to move the item along specific trajectory. getting if it hits something after firing... assuming raytesting.

Quoted by Hemaris#9366 from #lua

19:32:38
@_discord_102182125494636544:t2bot.iourm#2224 I think basic stuff like that should 100% be doable from local scripts 19:35:31
@_discord_255475367626670091:t2bot.ioPriestOfIlunibi
If we decide that local scripts on items should be able to perform any movement, then TES3MP would need to synchronize everything.
Wouldn't the simplest solution to a problem like this just be to only update the synchronization of objects that have changed position, rather than checking everything's position? This is basically already what TES3MP does with a lot of variables for clients, like state.
20:15:28
@_discord_255475367626670091:t2bot.ioPriestOfIlunibi Unless I'm just misunderstanding where the performance loss is from, updating positions for a lot of objects isn't insanely costly. There are scripts that try to do similar things, such as https://github.com/rickoff/Tes3mp-Ecarlate-Script/blob/0.7.0/ResetCell/Tutorial.txt which deletes the original set of references for everything in a cell and spawns a new set every time it wants to reset, which is mildly costly but not terrible from my experience, and I've been working on a similar system myself 20:24:46
@_discord_102182125494636544:t2bot.iourm#2224 https://www.youtube.com/watch?v=Fyf8nqAJUS8 21:10:26
@_discord_102182125494636544:t2bot.iourm#2224 global script
local world = require('openmw.world')
local query = require('openmw.query')

local meatIds = {
  'ingred_6th_corprusmeat_01',
  'ingred_6th_corprusmeat_02',
  'ingred_6th_corprusmeat_03',
  'ingred_6th_corprusmeat_04',
  'ingred_6th_corprusmeat_05',
  'ingred_6th_corprusmeat_06',
  'ingred_6th_corprusmeat_07',
}
local filter = query.OBJECT.recordId:eq(meatIds[1])
for i = 2, #meatIds do
  filter = filter + query.OBJECT.recordId:eq(meatIds[i])
end
local meatQuery = query.items:where(filter)

return {
  engineHandlers = {
    onUpdate = function(obj)
      local objects = world.selectObjects(meatQuery)
      for _, obj in objects:ipairs() do
        obj:addScript('ThrobbingMeat/throb.lua')
      end
    end
  }
}
21:13:29
@_discord_102182125494636544:t2bot.iourm#2224 local script
local vec3 = require('openmw.util').vector3
local self = require('openmw.self')

local t = math.random() * 2 * math.pi
local rate = 0.4 * math.pi
local amplitude = 0.03
local randomness = 0.5

return {
  engineHandlers = {
    onUpdate = function(dt)
      t = t + dt * ( rate + ( 2 * math.random() - 1 ) * randomness )
      self.object:scale(math.sin(t) * amplitude + 1.0)
    end
  }
}
21:13:49
@_discord_102182125494636544:t2bot.iourm#2224 the global part is actually extremely slow (at least in debug) compared to the local part 21:14:32
@_discord_102182125494636544:t2bot.iourm#2224 like 100+ times slower 21:14:38
@_discord_102182125494636544:t2bot.iourm#2224 * local script
local vec3 = require('openmw.util').vector3
local self = require('openmw.self')

local t = math.random() * 2 * math.pi
local rate = 0.4 * math.pi
local amplitude = 0.03
local randomness = 0.5

return {
  engineHandlers = {
    onUpdate = function(dt)
      t = t + dt * ( rate + ( 2 * math.random() - 1 ) * randomness )
      self.object:scale(math.sin(t) * amplitude + 1.0)
    end
  }
}
21:15:02
@_discord_102182125494636544:t2bot.iourm#2224 an onObjectActive handler would be ideal for this 21:16:23
@_discord_255475367626670091:t2bot.ioPriestOfIlunibi Are the API packages using the C API, or FFI (I assume C API since it was mentioned before that default 5.1 compatability is the goal)? If it's using the C API, that's probably why it's so slow 21:17:46
@_discord_102182125494636544:t2bot.iourm#2224 btw this awkward construction made me realize we need a query.any() or some other way to get an empty filter
local filter = query.OBJECT.recordId:eq(meatIds[1])
for i = 2, #meatIds do
  filter = filter + query.OBJECT.recordId:eq(meatIds[i])
end
21:18:11
@_discord_102182125494636544:t2bot.iourm#2224 no, it's probably slow because it literally goes through every single object in the loaded cells every frame 21:18:45
@_discord_102182125494636544:t2bot.iourm#2224 and picks out the ones that matter 21:18:48
@_discord_102182125494636544:t2bot.iourm#2224 which is also mostly implemented in Lua 21:19:05
@_discord_255475367626670091:t2bot.ioPriestOfIlunibi That's terrible. Is there not a way to streamline that? 21:19:14
@_discord_102182125494636544:t2bot.iourm#2224 I could probably write something more clever 21:19:24
@_discord_102182125494636544:t2bot.iourm#2224 But I didn't want to write too much code for this simple thing 21:19:34
@_discord_102182125494636544:t2bot.iourm#2224 And we need a better way to track objects being added to the scene anyway 21:19:45
@_discord_102182125494636544:t2bot.iourm#2224 we already have an onActorActive 21:19:52
@_discord_102182125494636544:t2bot.iourm#2224 so I imagine onObjectActive not existing is not deliberate 21:20:07
@_discord_255475367626670091:t2bot.ioPriestOfIlunibi Can it only access the loaded cells? If you can access any cell, maybe the best method would be some kind of preloading and caching on load/start where you get the query result beforehand and attach the script in relevant cells or when an instance of corprus meat is placed 21:22:25
@_discord_102182125494636544:t2bot.iourm#2224 Nah, that's way overkill too (although not possible yet anyway) 21:23:08

There are no newer messages yet.


Back to Room List