Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New component: Dynamic FPS Change #124

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

4Luke4
Copy link
Contributor

@4Luke4 4Luke4 commented Dec 20, 2024

This component will automatically adjust FPS during playthrough.
When in combat or cutscene, will lock FPS to 30. Otherwise, will set them to 60.

@rubyFeedback
Copy link

There should also be a new release. Last one has been 2 years ago.

@4Luke4
Copy link
Contributor Author

4Luke4 commented Dec 22, 2024

There should also be a new release. Last one has been 2 years ago.

That is up to Cam... It will hopefully update during the holidays...

@snaphat
Copy link

snaphat commented Dec 25, 2024

@4Luke4 This stops working after leaving candlekeep and viewing the Sarvok cutscene in BGEE.

Steps to reproduce:

  1. Install BGEE with SOD v2.6.6
  2. Use DLCMerger (probably unrelated?)
  3. Install EEex v0.10.2.1-alpha
  4. Compile PR 124 using ModPackaging, Install CDTWEAKS, enabling only Dynamic FPS Change
  5. Run InfinityLoader.exe
  6. Start new game
  7. Leave CandleKeep
  8. watch cutscene until able to control the game normally again
  9. Stuck in 30FPS

WeiDU.log

// Log of Currently Installed WeiDU Mods
// The top of the file is the 'oldest' mod
// ~TP2_File~ #language_number #component_number // [Subcomponent Name -> ] Component Name [ : Version]
~DLCMERGER/DLCMERGER.TP2~ #0 #3 // Merge DLC into game -> Merge all available DLCs: 1.7
~EEEX/EEEX.TP2~ #0 #0 // EEex: v0.10.2.1-alpha
~CDTWEAKS/SETUP-CDTWEAKS.TP2~ #0 #3440 // Dynamic FPS Change [Luke (EEex)]: v16

@4Luke4
Copy link
Contributor Author

4Luke4 commented Dec 26, 2024

@snaphat
Thank you, will investigate.
I tested it with the initial cutscene in iwd:ee, and everything works fine...
I think I need a more robust way to detect the end of a cutscene...

@4Luke4 4Luke4 marked this pull request as draft December 26, 2024 13:56
@snaphat
Copy link

snaphat commented Dec 27, 2024

@snaphat Thank you, will investigate. I tested it with the initial cutscene in iwd:ee, and everything works fine... I think I need a more robust way to detect the end of a cutscene...

Any reason using StartCutSceneMode (ID 121) isn't robust:

EEex_Opcode_AddListsResolvedListener(function(sprite)
	-- Sanity check
	if not EEex_GameObject_IsSprite(sprite) or not sprite.m_pArea then
		return
	end
	--
	local actuallyInCombat = sprite.m_pArea.m_nBattleSongCounter > 0
	--
	if EEex_GameState_GetGlobalInt("gtCutSceneMode") == 1 or actuallyInCombat then
	    if EEex_CChitin.TIMER_UPDATES_PER_SECOND ~= 30 then
		    EEex_CChitin.TIMER_UPDATES_PER_SECOND = 30
	    end
	else
	    if EEex_CChitin.TIMER_UPDATES_PER_SECOND ~= 60 then
		    EEex_CChitin.TIMER_UPDATES_PER_SECOND = 60
	    end
	end
end)

-- Set/Reset helper var to 1/0 upon entering and exiting cutscene mode --

EEex_Action_AddSpriteStartedActionListener(function(sprite, action)
	local actionID = action.m_actionID

	if actionID == 121 then
		EEex_GameState_SetGlobalInt("gtCutSceneMode", 1)
	elseif actionID == 122 then
		EEex_GameState_SetGlobalInt("gtCutSceneMode", 0)
	end
end)

Or just using m_inCutScene directly since it appears to go to 0 when the cutscene is finished and is 1 otherwise (In BGEE):

EEex_Opcode_AddListsResolvedListener(function(sprite)
	-- Sanity check
	if not EEex_GameObject_IsSprite(sprite) or not sprite.m_pArea then
		return
	end
	--
	local actuallyInCombat = sprite.m_pArea.m_nBattleSongCounter > 0
	--
	if sprite.m_inCutScene == 1 or actuallyInCombat then
	    if EEex_CChitin.TIMER_UPDATES_PER_SECOND ~= 30 then
		    EEex_CChitin.TIMER_UPDATES_PER_SECOND = 30
	    end
	else
	    if EEex_CChitin.TIMER_UPDATES_PER_SECOND ~= 60 then
		    EEex_CChitin.TIMER_UPDATES_PER_SECOND = 60
	    end
	end
end)

@4Luke4
Copy link
Contributor Author

4Luke4 commented Dec 27, 2024

@snaphat

The first proposed solution should work, we just need to take into account all the actions (IDs) that can start a cutscene (not just 121...)
Will update...

@snaphat
Copy link

snaphat commented Dec 30, 2024

Some additional information in BGEE while utilizing the first proposal:

  1. The game does not change to 30 fps during battle with the Xvarts in the Xvart Cave at the Gnoll Stronghold (bottom-left). This would seem to indicate that checking sprite.m_pArea.m_nBattleSongCounter > 0 is not sufficient to determine combat state.
  2. The game becomes stuck at 30 fps (confirmed to have gtCutSceneMode set to 1) after the battle against Senjak and Dorotea in the location where Dorn is initially recruited. This seems to indicate that checking actionID == 122 is not sufficient to determine cutscene end state.

@4Luke4
Copy link
Contributor Author

4Luke4 commented Jan 4, 2025

Some additional information in BGEE while utilizing the first proposal:

  1. The game does not change to 30 fps during battle with the Xvarts in the Xvart Cave at the Gnoll Stronghold (bottom-left). This would seem to indicate that checking sprite.m_pArea.m_nBattleSongCounter > 0 is not sufficient to determine combat state.
  2. The game becomes stuck at 30 fps (confirmed to have gtCutSceneMode set to 1) after the battle against Senjak and Dorotea in the location where Dorn is initially recruited. This seems to indicate that checking actionID == 122 is not sufficient to determine cutscene end state.

I see.
If that is the case, then I'll have to speak with Bubb for a more robust solution...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants