Skip to content

Allow custom FPS values for each GameSpeed index#2092

Open
11EJDE11 wants to merge 4 commits intoPhobos-developers:developfrom
11EJDE11:custom-fps
Open

Allow custom FPS values for each GameSpeed index#2092
11EJDE11 wants to merge 4 commits intoPhobos-developers:developfrom
11EJDE11:custom-fps

Conversation

@11EJDE11
Copy link
Contributor

@11EJDE11 11EJDE11 commented Feb 5, 2026

  • Deprecates CustomGS ini keys
  • Adds EnableCustomFPS and CustomGameSpeedFPS

Add to RulesMD.ini

;note: use 0 for the game's default fps for that index
[General]
EnableCustomFPS=True
CustomGameSpeedFPS.0=100
CustomGameSpeedFPS.1=90
CustomGameSpeedFPS.2=80
CustomGameSpeedFPS.3=70
CustomGameSpeedFPS.4=60
CustomGameSpeedFPS.5=0 ;default
CustomGameSpeedFPS.6=0 ;default

This PR allows for custom FPS values for each of the GameSpeed indices. Applies to Campaign, Skirmish, and Multiplayer.

For multiplayer we hook into Queue_AI_Multiplayer to override the hardcoded 60fps cap, and override the GameSpeed index to fps calculation.

For Skirmish and Campaign, we hook in main loop to set up the NFTTimer that is used in multiplayer. We then hook into SyncDelay and force skirmish/campaign down the multiplayer path instead.

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@Metadorius
Copy link
Member

...did you just make teh game be able to run on any FPS online?

@11EJDE11
Copy link
Contributor Author

11EJDE11 commented Feb 5, 2026

Yeah. I got up to 140fps LAN.

Comment on lines 58 to 72
struct NFTTimerStruct
{
if (Phobos::Misc::CustomGS && SessionClass::IsSingleplayer())
FrameTimer.TimeLeft = GameOptionsClass::Instance.GameSpeed;
return 0;
}
DWORD StartTime;
DWORD CurrentTime;
int TimeLeft;
};
DEFINE_REFERENCE(NFTTimerStruct, NFTTimer, 0x887328);

// note: currently vanilla code, doesn't do anything, changing PrecalcDesiredFrameRate doesn't effect anything either
/*
void SetNetworkFrameRate()
struct FrameTimerStruct
{
DEFINE_REFERENCE(int, PrecalcDesiredFrameRate, 0xA8B550u)
switch (GameOptionsClass::Instance.GameSpeed)
DWORD StartTime;
DWORD CurrentTime;
int DelayTime;
};
DEFINE_REFERENCE(FrameTimerStruct, GameFrameTimer, 0x887348);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think those may already exist in YRpp? There's some confusion with them there, maybe @ZivDero could help.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not seeing them there. There's Timer.h but that looks more like something you'd create rather than use when accessing existing ones?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think those may already exist in YRpp? There's some confusion with them there, maybe @ZivDero could help.

Well the structs at least exist at
https://github.com/Phobos-developers/YRpp/blob/7a43c8bc7872d81c27ce470a4f0bf4d1c3a8e224/Timer.h

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addresses don't seem to show up in YRpp so they're probably not in; Should be added there instead.
Their names are FrameTimer (from RA) and the other one we called NetworkFrameTimer.

CDTimerClass<SystemTimerClass> FrameTimer;

CDTimerClass<MillisecondSystemTimerClass> NetworkFrameTimer;

CDTimerClass is what YRpp calls TimerStruct. SystemTimerClass is just SystemTimer.
MillisecondSystemTimerClass however is not present in YRpp it seems, and it is not the same as SystemTimerClass or MillisecondTimerClass.

I would provide the address but IDA isn't cooperating...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting at 5D5870, ctor, dtor, operator(), operator long

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Ziv. Can you please check Phobos-developers/YRpp#59


Results (remember to replace N with your game speed number!):
- Each of the 7 game speed slider positions (GameSpeed 0-6) can have a custom target FPS set independently. A value of `0` keeps that position at its vanilla FPS.
- Works in skirmish, campaign, and multiplayer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should spell out explicitly that they will be unified now, so that the modders must disable the different game speed scales in client now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines -109 to -117
In `rulesmd.ini`:
```ini
[General]
CustomGS=false ; boolean
CustomGSN.ChangeInterval=-1 ; integer >= 1
CustomGSN.ChangeDelay=N ; integer between 0 and 6
CustomGSN.DefaultDelay=N ; integer between 0 and 6
; where N = 0, 1, 2, 3, 4, 5, 6
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should add migration entries to docs and the migration script (see FIXME entries)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

b1e580f

Sorry, not seeing any FIXME?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ctrl+F in migration script (see Phobos Supplementaries repo)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CnCRAZER
Copy link
Contributor

CnCRAZER commented Feb 5, 2026

Yeah. I got up to 140fps LAN.

LOL

I love it!

@tomsons26
Copy link
Collaborator

I speculate NFT is for NetworkFrameTimer btw

@TaranDahl TaranDahl added ⚙️T1 T1 maintainer review is sufficient ❓Unhardcoding / Customization Make something more tweakable Needs MP testing This PR needs to be tested for desync. labels Feb 6, 2026
Update comments
Update docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs MP testing This PR needs to be tested for desync. ⚙️T1 T1 maintainer review is sufficient ❓Unhardcoding / Customization Make something more tweakable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Comments