159 Commits
Author SHA1 Message Date
wookieejedi 2e712f8e2e Fix various multi bugs
PR addresses various small but longstanding mutli-related bugs. In draft status pending additional testing.
2026-08-06 12:52:24 -04:00
Taylor Richards fc7389f95a fix various compiler warnings 2025-08-18 11:59:22 -04:00
Taylor Richards 552f9990d9 remove support for memory mapped files (#6748)
FSO doesn't appear to use this any longer. And even when it was enabled the
requirements made it largely useless anyway. Removing to clean up cfile a
bit and so we don't have to keep maintaining it.
2025-06-05 17:53:13 -04:00
Goober5000 bcdcba7b8f default the connection speed to Fast even if it has been set to None
A connection speed of "None" is really just the default used by launchers if the user hasn't explicitly set the speed yet.  Additionally, `CONNECTION_SPEED_NONE` isn't really used by the engine except for error checking.  So, fall back to the default connection speed even when the speed has been set to "None".

Follow-up to #6402.
2024-12-08 23:34:58 -05:00
Goober5000 31a86e3f3d all the consts!
Some experimentation resulted in a lot of const-cascading.  This PR applies `const` to a large number of functions.
2024-11-07 23:33:13 -05:00
Goober5000 37a24b2a14 handle connection speed in a user-friendly way
1. Use a sensible default for the connection speed
2. Remove the `Psnet_connection` variable which is now obsolete: "its only purpose now is to change the default object update value for a player if it's set to dialup, and that's easily done in-game already"

The "You must define your connection speed" popup will now no longer appear unless it has been explicitly set to an invalid value.

Applies recommendations from, and fixes, #6402.
2024-11-03 23:09:32 -05:00
John Fernandez c08a669c2e Merge branch 'scp-fs2open:master' into Fix-Coverity-Time-T-issues 2024-03-22 11:51:27 -04:00
mjn-mixael 8dfeca4ac3 address feedback 2024-02-26 22:30:59 -06:00
mjn-mixael 6e38656658 Convert Active_games_head to an SCP_list to prepare for the SCPUI API 2024-02-26 22:30:59 -06:00
Goober5000 30cabc4174 fix FRED's "new object type" popup
1. Fix the item ID indexing on the popup submenus and make sure they correspond with the ship dropdown menu
2. Remove the "player start" popup menu option as it has very limited utility and was already removed in qtFRED
3. Reduce a bunch of casts by using more appropriate popup menu types
4. Actually place an object in the mission when one is chosen from the popup menu

Also:
1. Remove the `Default_player_model` variable as its use is redundant
2. Remove unused arguments of `create_player()`
2024-02-08 03:26:25 -05:00
John Fernandez 3124c55642 Change various varibales to time_t
These variables were previously int's or uint's
2023-12-20 16:06:49 -05:00
Goober5000 6e9b31cb5a replace pointers with indexes in ship registry and oswpt
This refactors the ship registry and the OSWPT struct to store data as indexes rather than pointers.  This is a prerequisite for making these collections dynamic in the future.  See also #5800.
2023-12-08 19:45:58 -05:00
mjn-mixael 95baa85750 remove the cd checks that always returned true anyway 2023-11-29 11:27:31 -06:00
Sébastien Noel f149c36b44 Fix a few typos (#5598) 2023-10-24 20:33:45 -04:00
John Fernandez 982e8d7f85 Add net_player nullptr check
Address coverity 1093457 by adding a nullptr check and Assertion.  This *should* never happen, but that's what asserts are for, right?
2023-10-23 10:24:13 -04:00
Naomi Coffman fd82ff70f1 Merge all friendly arrival messages into one type 2023-03-11 19:14:14 -05:00
Naomi Coffman 8d1171ae88 Add message types for every standard player order
This commit also changes a couple confusing message type names.
2023-03-11 11:39:06 -05:00
Goober5000 46293ad0fe add should-be-dead checks for all ship iterations
When iterating through `Ship_obj_list`, check the `Should_be_dead` flag before using the object.  This fixes #4990 and adds defense-in-depth checks to guard against similar errors elsewhere.

I considered moving the `Ship_obj_list` removal from `obj_delete` to `ship_cleanup`, but decided it would be prudent to avoid fundamental changes to lifecycle management.
2022-12-23 00:51:31 -05:00
JohnAFernandez 6255b9b154 Make sure that we check the correct instance (#4897) 2022-11-15 12:02:55 -05:00
JohnAFernandez 8712e69130 Merge pull request #4836 from JohnAFernandez/Fix-in-Game-Joining-Backup
Fix in game joining
2022-11-14 11:14:40 -05:00
JohnAFernandez 0d27a0f086 Enable client turrets to track targets (#4791)
* Enable clients to move turrets

This allows clients to user server data to move turrets according to the timing and target data on the server.  Uses a small packet to do so.
2022-11-14 15:58:41 +00:00
John FernandezandTaylor Richards 79c3571d2f Deny in-game Join for SW games
Because these are competitive games, we cannot allow in-game joining.

Co-Authored-By: Taylor Richards <[email protected]>
2022-11-14 10:30:28 -05:00
John Fernandez 01331436c9 Fix the standalone ship being added to ship list
While it may seem counterintuitive, we have to keep the standalone bogus ship from being added to the ship list so that we don't have to exclude it from all the places it could cause crashes or mysterious AI behaviors.  Both were being observed, and this should fix them.
2022-06-13 21:39:03 -04:00
Taylor Richards df6cf572ac convert multi timestamp()'s to ui_timestamp() where appropriate
A bit overkill for some of this but just covering the bases.

 * fix issues with in-game join
 * fix multi messaging and multi pause screen
 * make sure maintenance stuff (pings, voice, file xfer, etc.) isn't
   affected by pausing or time compression
2022-05-17 07:50:50 -04:00
Goober5000 8e2e825204 add UI_TIMESTAMP type and switch some timestamps to use it 2022-02-12 19:01:15 -05:00
Taylor Richards 0e059459d8 improve PXO data validation code (#3817)
* add batch validation for tables
* add batch validation for missions
* handle server connection errors in a more useful way
2021-12-23 09:06:26 -05:00
JohnAFernandez 9d7acbcc9d Update Function Name and comment to describe what it actually is (#3451)
Change find_player_id to find_player_index, since that is what it does
2021-05-29 19:21:36 -04:00
Taylor Richards ce9a0d5e08 add new popup type to handle mission/table validation (#3380)
* add new popup type to handle mission/table validation

* fix error handling when popup gets canceled

* use bool and get rid of Int3()

* use proper Game_mode check to test for standalone
2021-05-05 00:53:57 -04:00
Joshua Glatt 144d484c85 Replace rand() calls with a Random class (#3332) 2021-05-04 18:26:06 -07:00
JohnAFernandez c14653b391 Whitespace Adjustments 2021-03-23 20:31:04 -04:00
JohnAFernandez 2527bf31c7 Upgrade velocity compression in OO packet
Previously, the velocity could be off by up to 1 m/s.  This gives that packing function one more byte to work with, so that we have a lot more accuracy to work with.
2021-03-23 20:31:04 -04:00
JohnAFernandez 3830534978 Fix implementation of multi_pack_unpack_desired_vel_and_desired_rotvel 2021-03-23 20:31:04 -04:00
JohnAFernandez 5bb934119c Limit instances of Client Collisions to Avoid Instant Death (#3164)
* Limit instances of Client Collisions to Avoid Instant Death

* Set timestamps correctly (take 2)

* Handle server check the same everywhere

* Clearer Logic Here
2021-03-18 17:24:08 -04:00
Goober5000 f3bca4384f additional case functions and checks
This refactors the tolower/toupper code to use standards-conformant logic, and also adds some helpful utility functions.  Regular tolower/toupper must be supplied a value that can be represented as `unsigned char`, but the std:: functions are a bit more robust.
2021-02-18 04:23:08 -05:00
Taylor Richards 752f985433 optimize size of host_captain_change_packet()
don't need 4 bytes for a true/false
2020-12-24 09:38:22 -05:00
Taylor Richards 29e9b1f109 update host pointer on standalone after host switch
fixes Mantis 1892
2020-11-20 14:43:46 -05:00
JohnAFernandez 186fe51344 Object update packet upgrade (#2752)
* Object Update Refactor

    1. Keeps the object update packet aligned, even if the ship is dying or has not yet arrived on the client.
    2. Properly handles model point shields (yes, that's what was causing multi to crash the most!)
    3. Reworks positional interpolation timing and adds rotational interpolation, by sending timing information with every object update packet in a header shared between objects.
    4. Saves a lot of bandwidth by only sending data that is changing. (no more sending all subsystems once per second!)
    5. Better handles out of order packets (but can still use their information if recent enough!)
    6. Builds the basis for Rollback by beginning to record the positions and orientations and velocities of ships for the last 30 frames.
    7. Adds subsystem rotation -- Yeah, you saw that right, subsystems will now spin in multi.
    8. Waypoint movement is now enabled via sexp, and time to arrival of waypoints is updated on the target info gauge.

* Fix edge case crash and Incorporate feedback

* Clean Up Interpolate Angles Quick

* Restrain the client

* How was this still here???

* Make sure every part of OO uses OOC_INDEX_NULLPTR_SUBSYSTEM define

* Fix Way to Store Return Values

* Ok travis, we get it

* Ok travis.........
2020-10-08 15:29:06 -04:00
Taylor Richards f5a2cae122 Merge pull request #2608 from notimaginative/ipv6
IPv6 support
2020-09-20 09:46:44 -04:00
JohnAFernandez 8bad12d8a2 Fix Two Multi Crash Points 2020-09-01 21:01:35 -04:00
Taylor Richards 92be33ad9c first pass at IPv6 support 2020-08-30 00:01:00 -04:00
JohnAFernandez b7d7ebe6cf Allow Team Leaders to Send Messages and use ship registry to look up the team and slot
Team Leader function was returning 0 instead of 1 when the team captain was messaging AI.

This optimizes, cleans up, and gets rid of edge-case buggy behaviour.  Thank you ship_registry!
2020-07-17 22:44:24 -04:00
Taylor Richards 7db6662978 avoid querying tracker at LAN refresh internals 2020-07-12 14:00:57 -04:00
wookieejedi c2820f10c8 Updates and fixes multiple warp out related code 2020-05-08 09:53:32 -04:00
Goober5000 c9df8a13f1 add functions to remove the clutter of static casts for ship and weapon info vectors 2020-03-14 13:02:12 -04:00
asarium 582c144cf7 Fix standalone signal handling
The standalone did not initialize SDL and so did not receive the quit
signal when it was sent SIGTERM or SIGINT. This fixes that by making the
standalone server just use the normal os initialization code.

Also includes some other code cleanup and some more logging to make it
more apparent in the log what is currently happening at standalone
startup.
2020-02-29 17:09:55 +01:00
FSCyborg 56fd6f504a Mantis#2129 Address Rare Multi Crash
Should fix rare multi crash where reserving net signatures for spawened munitions would cause an ushort overflow, triggering an assert in multi_set_network_signature.

Turns out we can just remove the assert, and just guarantee that signature is going to be in the required range.

Squash history:
1. Improve Assertions (as per Taylor's suggestion) and reconfigure Int3
2. Wording change on last assertion
2019-12-28 00:50:35 -05:00
JohnAFernandez 861eb14865 Clean Up Error Handling in multitutil.cpp
Removes about half of the Int3()'s in multiutil.cpp by making Assertions more robust, changing two functions to void type (because there was no way to get an error value from them, anyway), and adding two Verify()'s in case we ever decide to start using the multi variable change functions.

Squash History:
1) Forgot to change one Assert to Assertion
2) Change Verify to Assertion, because of better argument support.
3) Fix a couple copy paste errors
2019-12-26 07:59:14 -05:00
JohnAFernandez e34e3378a2 Modernize NULL to nullptr in Multiutil.cpp 2019-12-25 22:51:25 -05:00
FSCyborg 03125df50c Multiutil Minor Cleanup
Just a quick PR to make multiutil slightly more readable by removing one unused function (whose functionality is already in the object update packet), two globals which we only increment and we do nothing with, and some defines that have been commented out because the size returned can actually vary.
2019-12-25 22:06:38 -05:00
Taylor Richards 29ce72f66f switch to using winsock2
also removes some obsolete win32 #ifdef's and
cleans up some windows #include's
2019-11-15 23:33:35 -05:00