Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Source/Entities/Activity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "GUIFont.h"
#include "AllegroBitmap.h"

#include "RTETools.h"

namespace RTE {

AbstractClassInfo(Activity, Entity);
Expand Down Expand Up @@ -284,6 +286,9 @@ void Activity::Clear() {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int Activity::Start() {
// Reseed the RNG for determinism
SeedRNG();

if (m_ActivityState != ActivityState::Editing) {
m_ActivityState = ActivityState::Running;
}
Expand Down
10 changes: 6 additions & 4 deletions Source/Entities/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1287,15 +1287,17 @@ void Actor::OnNewMovePath() {
//////////////////////////////////////////////////////////////////////////////////////////

void Actor::PreControllerUpdate() {
if (m_UpdateMovePath) {
UpdateMovePath();
}

if (m_PathRequest && m_PathRequest->complete) {
m_MovePath = const_cast<std::list<Vector> &>(m_PathRequest->path);
m_PathRequest.reset();
OnNewMovePath();
}

// We update this after, because pathing requests are forced to take at least 1 frame for the sake of determinism for now.
// In future maybe we can move this back, but it doesn't make much difference (the threadpool submission overhead makes it extremely unlikely that it would complete in less time anyways)
if (m_UpdateMovePath) {
UpdateMovePath();
}
}

//////////////////////////////////////////////////////////////////////////////////////////
Expand Down
7 changes: 6 additions & 1 deletion Source/Managers/LuaMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,12 @@ namespace RTE {
void LuaMan::Initialize() {
m_MasterScriptState.Initialize();

m_ScriptStates = std::vector<LuaStateWrapper>(std::thread::hardware_concurrency());
int luaStateCount = std::thread::hardware_concurrency();
if (g_SettingsMan.GetNumberOfLuaStatesOverride() != -1) {
luaStateCount = g_SettingsMan.GetNumberOfLuaStatesOverride();
}

m_ScriptStates = std::vector<LuaStateWrapper>(luaStateCount);
for (LuaStateWrapper &luaState : m_ScriptStates) {
luaState.Initialize();
}
Expand Down
5 changes: 5 additions & 0 deletions Source/Managers/MovableMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,11 @@ void MovableMan::Update()
// Travel MOs
Travel();

// If our debug settings switch is forcing all pathing requests to immediately complete, make sure they're done here
if (g_SettingsMan.GetForceImmediatePathingRequestCompletion() && g_SceneMan.GetScene()) {
g_SceneMan.GetScene()->BlockUntilAllPathingRequestsComplete();
}

// Prior to controller/AI update, execute lua callbacks
g_LuaMan.ExecuteLuaScriptCallbacks();

Expand Down
7 changes: 7 additions & 0 deletions Source/Managers/SettingsMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ namespace RTE {
m_DisableFactionBuyMenuThemeCursors = false;
m_PathFinderGridNodeSize = c_PPM;
m_AIUpdateInterval = 2;

m_NumberOfLuaStatesOverride = -1;
m_ForceImmediatePathingRequestCompletion = false;

m_SkipIntro = false;
m_ShowToolTips = true;
Expand Down Expand Up @@ -170,6 +173,8 @@ namespace RTE {
MatchProperty("DisableFactionBuyMenuThemeCursors", { reader >> m_DisableFactionBuyMenuThemeCursors; });
MatchProperty("PathFinderGridNodeSize", { reader >> m_PathFinderGridNodeSize; });
MatchProperty("AIUpdateInterval", { reader >> m_AIUpdateInterval; });
MatchProperty("NumberOfLuaStatesOverride", { reader >> m_NumberOfLuaStatesOverride; });
MatchProperty("ForceImmediatePathingRequestCompletion", { reader >> m_ForceImmediatePathingRequestCompletion; });
MatchProperty("EnableParticleSettling", { reader >> g_MovableMan.m_SettlingEnabled; });
MatchProperty("EnableMOSubtraction", { reader >> g_MovableMan.m_MOSubtractionEnabled; });
MatchProperty("DeltaTime", { g_TimerMan.SetDeltaTimeSecs(std::stof(reader.ReadPropValue())); });
Expand Down Expand Up @@ -315,6 +320,8 @@ namespace RTE {
writer.NewPropertyWithValue("DisableFactionBuyMenuThemeCursors", m_DisableFactionBuyMenuThemeCursors);
writer.NewPropertyWithValue("PathFinderGridNodeSize", m_PathFinderGridNodeSize);
writer.NewPropertyWithValue("AIUpdateInterval", m_AIUpdateInterval);
writer.NewPropertyWithValue("NumberOfLuaStatesOverride", m_NumberOfLuaStatesOverride);
writer.NewPropertyWithValue("ForceImmediatePathingRequestCompletion", m_ForceImmediatePathingRequestCompletion);
writer.NewPropertyWithValue("EnableParticleSettling", g_MovableMan.m_SettlingEnabled);
writer.NewPropertyWithValue("EnableMOSubtraction", g_MovableMan.m_MOSubtractionEnabled);
writer.NewPropertyWithValue("DeltaTime", g_TimerMan.GetDeltaTimeSecs());
Expand Down
14 changes: 14 additions & 0 deletions Source/Managers/SettingsMan.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,18 @@ namespace RTE {
/// </summary>
/// <param name="newAIUpdateInterval">How often Actor's AI will now be updated, in simulation updates.</param>
void SetAIUpdateInterval(int newAIUpdateInterval) { m_AIUpdateInterval = newAIUpdateInterval; }

/// <summary>
/// Gets how many threaded Lua states we'll use. -1 represents no override, which defaults to the maximum number of concurrent hardware threads.
/// </summary>
/// <returns>How many threaded Lua states we'll use.</returns>
int GetNumberOfLuaStatesOverride() const { return m_NumberOfLuaStatesOverride; }

/// <summary>
/// Gets whether pathing requests will be forced to immediately complete for the next frame, or if they can take multiple frames to calculate.
/// </summary>
/// <returns>Whether pathing requests will be forced to immediately complete for the next frame</returns>
bool GetForceImmediatePathingRequestCompletion() const { return m_ForceImmediatePathingRequestCompletion; }
#pragma endregion

#pragma region Gameplay Settings
Expand Down Expand Up @@ -549,6 +561,8 @@ namespace RTE {
bool m_DisableFactionBuyMenuThemeCursors; //!< Whether custom cursor support in faction BuyMenu themes is disabled.
int m_PathFinderGridNodeSize; //!< The grid size used by the PathFinder, in pixels.
int m_AIUpdateInterval; //!< How often actor's AI should be updated, i.e. every n simulation updates.
int m_NumberOfLuaStatesOverride; //!< Overrides how many threaded Lua states we'll use. -1 for no override, which defaults to the maximum number of concurrent hardware threads.
bool m_ForceImmediatePathingRequestCompletion; //!< Whether pathing requests will be forced to immediately complete for the next frame, or if they can take multiple frames to calculate.

bool m_SkipIntro; //!< Whether to play the intro of the game or skip directly to the main menu.
bool m_ShowToolTips; //!< Whether ToolTips are enabled or not.
Expand Down