Files
firestorm/Gameleap/code/mw4/Code
29aee4f71b Fix 16 pilots + 1 cameraship failing to launch
A full 16-'Mech roster plus a cameraship silently refused to launch: the console
sat in nLaunchState 3 ("loading") forever with no crash and no error. 15 mechs +
camera worked, and 16 mechs with no camera worked.

Two independent bugs, both counting the cameraship against the 16 'Mech slots.

1. Session capacity (broke all-human rosters)

   CTCL_DefaultHostSetup derived the camera reserve from
   CTCL_GetTeslaCountAll() - CTCL_GetTeslaCount(). Those counters read the CTCL
   tesla table, which is only populated when CTCL_IsConsoleOrCOOP() is true --
   i.e. only on the console. But the machine that creates the network session is
   the cameraship pod (CTCL_DoMission sets g_nServer = nCameraship, and that pod
   runs CTCL_DoCreateGame -> CTCL_DefaultHostSetup(0) -> Mech4CreateGame ->
   gos_CreateGame(..., Environment.NetworkMaxPlayers, ...)).

   On that pod both counters return 0, so the reserve collapsed to +0 and the
   session was created with dwMaxPlayers = 16. The 17th connection was refused,
   CTCL_CheckServerReady never saw nCount == g_nTeslas + 1, and the launch hung.

   Fixed by reserving with a constant, MW4_CAMERASHIP_RESERVE (4, matching
   MAX_CAMERAS), which is valid on every machine regardless of the tesla table.

2. Bot admission (broke any roster containing bots)

   MW4Shell::AddBot rejects when (player_count + bot_count) >= m_maxPlayers.
   player_count is the DirectPlay player count, which includes the cameraship
   connection, so with m_maxPlayers = 16 the last bot was silently refused.
   g_nBOTs then never matched the connected lancemates and the same readiness
   check spun forever.

   Fixed by subtracting cameraship participants from player_count under CTCL,
   via a new CTCL_CountCameraShipsInGame() helper (non-bot entries with
   m_nMechIndex == 0). Cameraships hold a network slot but pilot no 'Mech, so
   they must not consume a 'Mech slot.

Also applies the constant reserve in the PLAYER_LIMIT_PARAMETER path, guarded by
!CTCL_IsNone() so a standalone non-pod host keeps its exact configured limit.

This supersedes commit f76dc05f, which had the right formula but evaluated it on
the console rather than on the pod that actually creates the session.

Note for later: m_maxPlayers is serialized in only 5 bits (MWApplication.cpp),
so 31 is the hard ceiling for any future player-cap work. See
RAISING-PLAYER-CAP.md.

Requires rebuild: MW4.exe (Release + Profile). No script or resource changes.
Verified: compiles clean, console launches. Pod testing pending.

Co-authored-by: Claude Opus 5 (Anthropic) <noreply@anthropic.com>
Co-authored-by: GitHub Copilot <copilot@github.com>
2026-07-24 23:39:16 -05:00
..

The binaries directory is where your plugins get put when you compile them.



This is not the directory to use if you want to check in a binary of your plugin.

This directory is in sourcesafe to assist in setup of 3DSMax2 development.



Standard debug levels for 3DSMax2 are :



rel - no debug - no debug memory

hybrid - debug - no debug memory

debug - debug - debug memory



The now 3 levels for Stuff Armor and there corrilation between max are :



Release - - rel max   - Fully optimized, no debug, not LAB_ONLY

Profile - - rel max   - Fully optimized, some debug, LAB_ONLY

Debug   - - debug max - Varying level of armor, full debug, LAB_ONLY, 



When you compile the 3ds project the plugin will go into either the debug or rel directory, whichever

is apporpriote to the copy of 3DSMax you must run it under.  When you compile a plugin if it has been

built in the directory it will be overwritten by the new dll.  (IE: if you compile a Release and then a Profile 

only your Profile will exist since they share directories) 



Plugins must not be mixed.  If the plugin is for the Release version of 3DSMax2 you must not run it

under the debug version of 3DSMax2.



--------------------------------

Setup For Existing Workspaces:

--------------------------------



3DSMax2 setup:



I recommend installing max *without* the sdk ( all the sdk is included in the MW4 source control ).

I also recomend installing the debug version *next* to the regular verson of max off of your root drive.

example:

	c:\3DSMax2

	c:\Maxdbg20 



Under your release copy of max:

File|Configure Paths|Plugins Tab|Add..

{driveletter}:\mw4\Code\3DSPlugins\Binaries\Rel



Under your debug copy of max:

File|Configure Paths|Plugins Tab|Add..

{driveletter}:\mw4\Code\3DSPlugins\Binaries\Debug





Setup For project:

Project|Settings|Debug Tab



Choose the version from the "settings for" combo box



for release and profile set the "Executable For Debug Session" to:

	{driveletter}:\3DSMAX2\3dsmax.exe



for debug set:

	{driveletter}:\Maxdbg20\3dsmax.exe







Once this is done everything should work as usual for compiling and debuging.



---------------------

Adding a project

---------------------

When adding a project make sure to copy the debug levels from other projects.  Make sure to *NOT* specify 

any libries by adding them to the resource tree.  Instead type the names into the : 

	Project:Settings:Link Tab:General

		Object/Library Modules



Just type the library names in with spaces seperating them and no paths.  This way it will use the appropriate 

libraries ( debug, release ).







Here is all the info needed for creating a new project.





These are 3DSMax2, MFC, Stuff Defines



Project|Settings|C/C++|General|Processor Definitions



release

WIN32,NDEBUG,_WINDOWS,_USRDLL,_WINDLL,MULTI_PLAYER,USE_PROTOTYPES,STRICT,TEST_CLASS=50



Profile

WIN32,NDEBUG,_WINDOWS,_USRDLL,_WINDLL,LAB_ONLY,MULTI_PLAYER,USE_PROTOTYPES,STRICT,TEST_CLASS=50



Debug

WIN32,_DEBUG,_WINDOWS,_USRDLL,_WINDLL,LAB_ONLY,MULTI_PLAYER,USE_PROTOTYPES,STRICT,TEST_CLASS=50





Project|Settings|Link|General|Object/Library Modules debug build must have NAFXCWD.LIB

Project|Settings|C/C++|General|Warning level is 3 for all 3dstudio compiled programs.

Project|Settings|C/C++|General|Optimizations is maximize speed for release and profile, disabled for Debug.

Project|Settings|C/C++|Code Generation is PentiumPro for all configurations.

Project|Settings|C/C++|Code Generation Runtime Lib is Multithreaded for rel & prof and multithreaded debug for debug.

Project|Settings|C/C++|C++ Language|Enable Run-Time Type Information is set for all configurations.

Project|Settings|C/C++|Optimizations|Inline Function is set to Any Suitable for rel & prof and disabled for debug.

Project|Settings|Link|General|Generate Debug information is set for profile and debug and disabled for profile

Project|Settings|Resource|PreProcessor Definitions NDEBUG for rel and profile and _DEBUG for debug