Skip to content
Closed

Newui #2296

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
89 changes: 89 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Build and deployment notes

This repository produces the game executable used by `B:\VictoriaModernAges`.
The release must always contain three matching CPU variants:

| Build preset | Installed filename | CPU requirement |
| --- | --- | --- |
| `x64-release-sse-windows` | `AliceSSE.exe` | SSE4.2 |
| `x64-release-avx2-windows` | `Alice.exe` | AVX2 |
| `x64-release-avx512-windows` | `Alice512.exe` | AVX-512F |

The stock `launch_alice.exe` detects the processor and chooses these names in
that order. Build the launcher from the SSE4.2 preset and deploy it together
with the game executables whenever scenario data structures or parsers change.
The launcher serializes scenarios, so an old launcher is not compatible with a
new executable after a change to `src/gamestate/dcon_generated.txt`.

## Default development workflow

Unless the user explicitly asks for a **release build**, use only the
SSE4.2 `AliceIncremental` target. Do not build AVX2, AVX-512, or the launcher,
and do not copy executables into `B:\VictoriaModernAges` as part of ordinary
development or testing.

`Alice` is intentionally compiled as one large translation unit; even a small
source change can therefore trigger a lengthy rebuild. `AliceIncremental`
splits the game into many translation units so that incremental recompiles are
much faster. It is a development/testing executable, not a release artifact.

Configure the SSE4.2 tree once if it does not already exist:

```powershell
cmd /d /s /c 'call "C:\BuildTools\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 >nul && cmake --preset x64-release-sse-windows'
```

For each normal code change, build only this target:

```powershell
cmd /d /s /c 'call "C:\BuildTools\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 >nul && cmake --build out/build/x64-release-sse-windows --config Release --target AliceIncremental --parallel 6'
```

The test executable is
`out\build\x64-release-sse-windows\Release\AliceIncremental.exe`. Run it
with `B:\VictoriaModernAges` as its working directory so it can access the
game data. The first incremental build may still take a while; subsequent
builds should recompile only affected source files.

## Release builds only

Perform the following procedure only after the user explicitly requests a
release build. A release must include all three CPU variants and, when needed,
the matching launcher.

Configure and build each game variant:

```powershell
cmd /d /s /c 'call "C:\BuildTools\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 >nul && cmake --preset x64-release-sse-windows'
cmd /d /s /c 'call "C:\BuildTools\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 >nul && cmake --build out/build/x64-release-sse-windows --config Release --target Alice --parallel 6'

cmd /d /s /c 'call "C:\BuildTools\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 >nul && cmake --preset x64-release-avx2-windows'
cmd /d /s /c 'call "C:\BuildTools\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 >nul && cmake --build out/build/x64-release-avx2-windows --config Release --target Alice --parallel 6'

cmd /d /s /c 'call "C:\BuildTools\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 >nul && cmake --preset x64-release-avx512-windows'
cmd /d /s /c 'call "C:\BuildTools\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 >nul && cmake --build out/build/x64-release-avx512-windows --config Release --target Alice --parallel 6'
```

Build the launcher once from the SSE4.2 tree:

```powershell
cmd /d /s /c 'call "C:\BuildTools\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 >nul && cmake --build out/build/x64-release-sse-windows --config Release --target launch_alice --parallel 6'
```

The parser and data-container generators are intentionally compiled for
SSE4.2. This allows the build to run on a machine without AVX2 while still
producing the AVX2 and AVX-512 game variants.

The presets deliberately set `ALICE_ENABLE_LTCG=OFF` so all three compatible
executables can be produced promptly. Set it to `ON` only for a slower,
performance-focused rebuild; it does not affect format compatibility.

## Deployment and verification

1. Back up the four installed executables before replacing them.
2. Copy each generated `Release/Alice.exe` to the matching installed filename
above, and copy the SSE-built `Launcher/Release/launch_alice.exe` to the
game root.
3. Do not delete existing scenario cache files. Use the launcher to create a
fresh scenario after a change to scenario-tagged data. The cache is at
`%USERPROFILE%\Documents\Project Alice\scenarios`.
59 changes: 39 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,28 @@ project (ProjectAlice LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Windows releases are distributed in three CPU-specific variants. Keep the
# launcher on SSE4.2 so it can run on every supported machine and choose the
# correct game executable itself.
set(ALICE_CPU_TARGET "SSE42" CACHE STRING "CPU target for Alice (SSE42, AVX2, or AVX512)")
set_property(CACHE ALICE_CPU_TARGET PROPERTY STRINGS SSE42 AVX2 AVX512)
option(ALICE_ENABLE_LTCG "Enable MSVC link-time code generation for release builds" OFF)
if(MSVC)
if(ALICE_CPU_TARGET STREQUAL "SSE42")
set(ALICE_CPU_ARCH_FLAG /d2archSSE42)
elseif(ALICE_CPU_TARGET STREQUAL "AVX2")
set(ALICE_CPU_ARCH_FLAG /arch:AVX2)
elseif(ALICE_CPU_TARGET STREQUAL "AVX512")
set(ALICE_CPU_ARCH_FLAG /arch:AVX512)
else()
message(FATAL_ERROR "ALICE_CPU_TARGET must be SSE42, AVX2, or AVX512")
endif()
if(ALICE_ENABLE_LTCG)
set(ALICE_LTCG_COMPILE_FLAG /GL)
set(ALICE_LTCG_LINK_FLAG /LTCG)
endif()
endif()

# Turn on compile_commands.json export for wider editor/IDE support.
# This option is ignored on anything but Unix makefiles/Ninja.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand Down Expand Up @@ -307,6 +329,12 @@ add_library(AliceCommon INTERFACE)
target_compile_definitions(AliceCommon INTERFACE GLM_ENABLE_EXPERIMENTAL)
target_compile_definitions(AliceCommon INTERFACE "PROJECT_ROOT=\"${PROJECT_SOURCE_DIR}\"")
if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# MSBuild batches Alice's large source files into one cl.exe invocation.
# /MP lets MSVC compile that batch concurrently and honours the host's
# normal processor limit.
target_compile_options(AliceCommon INTERFACE /MP)
endif()
# string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# string(REPLACE "/W3" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# string(REPLACE "/MDd" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
Expand All @@ -315,8 +343,7 @@ if(WIN32)
# string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})

# To build Non-AVX version : change all "/arch:AVX2" to "/d2archSSE42"
# -march=nehalem for clang release
# ALICE_CPU_ARCH_FLAG selects SSE4.2, AVX2, or AVX-512 for the MSVC builds.
set(CMAKE_CXX_FLAGS "")
set(CMAKE_CXX_FLAGS_DEBUG "")
set(CMAKE_CXX_FLAGS_RELEASE "")
Expand Down Expand Up @@ -362,36 +389,28 @@ if(WIN32)
if(OPTIMIZE_MODE STREQUAL "On")
message(STATUS "Optimizing with PGO data")
target_compile_options(AliceCommon INTERFACE
${CommonMSVCFlags} /wd4723 /d2archSSE42 /DNDEBUG /wd4530 /MT /O2 /Oi /GL /sdl- /GS- /Gy /Gw /Zc:inline)
target_link_options(AliceCommon INTERFACE /OPT:REF /OPT:ICF /LTCG /USEPROFILE)
${CommonMSVCFlags} /wd4723 ${ALICE_CPU_ARCH_FLAG} /DNDEBUG /wd4530 /MT /O2 /Oi ${ALICE_LTCG_COMPILE_FLAG} /sdl- /GS- /Gy /Gw /Zc:inline)
target_link_options(AliceCommon INTERFACE /OPT:REF /OPT:ICF ${ALICE_LTCG_LINK_FLAG} /USEPROFILE)
elseif(PROFILE_MODE STREQUAL "On")
message(STATUS "Compiling for PGO instrumentation")
target_compile_options(AliceCommon INTERFACE
${CommonMSVCFlags} /wd4723 /d2archSSE42 /Z7 /DNDEBUG /wd4530 /MT /O2 /Oi /GL /sdl- /GS- /Gy /Gw /Zc:inline)
${CommonMSVCFlags} /wd4723 ${ALICE_CPU_ARCH_FLAG} /Z7 /DNDEBUG /wd4530 /MT /O2 /Oi ${ALICE_LTCG_COMPILE_FLAG} /sdl- /GS- /Gy /Gw /Zc:inline)
target_link_options(AliceCommon INTERFACE /DEBUG:FULL /OPT:REF /OPT:ICF /LTCG /GENPROFILE)
else()
message(STATUS "Normal, not PGO, build")
target_compile_options(AliceCommon INTERFACE
${CommonMSVCFlags} /Z7
$<$<CONFIG:Debug>: /EHsc /MTd /RTC1 /Od>
${CommonMSVCFlags} ${ALICE_CPU_ARCH_FLAG} /Z7
$<$<CONFIG:Debug>: /EHsc /MTd /RTC1 /Od>
# for faster debug builds, replace /RTC1 /Od with /O1 -- should be able to use /Ox, but for some reason that crashes ZSTD
$<$<NOT:$<CONFIG:Debug>>: /DNDEBUG /wd4530 /MT /O2 /Oi /GL /sdl- /GS- /Gy /Gw /Zc:inline>)
$<$<NOT:$<CONFIG:Debug>>: /DNDEBUG /wd4530 /MT /O2 /Oi ${ALICE_LTCG_COMPILE_FLAG} /sdl- /GS- /Gy /Gw /Zc:preprocessor /Zc:inline>)
target_link_options(AliceCommon INTERFACE
$<$<CONFIG:Debug>: /DEBUG:FULL >
$<$<NOT:$<CONFIG:Debug>>: /DEBUG:FULL /OPT:REF /OPT:ICF /LTCG>)
$<$<NOT:$<CONFIG:Debug>>: /DEBUG:FULL /OPT:REF /OPT:ICF ${ALICE_LTCG_LINK_FLAG}>)
endif()

if(VECTOR_MODE STREQUAL "AVX512")
target_compile_options(AliceCommon INTERFACE
/arch:AVX512 )
elseif(VECTOR_MODE STREQUAL "AVX2")
target_compile_options(AliceCommon INTERFACE
/arch:AVX2 )
else()
# No /fp:precise here since from my testing, seperate executables generated with Clang and MSVC will not be deterministic between eachother anyway no matter the flags. Both builds must be compiled with clang to get some level of float determinism
target_compile_options(AliceCommon INTERFACE
/d2archSSE42 )
endif()
# The distribution presets set this once; do not append a VECTOR_MODE flag
# afterwards, or it would override the selected AVX target.
target_compile_options(AliceCommon INTERFACE ${ALICE_CPU_ARCH_FLAG})



Expand Down
33 changes: 32 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"hidden": true,
"cacheVariables": {
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe"
"CMAKE_CXX_COMPILER": "cl.exe",
"CMAKE_POLICY_VERSION_MINIMUM": "3.5"
},
"condition": {
"type": "equals",
Expand Down Expand Up @@ -96,6 +97,36 @@
"VECTOR_MODE": "AVX512"
}
},
{
"name": "x64-release-sse-windows",
"displayName": "x64 Release (SSE4.2)",
"inherits": "windows-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"ALICE_CPU_TARGET": "SSE42",
"ALICE_ENABLE_LTCG": "OFF"
}
},
{
"name": "x64-release-avx2-windows",
"displayName": "x64 Release (AVX2)",
"inherits": "windows-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"ALICE_CPU_TARGET": "AVX2",
"ALICE_ENABLE_LTCG": "OFF"
}
},
{
"name": "x64-release-avx512-windows",
"displayName": "x64 Release (AVX-512)",
"inherits": "windows-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"ALICE_CPU_TARGET": "AVX512",
"ALICE_ENABLE_LTCG": "OFF"
}
},
{
"name": "x64-profile-windows-sse",
"displayName": "x64 Release (profile SSE)",
Expand Down
5 changes: 2 additions & 3 deletions FifInterfaceGenerator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if(WIN32)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")

target_compile_options(DCONINTERFACEGEN PRIVATE
/bigobj /wd4100 /wd4189 /wd4065 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /w34388 /w34389
/bigobj /wd4100 /wd4189 /wd4065 /GR- /W4 /permissive- /WX /d2archSSE42 /GF /w34388 /w34389
-Wno-missing-prototypes -Wno-unsafe-buffer-usage -Wno-switch-default -Wno-padded -Wno-unique-object-duplication
$<$<CONFIG:Debug>: /RTC1 /EHsc /MTd /Od /RTC1>
$<$<NOT:$<CONFIG:Debug>>: /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline>)
Expand All @@ -26,7 +26,7 @@ if(WIN32)
$<$<NOT:$<CONFIG:Debug>>: /OPT:REF /OPT:ICF /LTCG>)
else()
target_compile_options(DCONINTERFACEGEN PRIVATE
/bigobj /wd4100 /wd4189 /wd4065 /GR- /W4 /permissive- /Zc:preprocessor /WX /arch:AVX2 /GF /w34388 /w34389
/bigobj /wd4100 /wd4189 /wd4065 /GR- /W4 /permissive- /Zc:preprocessor /WX /d2archSSE42 /GF /w34388 /w34389
$<$<CONFIG:Debug>: /RTC1 /EHsc /MTd /Od /RTC1>
$<$<NOT:$<CONFIG:Debug>>: /DNDEBUG /wd4530 /MT /O2 /Oi /GL /sdl- /Zc:preprocessor /GS- /Gy /Gw /Zc:inline>)
target_link_options(DCONINTERFACEGEN PRIVATE
Expand All @@ -42,4 +42,3 @@ else() # GCC or CLANG
$<$<CXX_COMPILER_ID:Clang>: $<$<CONFIG:Debug>: > $<$<NOT:$<CONFIG:Debug>>: >>)
endif()


5 changes: 2 additions & 3 deletions ParserGenerator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if(WIN32)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")

target_compile_options(ParserGenerator PRIVATE
/bigobj /wd4100 /wd4189 /wd4065 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /w34388 /w34389
/bigobj /wd4100 /wd4189 /wd4065 /GR- /W4 /permissive- /WX /d2archSSE42 /GF /w34388 /w34389
-Wno-missing-prototypes -Wno-unsafe-buffer-usage -Wno-switch-default -Wno-padded -Wno-unique-object-duplication -Wno-nrvo
$<$<CONFIG:Debug>: /RTC1 /EHsc /MTd /Od /RTC1>
$<$<NOT:$<CONFIG:Debug>>: /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline>)
Expand All @@ -24,7 +24,7 @@ if(WIN32)
$<$<NOT:$<CONFIG:Debug>>: /OPT:REF /OPT:ICF /LTCG>)
else()
target_compile_options(ParserGenerator PRIVATE
/bigobj /wd4100 /wd4189 /wd4065 /GR- /W4 /permissive- /Zc:preprocessor /WX /arch:AVX2 /GF /w34388 /w34389
/bigobj /wd4100 /wd4189 /wd4065 /GR- /W4 /permissive- /Zc:preprocessor /WX /d2archSSE42 /GF /w34388 /w34389
$<$<CONFIG:Debug>: /RTC1 /EHsc /MTd /Od /RTC1>
$<$<NOT:$<CONFIG:Debug>>: /DNDEBUG /wd4530 /MT /O2 /Oi /GL /sdl- /Zc:preprocessor /GS- /Gy /Gw /Zc:inline>)
target_link_options(ParserGenerator PRIVATE
Expand All @@ -40,4 +40,3 @@ else() # GCC or CLANG
$<$<CXX_COMPILER_ID:Clang>: $<$<CONFIG:Debug>: > $<$<NOT:$<CONFIG:Debug>>: >>)
endif()


36 changes: 35 additions & 1 deletion assets/localisation/en-US/alice.csv
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,17 @@ influence_explain_15;$x$ from our relationship
influence_explain_16;$x$ from our investment in the nation
influence_explain_17;$x$ from the size of the target nation
influence_explain_18;$x$ from our relative score
great_power_influence_tooltip;$country$ influence in $country2$: $x$ / $y$
great_power_influence_status_sphere;Status: In sphere of influence
great_power_influence_status_leader;Status: Leader
great_power_influence_status_contesting;Status: Contesting
great_power_influence_status_idle;Status: Not influencing
great_power_influence_leader;Leader: $country$ ($x$)
great_power_influence_gap;Gap to leader: $x$
great_power_influence_no_daily_gain;Daily change: 0.00
great_power_investment_tooltip;$country$ foreign investment in $country2$: $x$
great_power_investment_share;Share of all foreign investment: $x$
great_power_investment_influence_modifier;Influence modifier from investment: $x$
until_date;Until $x$
add_wg_1;You can't add a war goal against yourself
add_wg_2;You are at war
Expand Down Expand Up @@ -1184,6 +1195,7 @@ alice_unit_disable_rebel_hunt;Stop hunting rebels
alice_regiment_battle_info;$m$ $name$ ?Y$type$?!\nOrganisation: ?Y$organisation$?W\nStrength: ?Y$strength$?W
understaffed_regiment;?RThis regiment is understaffed and will only have $value$ soldiers!?W
tech_queue_explain;Press ?YSHIFT?W to add to queue, ?YRight-click?W to remove
technology_prerequisites;Requirements:
alice_province_building_build;?YSHIFT?W to build on the entire ?Gstate?W.\n?YSHIFT-Right-click?W to build on the entire ?Gcountry?W.
commodity_shortage;?RThere is a shortage of this commodity
commodity_surplus;?GThere is a surplus of this commodity
Expand Down Expand Up @@ -1635,7 +1647,7 @@ alice_budget_gold;Gold Mines
alice_budget_construction;Construction
alice_budget_army_upkeep;Army Upkeep
alice_budget_navy_upkeep;Navy Upkeep
alice_budget_domestic_investment;Public Works
alice_budget_domestic_investment;Investment Subsidies
alice_budget_debt_service;Debt Service
alice_budget_diplo_income;Diplomatic
alice_budget_diplo_expenses;Diplomatic
Expand All @@ -1653,6 +1665,28 @@ alice_budget_min;Min $x$
alice_budget_overlord;Taxes to overlord
alice_budget_expand_tt;Show detailed breakdown
alice_budget_contract_tt;Hide detailed breakdown
alice_budget_tooltip_setting_actual;Setting: ?Y$x$?W. Current amount: ?Y$val$?W.
alice_budget_tooltip_actual;Current amount: ?Y$val$?W.
alice_budget_poor_tax_tt;Collects a share of income from lower-class POPs. Higher taxes reduce their savings and ability to buy goods. Actual collection also depends on provincial control and administrative efficiency.
alice_budget_middle_tax_tt;Collects a share of income from middle-class POPs. Higher taxes reduce their savings and ability to buy goods. Actual collection also depends on provincial control and administrative efficiency.
alice_budget_rich_tax_tt;Collects a share of income from upper-class POPs. Higher taxes reduce their savings and investment capacity. Actual collection also depends on provincial control and administrative efficiency.
alice_budget_tariffs_import_tt;Collects duties on goods entering your market. Higher duties make imports more expensive and can reduce their volume. They do not apply to domestic trade or tariff-free agreements.
alice_budget_tariffs_export_tt;Collects duties on goods leaving your market. Higher duties raise export prices and can reduce their competitiveness and volume.
alice_budget_diplomatic_income_tt;Automatic income from war subsidies, reparations and subject payments. This category has no budget setting.
alice_budget_gold_tt;Income from gold production converted directly into money. It is not affected by tax settings.
alice_budget_diplomatic_expenses_tt;Automatic payments for war subsidies, reparations and overlord contributions. This category has no budget setting.
alice_budget_social_tt;Pays pensions and unemployment benefits to POPs. It only has an effect when the corresponding social reforms are active.
alice_budget_military_tt;Pays the needs of military POPs, chiefly soldiers and officers. It is separate from the goods used to supply military units.
alice_budget_education_tt;Funds schools and universities that provide free education. Their output helps POPs gain literacy when qualified labour is available.
alice_budget_administration_tt;Employs central and local administrators. They build state control, improving tax collection and crime fighting.
alice_budget_domestic_investment_tt;Transfers public support to capitalists and aristocrats. It supports private investment, but does not directly build state projects.
alice_budget_overseas_tt;Buys special goods for non-central possessions. Adequate funding reduces militancy pressure in overseas provinces.
alice_budget_subsidies_tt;Supports production selected through national or state production priorities. Funds are distributed by actual output, not simply by factory losses.
alice_budget_construction_tt;Buys materials for state construction, factories and military units. Progress depends on funding and the availability of required goods.
alice_budget_army_upkeep_tt;Buys supplies and reinforcements for land units. Market shortages can limit the effective level of supply.
alice_budget_navy_upkeep_tt;Buys supplies, repairs and reinforcements for naval units. Market shortages can limit the effective level of supply.
alice_budget_debt_tt;Mandatory interest payments on loans. These are paid before most other budget categories.
alice_budget_stockpile_tt;Buys goods toward targets set in the Trade window. Purchases depend on available funds and market supply.
alice_budget_admin_eff1;Admin.
alice_budget_admin_eff2;Efficiency:
alice_budget_chart_top;100%
Expand Down
Loading