View previous topic :: View next topic |
Author |
Message |
Smellyhobo101 Newbie cheater Reputation: 0
Joined: 21 Sep 2014 Posts: 23
|
Posted: Mon Sep 05, 2016 2:37 pm Post subject: Performance issues using LuaFunctionCall |
|
|
I wanted to use LuaFunctionCall to hook the main game loop with a lua function. The game is 60fps so it calls 60 times per second. When the hook is running CE's CPU usage jumps up to 20%. The function has nothing in it. The function call itself is using that much CPU. This causes quite a bit of lag in game. Is LuaFunctionCall not meant to be called that frequently?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Mon Sep 05, 2016 2:53 pm Post subject: |
|
|
there is a bit of overhead yes. (parsing the script every time, waiting till the main thread is ready to process the event, and wait for the result)
What are your intentions in your code? Update the CE gui, or just do calculations ?
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
Smellyhobo101 Newbie cheater Reputation: 0
Joined: 21 Sep 2014 Posts: 23
|
Posted: Mon Sep 05, 2016 3:03 pm Post subject: |
|
|
I was making mod support for a fighting game called Lethal League. So mainly calculations and reading/writing the games memory. Calling the empty function is already causing too many performance issues though. Wish I noticed this sooner.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Mon Sep 05, 2016 3:19 pm Post subject: |
|
|
Is it really necessary to call it every single frame ?
Otherwise you could call it every 10 frames. Just add a counter in assembler that every time the value is dividable by 10 it calls the function
But i'll see about making a faster function (may be harder to use though)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
Smellyhobo101 Newbie cheater Reputation: 0
Joined: 21 Sep 2014 Posts: 23
|
Posted: Mon Sep 05, 2016 3:46 pm Post subject: |
|
|
Dark Byte wrote: | Is it really necessary to call it every single frame |
Its necessary for a lot of things. Like if i want to force a player to do an input sequence or make custom physics/game mechanics. I had some lua objects set up so I could really easily read/write properties of the ball, players, and stage. example:
Code: |
-- When player 1 has full meter they can move twice as fast
function gameLoop()
if Player1:readProperty("special_meter") == 4 then
Player1:writeProperty("max_velocity", 50)
else
Player1:writeProperty("max_velocity", 25)
end
end
|
Mods like that would only be possible if I can hook the game loop on every frame. I've used timers in the past but that isnt reliable for online play where all clients need to stay in sync. Of course I can still do things like that in ASM, but my intention was for this to be an accessible modding tool for the Lethal League community. I'm still working out what is causing the performance issues though. Sometimes it runs smoothly even with the hooks running. Even some fairly minor stuttering is a problem in a fighting game though. All i know is as soon as i have a hook running CE jumps up to 20% CPU usage. My CPU is an i5-4670k so I'm worried that it would be much worse on lower end machines.
Dark Byte wrote: |
But i'll see about making a faster function (may be harder to use though)
|
That would be amazing. Thanks!
|
|
Back to top |
|
|
|