Commit graph

84 commits

Author SHA1 Message Date
Boondorl
1fd267a96a Improved Object handling while predicting
Added a warning if a networked Object or non-client-side Thinker was erroneously destroyed manually while predicting. This only applies to ZScript since this is the only place it's relevant. Added a warning if a non-client-side Thinker was spawned while predicting. Sweep objects before backing up while predicting to ensure invalid pointers aren't captured.
2025-08-02 15:03:18 -03:00
Marcus Minhorst
9b0f5d9b0d Fixes sign-compare warnings 2025-07-18 21:11:50 -03:00
Boondorl
7e90f3a0f3 Fixed teleporters breaking view interpolation 2025-07-08 16:28:16 -03:00
Boondorl
17f1c90d4a Always back up players even in singleplayer
This way client-side actions will be consistent between multiplayer and singleplayer.
2025-07-08 11:32:15 -03:00
Boondorl
1e281bfce2 Added player iterators
Allows for easily iterating through players currently in the game.
2025-06-16 14:42:15 -03:00
Boondorl
989a355f80 Moved BobTimer to playerinfo
This was a bit too invasive for mods that used full PlayerThink overrides.
2025-06-14 14:04:11 -03:00
Ricardo Luís Vaz Silva
9e2b1f9c4c
Bone Getters Part 2/3, plus fixed warnings for MSVC
* add getters for frame poses

* fix missing joint in GetJointPose

* clean up models_iqm.cpp

* clean up usage of I_GetTimeFrac, split out matrix calculation into its own function

* clean up SetModelBoneRotationInternal

* clean up a few float <-> double and unsigned <-> signed warnings

* fix more warnings

* further clean up warnings

* split mode ObjectToWorldMatrix stuff

* initial work on bone getters, matrix hell

(the matrix/vec3 multiplications are probably wrong af, just gotta add more stuff 'till i can test it)

* clean up matrix math

* GetBone/TransformByBone

* fix GetBoneFramePose

* fix ObjectToWorldMatrix

* fix missing array resize

* raw matrix getters (for use with gutamatics/etc)

* reverse matrix mult order

* replace GetBoneLength/GetBoneDir with GetBoneBaseTRS

* fix GetBonePosition, remove GetBoneWorldMatrix as it's useless

* GetBonePosition

* deduplicate code

* rename GetBonePosition to GetBoneBasePosition to avoid confusion

* GetBoneBaseRotation

* GetBonePosition helper function

* forgot include_offsets
2025-05-09 17:06:16 -03:00
Sally Coolatta
ac42aa8337 cl_debugprediction console variable
Makes `gametic` run behind `ClientTic` by n ticks, and forces player prediction code to run. Only works if you are in a singleplayer session.

This is intended to be useful for mod development, as you can quickly test prediction issues without creating a multiplayer server. It may also come in handy if any improvements are made to the prediction code in the future.
2025-03-25 10:24:44 -04:00
Boondorl
f7e62a8cd6 Added client-side Thinkers
Adds support for client-side Thinkers, Actors, and ACS scripts (ACS uses the existing CLIENTSIDE keyword). These will tick regardless of the network state allowing for localized client handling and are put in their own separate lists so they can't be accidentally accessed by server code. They currently aren't serialized since this would have no meaning for other clients in the game that would get saved. Other logic like the menu, console, HUD, and particles have also been moved to client-side ticking to prevent them from becoming locked up by poor network conditions. Additionally, screenshotting and the automap are now handled immediately instead of having to wait for any game tick to run first, making them free of net lag.
2025-03-11 10:14:28 -03:00
Boondorl
94be307225 Netcode Overhaul
Rewrote netcode to be more stable and functional. Packet-server mode has been restrategized and will now be the default netmode when playing with 3+ non-LAN players. TryRunTics has been cleaned up with older tick control behavior removed to account for the rewritten renderer. The main thread is now more consistent when playing online to prevent potential slow downs and lock ups. Load barriers are better accounted for to prevent spikes on level transition. Improvements to chat and lobby systems including a force start game button. Added a suite of new host options such as kicking and controlling who can pause the game. Max players increased from 8 to 16 since the new code can now handle it.

Note: Demo functionality is untested. This will be rewritten at a later time alongside improvements to GZDoom's playback features (e.g. freecam mode).
2025-03-05 12:52:52 -05:00
Rachael Alexanderson
f3b0c3ac5e
- Roll back filesystem changes. These were causing instabilities in the master branch that were interfering with development. 2025-01-04 11:27:21 -05:00
Boondorl
15fcf60489 Fixed angleOffsetTargets not being initialized 2024-11-27 22:36:38 -05:00
Boondorl
4726cc9ec5 Fixes for serializing and initializing
Fixed missing DViewPosition serializing. Fixed missing initializers in player_t.
2024-11-27 22:36:38 -05:00
Christoph Oelckers
d1abc3eb8c renamed things in file system to reduce Doom specific terminology. 2024-11-24 18:05:11 +01:00
Christoph Oelckers
634a646c2d take namespace enum out of namespace and added CheckNumForAnyName and CheckNumForFullNameInFile to clarify the meaning of CheckNumForFullName.
This is to take some renaming noise out of the upcoming refactoring.
2024-11-24 17:59:16 +01:00
Boondorl
941f9502e9
Improved "respawn where died" functionality (#2831)
Now uses a "last safe position" system instead. This:
-Prevents players from slipping into places they shouldn't via their dead body and then respawning there
-No longer sends players back to spawn if they fall into kill pits
-Adds a safety feature where the kill command always resets back to spawn should a player ever get stuck somewhere
2024-11-24 09:44:47 -05:00
Christoph Oelckers
f2b52f620b move game-specific CVAR out of low level system code. 2024-11-23 20:39:22 +01:00
Boondorl
3ea5be1ea7 Reworked FRandom constructors
Removes ambiguity while keeping old constructor syntax in check for better overall portability.
2024-11-15 23:56:23 -03:00
Boondorl
a1a4a97dcd Added RNG snapshotting for predicting
Allows RNG seeds to be played back in a predictive way paving the road for predictive behaviors that rely on RNG.
2024-11-15 23:56:23 -03:00
Boondorl
597b06ae52 Added CRandom functions
Unique RNG namespace for client-side effects and HUDs. Identifiers for these cannot clash with identifiers that affect the playsim making them completely safe to use in HUD elements. They also won't be saved.
2024-11-15 23:56:23 -03:00
inkoalawetrust
34dc204517
Re-added sector damage for non-players. (#2773)
* Re-add non-player sector damage.

Reimplements SECMF_HURTMONSTERS and SECMF_HARMINAIR.

* Fixed 3D floor handling for sector damage.

Fixes sector damage to either monsters or players not working on (non-)solid 3D floors.
2024-10-20 07:51:36 -04:00
Rachael Alexanderson
4ba53e34e4
Revert "Added SECMF_HURTMONSTERS, SECMF_HARMINAIR and NOSECTORDAMAGE."
This reverts commit 391f496512.
2024-10-19 10:25:03 -04:00
Jon Heard
4c27b55eb9 SetSkin and GetSkinCount added to PlayerInfo class 2024-09-29 18:14:52 -04:00
inkoalawetrust
391f496512 Added SECMF_HURTMONSTERS, SECMF_HARMINAIR and NOSECTORDAMAGE.
- Added SECMF_HURTMONSTERS, which allows monsters in the flagged sector to be hurt with the same behavior as players (i.e damage leaking).
- Added SECMF_HARMINAIR, which allows players (And monsters with SECMF_HURTMONSTERS) to be hurt when they're inside the sector in general, instead of only when they're walking on it. Replicates the behavior of the DAMAGE_IN_AIR flag that SectorDamage() uses.
- Added NOSECTORDAMAGE, which makes actors with the flag immune to any harmful floors.
2024-09-29 18:12:30 -04:00
Boondorl
10d0f94972 Misc network fixes
Fixed missing teleport specials when predicting. Added rubberband limit; if too far away from the predicted position, will instead instantly snap the player's view to their new spot. Deprecated cl_noprediction; this was pointless as you'd never not want to predict your position/angles. Fixed angle targets not being backed up. Fixed oldbuttons not being set. Updated menu
2024-07-07 01:33:37 -03:00
Boondorl
3d6e508d67 Network messages will now show usernames instead of just numbers
Gives more useful feedback as it's not obvious which node belongs to who.

Added line breaks to network messages for cases where a large amount of players are desynced.
2024-05-26 20:29:23 -03:00
Boondorl
48eb848433 Fixed ViewPos not properly backing up when predicting
Also now forcibly creates the object on players when they spawn so their pointer won't get lost when predicting.
2024-04-28 21:20:20 -03:00
Boondorl
929febdfb1 Fixed prediction not calling virtual Tick function 2024-04-28 21:20:04 -03:00
Boondorl
12d0c946f0 Reworked clientside lerping
Now acts as a rubberbanding effect. The result is that movement is now considered correct and adjusted towards the real position if not rather than cautiously moving towards the predicted position.
2024-04-26 20:56:12 -03:00
Boondorl
ca95e18742 View fixes when predicting
View interpolation paths are now reset properly when predicting, fixing portals. Teleporters disabling view interpolation is now handled before every movement instead of only once at the start of predicting. Enabled FoV interpolation when playing online.
2024-04-25 17:19:27 -03:00
Boondorl
2b697d6c4c Interpolation fix for network prediction
This is a minor fix for interpolation when playing online as predicted movement was not properly having its prev data reset like a real tick would be. This resulted in jittery player sprites in third person.
2024-04-25 11:44:38 -03:00
Christoph Oelckers
ebd4ebf298 StringTable cleanup and improvements
cleaned up function interface to avoid referencing the file system in the worker functions.
replaced StringTable's operators with functions.. The main reason is that these are far easier to look up when browsing the source.
This also fixes a premature translation in SBARINFO that was done in the parsing stage, not the printing stage.
2024-04-21 10:34:44 +02:00
Boondorl
bcd6c6170e
Reapply "Improvements to death and cheat handling"
This reverts commit c7bba2a126.
2024-04-20 01:15:46 -04:00
Rachael Alexanderson
c7bba2a126
Revert "Improvements to death and cheat handling"
This reverts commit 3033fafaa7.

Revert "Improved ZScript interface for morphing"

This reverts commit 6c64a4403c.

Revert "Further morphing clean up"

This reverts commit 12dc5c1506.

Revert "Fixed inconsistencies between player and monster morphing"

This reverts commit 30730647fe.

Revert "Reworked Morphing"

This reverts commit 2c09a443b4.

- fix compile
2024-04-17 17:55:24 -04:00
Boondorl
6b7065899d Added interpolation to view position 2024-03-28 15:48:05 -04:00
Boondorl
12dc5c1506 Further morphing clean up
Players will now use their Alternative field to check if they're morphed instead of their MorphTics. This makes the current state of morphing more reliable, otherwise setting this to 0 manually without unmorphing could have very odd results. Both monsters and players consider 0 morph time to mean infinite now (previously this only applied to monsters). Player unmorphs no longer die in the case of a failed unmorph on death. Removed inventory swapping on player pointer substitution as it's too messy to do here.
2024-03-01 08:35:31 -05:00
Boondorl
e4ea5ad307 Fixes for SCALEDNOLERP
No longer relies on last input fraction to determine offset on frame (now uses TicFrac). No longer modifies Actor angle in real-time. Fixed offsetting breaking when other viewports are being renderer.
2024-02-23 22:44:18 +01:00
Dileep V. Reddy
25f1407228 Cleaning up implementation of isometric camera with optional orthographic projection.
All CVars, mapinfo variables, and playerinfo/playerpawn variables are gone.
A Camera actor named 'SpectatorCamera' is defined in warsrc/static/zscript/actors/shared/camera.zs

The following new flag bits were defined in the 'DViewPosition' struct for use with actor->ViewPos in src/playsim/actor.h:
	VPSF_ALLOWOUTOFBOUNDS =		1 << 3,			// Allow viewpoint to go out of bounds (hardware renderer only).
	VPSF_ORTHOGRAPHIC =		1 << 4,			// Use orthographic projection.
	VPSF_ISOMETRICSPRITES =		1 << 5,			// Displace sprites towards camera and don't billboard (drawn from isometric perspective).

Basically, spawn a SpectatorCamera actor with the appropriate flags and set it to player.camera.
See example template: https://www.mediafire.com/file/fv8rytayjt9l6g1/isometric_actor_wads.zip/file

Has been tested with multiplayer death and disconnection (and respawns). Not tested with portals.
Still only works with hardware renderer (mostly). But should be compatible with older mods and libraries.
2024-02-01 08:43:34 -05:00
Dileep V. Reddy
d3405837ce Changed all of the isometric functionality to mapinfo and playerinfo variables. Retained function of most of the CVars. 2024-01-21 12:13:42 -05:00
Dileep V. Reddy
08b03e6b19 Adding isometric camera mode with orthographic projection to current state of master branch of GZDoom. 2024-01-21 12:13:42 -05:00
Rachael Alexanderson
af08413e10
- reverting pull request #2361 - apparently pull request #2364 changed some behaviour and these two do not play nice together. One or the other unfortunately has to be rolled back to allow GZDoom to build properly again.
Revert "Restored r_orthographic behavior."

This reverts commit 26908f5bc5.

Revert "Changed all of the isometric functionality to mapinfo and playerinfo variables. Retained function of most of the CVars."

This reverts commit dc897eacc0.

Revert "Adding isometric camera mode with orthographic projection to current state of master branch of GZDoom."

This reverts commit d2c2c93cf1.
2024-01-21 08:18:16 -05:00
Dileep V. Reddy
dc897eacc0 Changed all of the isometric functionality to mapinfo and playerinfo variables. Retained function of most of the CVars. 2024-01-21 03:34:00 -05:00
Dileep V. Reddy
d2c2c93cf1 Adding isometric camera mode with orthographic projection to current state of master branch of GZDoom. 2024-01-21 03:34:00 -05:00
Boondorl
a8e350aed8 Renamed Networking Functions
New names more appropriately match the size of the value they write to/read from the stream.
2024-01-05 23:33:15 +01:00
Christoph Oelckers
fe106d9bfe merge FileData and ResourceData. 2023-12-14 17:22:29 +01:00
Ricardo Luís Vaz Silva
aed85a25a2 serialize cvars 2023-11-25 21:06:39 -05:00
Christoph Oelckers
7a5a2858a2 yet even more GetChars calls added. 2023-10-07 23:29:24 +02:00
Christoph Oelckers
ebb71cebf1 - put the entire filesystem code into a namespace and created some subdirectories. 2023-08-22 22:54:54 +02:00
0e5c6e37b1 Prevent important messages from being accidentally filtered. 2023-01-04 17:54:09 +01:00
Boondorl
0d4d5587b5 Added FOV Interpolation 2022-12-18 08:23:19 +01:00