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

Implement the multiplayer spawner in C++ using TS++ #1065

Merged
merged 78 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
14256be
Initial spawner code port
ZivDero Sep 19, 2024
e8950bc
Adapt more stuff
ZivDero Sep 19, 2024
f6b768f
More fixes
ZivDero Sep 19, 2024
26ff7d6
Untabify
ZivDero Sep 19, 2024
1ca34af
Cleanup
ZivDero Sep 19, 2024
d3a01c5
Protocol zero hooks
ZivDero Sep 19, 2024
a209502
Rename/mov a few things
ZivDero Sep 19, 2024
4dbf201
Change how saved games are loaded
ZivDero Sep 19, 2024
8ae5beb
Add some stuff to Assign_Houses
ZivDero Sep 19, 2024
bc35e31
Add handling for chosing your spawn position
ZivDero Sep 19, 2024
d325752
Remove YR stuff
ZivDero Sep 19, 2024
fe5a9f7
Start adding spectators
ZivDero Sep 19, 2024
263e33b
Fix name collision
ZivDero Sep 19, 2024
37643e3
Quickmatch patches
ZivDero Sep 20, 2024
24cee67
Add spectator hooks
ZivDero Sep 20, 2024
bfba519
Reorganize files, create headers, format headers
ZivDero Sep 20, 2024
b7d4584
Rename event method
ZivDero Sep 20, 2024
e3f21f9
Move Vinifera event hooks to a separate file
ZivDero Sep 20, 2024
fda63b0
Hooks for new events
ZivDero Sep 20, 2024
b4cfddf
Reimplement auto-surrender
ZivDero Sep 20, 2024
4197080
Add coach mode
ZivDero Sep 20, 2024
02b6daf
Add spawner hooks
ZivDero Sep 20, 2024
b00a970
More additions
ZivDero Sep 20, 2024
b028a45
Fix spectator
ZivDero Sep 20, 2024
f774e74
Some cleanup
ZivDero Sep 20, 2024
479c385
Remove patch for statistics that caused a crash
ZivDero Sep 21, 2024
65996fc
Fix events
ZivDero Sep 21, 2024
3ab0781
sidebar hack
ZivDero Sep 21, 2024
12d0b8e
Fix difficulties
ZivDero Sep 21, 2024
bbaa76d
Remove residual YR comment
ZivDero Sep 21, 2024
bd9d0c7
Add SkipScoreScreen
ZivDero Sep 21, 2024
7a1a522
Add statistics
ZivDero Sep 21, 2024
160070b
Fix a few things
ZivDero Sep 21, 2024
91d42f6
Fix a few things in networking
ZivDero Sep 21, 2024
f4a0afa
Change how a hook works
ZivDero Sep 22, 2024
f5313e8
Minor cleanup
ZivDero Sep 22, 2024
8c5bbbb
Fix radar enabling causing a crash
ZivDero Sep 22, 2024
f750505
Fix infinite loop when the player was defeated
ZivDero Sep 22, 2024
91822da
Let spectators have tooltips for everyone's objects
ZivDero Sep 22, 2024
008fca9
Small refactoring
ZivDero Sep 22, 2024
01eb29d
Add docs to make the workflows shut up
ZivDero Sep 22, 2024
09b0503
Allow spectators to see the primary factory text
ZivDero Sep 22, 2024
168c8b7
Cleanup the draw build overlays function replacement
ZivDero Sep 22, 2024
ccf3733
Fix a few things
ZivDero Sep 22, 2024
1ac567e
Rename addon-related functions
ZivDero Sep 22, 2024
784f142
Reenable patch for firestorm availability
ZivDero Sep 22, 2024
8281b5d
Clean up a few TSC compatibility things
ZivDero Sep 22, 2024
05b0c87
Set ScenarioIndex to -1 to prevent the game from crashing because no …
ZivDero Sep 22, 2024
ff5d117
Move where Read_Scenario_Descriptions is patched out
ZivDero Sep 22, 2024
eb2449a
Add CampaignID loading
ZivDero Sep 22, 2024
b4bb467
Fix some errors with events
ZivDero Sep 22, 2024
4ce395a
Rename Vinifera event enum values to be shorter
ZivDero Sep 24, 2024
b2ee634
Fix rebase errors
ZivDero Sep 26, 2024
5f1b968
Fix typo
ZivDero Sep 27, 2024
6f19416
Replace tabs with spaces
ZivDero Oct 1, 2024
5c6abe7
Migrate to CnCNet5UDPInterfaceClass
ZivDero Oct 2, 2024
d3fe6be
Name a constant
ZivDero Oct 2, 2024
e958812
Disable logs
ZivDero Oct 2, 2024
44d8059
Remove the separate NetHack
ZivDero Oct 2, 2024
598d6a6
Make the game loading in MP
ZivDero Oct 2, 2024
12bd750
Fix events
ZivDero Oct 2, 2024
8c41f92
Fix protocol zero
ZivDero Oct 2, 2024
e57d2a0
Fix quick match hook
ZivDero Oct 2, 2024
f5d2cfc
Minor adjustments
ZivDero Oct 2, 2024
0f1e57c
Fix Protocol zero latency
ZivDero Oct 2, 2024
9fb3ab1
Add saved game dir customization
ZivDero Oct 3, 2024
3be77d6
Untabify
ZivDero Oct 3, 2024
04b49b8
Minor changes in formatting
ZivDero Oct 3, 2024
e1541af
Fix an issue where Firestorm was not enabled
ZivDero Oct 3, 2024
abffa79
Make MP saves work
ZivDero Oct 4, 2024
e57f49e
Reintroduce RA Reconcile_Players instead of bespoke solution
ZivDero Oct 4, 2024
8204e89
Some cleanup
ZivDero Oct 4, 2024
667b3fe
Update the loop max
ZivDero Oct 4, 2024
79375f7
Keep the player's name but postfixed with (AI) if they don't load int…
ZivDero Oct 4, 2024
3294935
Move Reconcile_Players into the spawner
ZivDero Oct 4, 2024
2e08a89
Spawner docs
ZivDero Oct 4, 2024
7d855c3
Pre-merge cleanup
ZivDero Oct 4, 2024
37c2569
Last bits of cleanup
ZivDero Oct 4, 2024
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
4 changes: 4 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This page lists all the individual contributions to the project by their author.
- **Belonit (Gluk-v48)**:
- Check for Changelog/Documentation/Credits in Pull Requests.
- Docs dark theme switcher.
- Porting the YR MP spawner from C to C++ and YR++, used as a base for the Vinifera spawner.
- **CCHyper/tomsons26**:
- Vinifera foundations: TS++, game.exe hooker, extension system and other core features
- Implement `CurleyShuffle` for AircraftTypes
Expand Down Expand Up @@ -124,6 +125,8 @@ This page lists all the individual contributions to the project by their author.
- Adds keyboard commands to reproduce the last items that were built.
- Change starting unit placement to be the same as Red Alert 2.
- Add the framework for new ArmorTypes.
- **CnCNet Contributors**:
- Tiberian Sun TS-patches spawner, Yuri's Revenge CnCNet spawner that served as a base for Vinifera spawner.
- **Kerbiter (Metadorius)**:
- Initial documentation setup.
- **MarkJFox**:
Expand Down Expand Up @@ -154,4 +157,5 @@ This page lists all the individual contributions to the project by their author.
- Implement the support for new ArmorTypes and allow forbidding force-fire, passive-acquire and retaliation versus specific armor types.
- Fix a bug where the objects would sometimes receive a minimum of 1 damage even if MinDamage was set to 0.
- Add a developer command to dump all heaps to the log.
- Implement the multiplayer spawner.

116 changes: 115 additions & 1 deletion docs/Miscellaneous.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,117 @@ This page describes every change in Vinifera that wasn't categorized into a prop
- Vinifera allows players to set a rally point for their service depot, similar to the functionality already available for factories.
- OverlayTypes 27 to 38 (fourth Tiberium images) were hardcoded to be impassable by infantry. This limitation is removed.

## Spawner

- Vinifera implements its own spawner, capable of starting a new singleplayer, skirmish or multiplayer game, as well as loading saved games.
- To start the game in spawner mode, the `-SPAWN` command line argument must be specified.
- The spawner's options can be configures in `SPAWN.INI`.

In `SPAWN.INI`:
```ini
[Settings]
; Game Mode Options
Bases=yes ; boolean, do players start with MCVs/Construction Yards?
Credits=10000 ; integer, starting amount of credits for the players.
BridgeDestroy=yes ; boolean, can bridges be destroyed?
Crates=no ; boolean, are crates enabled?
ShortGame=no ; boolean, is short game enabled?
BuildOffAlly=no ; boolean, is building off ally bases allowed?
GameSpeed=0 ; integer, starting game speed.
MultiEngineer=no ; boolean, is multi-engineer enabled?
UnitCount=0 ; integer, starting unit count.
AIPlayers=0 ; integer, number of AI players.
AIDifficulty=1 ; integer, AI difficulty.
AlliesAllowed=no ; boolean, can players form and break alliances in-game?
HarvesterTruce=no ; boolean, are harvesters invulnerable?
FogOfWar=no ; boolean, is fog of war enabled?
MCVRedeploy=yes ; boolean, can MCVs be redeployed?

; Savegame Options
LoadSaveGame=no ; boolean, should the spawner load a saved game, as opposed to starting a new scenario?
SavedGamesDir=Saved Games ; string, name (path) of the subfolder containing saved games. Supports nesting, e. g. Saved Games\Tiberian Sun.
SaveGameName= ; string, name of the saved game to load.

; Scenario Options
Seed=0 ; integer, random seed.
TechLevel=10 ; integer, maximum tech level.
IsCampaign=no ; boolean, is the game that is about to start campaign, as opposed to skirmish?
CampaignID=-1 ; integer, ID of the campaign (from BATTLE.INI) to start
Tournament=0 ; integer, WOL Tournament Type
WOLGameID=3735928559 ; unsigned integer, WOL Game ID
ScenarioName=spawnmap.ini ; string, name of the scenario (map) to load.
MapHash= ; string, map hash, only used in statistics collection.
UIMapName= ; string, name of the map, only used in statistics collection.

; Network Options
Protocol=2 ; integer, network protocol to use.
FrameSendRate=4 ; integer, starting FrameSendRate value.
ReconnectTimeout=2400 ; integer, player reconnection timeout.
ConnTimeout=3600 ; integer, player connection timeout.
MaxAhead=-1 ; integer, starting MaxHead value.
PreCalcMaxAhead=0 ; integer, starting PrecalcMaxHead value.
MaxLatencyLevel=255 ; unsigned byte, maximum allowed Protocol 0 latency level.

; Tunnel Options
TunnelId=0 ; integer, tunnel ID.
TunnelIp=0.0.0.0 ; string, tunnel IP.
TunnelPort=0 ; integer, tunnel port.
ListenPort=1234 ; integer, listen port.

; Extra Options
Firestorm=yes ; boolean, should the game start with Firestorm enabled?
QuickMatch=no ; boolean, should the game start in Quick Match mode?
SkipScoreScreen=no ; boolean, should the score screen be skipped once the game is over?
WriteStatistics=no ; boolean, should statistics be sent?
AINamesByDifficulty=no ; boolean, should AI players have their difficulty in their name?
CoachMode=no ; boolean, should defeated players that have allies not have the entire map revealed to them upon death?
AutoSurrender=yes ; boolean, should players surrender on disconnection, as opposed to turning their base over to the AI?
```

- Information about the local player is read from the `Settings` section, for all other players - from `OtherX` sections, where `X` ranges from `1` to `7`.

In `SPAWN.INI`:
```ini
[PLAYERSECTION]
IsHuman=no ; boolean, is this a human player?
Name= ; string, the player's name.
Color=-1 ; integer, the player's color.
House=-1 ; integer, the player's house.
Difficulty=-1 ; integer, the player's difficulty.
Ip=0.0.0.0 ; string, the player's IP address.
Port=-1 ; integer, the player's port.
```

- Additionally, AI players (always come after human players) have these options parsed from sections of the format `MultiX`, where `X` ranges from `1` to `8`.

In `SPAWN.INI`:
```ini
[MULTISECTION]
Color=-1 ; integer, the player's color.
House=-1 ; integer, the player's house.
Difficulty=-1 ; integer, the player's difficulty.
```

- Additionally, the spawner reads configuration for each house. Player houses come first, in the order of their color (increasing), then AI houses.
- Alliances are read from sections of the format `MultiX_Alliances`, where `X` ranges from `1` to `8`.

In `SPAWN.INI`:
```ini
[MULTISECTION]
IsSpectator=no ; boolean, is this house a spectator (observer)?
SpawnLocations=-2 ; integer, spawn location of this house. 90 and -1 mean spectator, -2 means random.

[ALLIANCESSECTION]
HouseAllyOne=-1 ; integer, index of the house this house is allied to, -1 means none.
HouseAllyTwo=-1 ; integer, index of the house this house is allied to, -1 means none.
HouseAllyThree=-1 ; integer, index of the house this house is allied to, -1 means none.
HouseAllyFour=-1 ; integer, index of the house this house is allied to, -1 means none.
HouseAllyFive=-1 ; integer, index of the house this house is allied to, -1 means none.
HouseAllySix=-1 ; integer, index of the house this house is allied to, -1 means none.
HouseAllySeven=-1 ; integer, index of the house this house is allied to, -1 means none.
HouseAllyEight=-1 ; integer, index of the house this house is allied to, -1 means none.
```

## Quality of Life

- Harvesters are now considered when executing the "Guard" command. They have a special case when assigned with the Guard mission that tells them to find the nearest Tiberium patch and begin harvesting.
Expand Down Expand Up @@ -138,7 +249,10 @@ Due to the nature of its use, this feature is only available when Vinifera is ru

### Command Line Options

- Vinifera adds a number of command-line arguments allowing the user to skip the startup movies, or skip directly to a specific game mode and/or dialog.
- Vinifera adds a number of command-line arguments.

- `-SPAWN`
Launch the game in spawner mode.

- `-NO_STARTUP_VIDEO`
Skips all startup movies.
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ New:
- Make OverlayTypes 27 to 38 (fourth Tiberium images) passable by infantry (by AlexB)
- Implement the support for new ArmorTypes and allow forbidding force-fire, passive-acquire and retaliation versus specific armor types (by ZivDero/CCHyper)
- Add a developer command to dump all heaps to the log (by ZivDero)
- Implemented the multiplayer spawner (by ZivDero)

Vanilla fixes:
- Fix HouseType `Nod` having the `Prefix=B` and `Side=GDI` in vanilla `rules.ini` by setting them to `N` and `Nod`, respectively (by CCHyper/tomsons26)
Expand Down
Loading
Loading