1
0
forked from 0ad/0ad
Commit Graph

7544 Commits

Author SHA1 Message Date
990f09e67e Changes CVertexBufferManager container from std::list to std::vector.
This was SVN commit r24861.
2021-02-08 22:37:44 +00:00
6d4fd01a59 Separates allocated vertex buffers into groups for data locality.
Tested By: Langbart, OptimusShepard, Stan
Differential Revision: https://code.wildfiregames.com/D3522
This was SVN commit r24860.
2021-02-08 22:34:10 +00:00
d078df0b85 Get the public IP from the lobby if not using STUN.
Follow-up to 1a8de6d2b8. This makes it again possible to host without
STUN via the lobby.
The lobby bot will answer the host "Register" command with the external
IP. This is only sent to the host, avoiding IP leakage.

There is a small window in which a client might try to join and the
public IP isn't up, and the request goes through, but that seems rather
unlikely to be a problem in practice.

Refs #5913

Differential Revision: https://code.wildfiregames.com/D3490
This was SVN commit r24858.
2021-02-08 15:47:34 +00:00
c009eae0a5 Lobbybots: update readme to reflect mod_ipstamp being optional
Following #5913, mod_ipstamp is no longer required to enable STUN
hosting (it can only be useful to enable non-STUN hosting).
This updates the readme to reflect that, and fixes some markdown issues.

Differential Revision: https://code.wildfiregames.com/D3473
This was SVN commit r24857.
2021-02-08 14:22:01 +00:00
53100974d9 Fix blurry textures in Bundle by bundling with mod mod in CI
The "public" archive needs to be built with the mod mod active, to load
textures.xml files. This saves a few MBs as a side effect.

Fixes #6000

Differential Revision: https://code.wildfiregames.com/D3534
This was SVN commit r24847.
2021-02-07 11:36:34 +00:00
d3c593666f Only parse querystring in RL Interface if it exists.
Patch by: @irishninja
Differential Revision: https://code.wildfiregames.com/D3529
This was SVN commit r24844.
2021-02-06 23:00:45 +00:00
dd9e14d5d1 Move SSE.h to a better place. Rename it to simd.h after discussion with @OptimusShepard and @vladislavbelov
Differential Revision: https://code.wildfiregames.com/D3437
This was SVN commit r24840.
2021-02-05 12:40:59 +00:00
e3c44f0bde Fix more issues with the RLInterface
Patch by: @Stan, @irishninja
Differential Revision: https://code.wildfiregames.com/D3385
This was SVN commit r24839.
2021-02-05 12:23:02 +00:00
321e3652f9 Fix and disable some pesky Windows warnings.
Differential Revision: https://code.wildfiregames.com/D3511
This was SVN commit r24838.
2021-02-05 12:20:06 +00:00
5eb7fba3bd Further VertexBuffer improvements after b3cbee6ba9.
Chunk merging is based on patch D2528 by @dm.

This was SVN commit r24835.
2021-02-04 23:48:30 +00:00
b3cbee6ba9 Performance improvements to VertexBuffer.
Patch By: dm
Tested By: OptimusShepard, Stan, wraitii
Differential Revision: https://code.wildfiregames.com/D2528
This was SVN commit r24834.
2021-02-04 23:26:37 +00:00
a564892fab Removes redundant normalizations for float types.
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D3517
This was SVN commit r24833.
2021-02-04 20:03:03 +00:00
5d96346ac5 Fix units 'waltzing' in place in formation.
Following 847f3a9995,
Units in formation can get very small movement offsets, that nonetheless
require large rotations, and thus at least 2 turns to accomplish.
However, following 847f3a9995, PossiblyAtDestination fires() only after
the first rotation, so the unit ends up 'waltzing' in place.
Before that diff, the unit never even moved since PossiblyAtDestination
fired straight away.

This is also noticeable since IDLE formation re-order their members
since 71a61d5f50.

The fix here is to ignore rotation time for very small offsets, which
lets units accomplish the movement in one turn and fixes the issue.

Reported by: wowgetoffyourcellphone
Reviewed By: Freagarach
Tested By: langbart
Differential Revision: https://code.wildfiregames.com/D3518
This was SVN commit r24831.
2021-02-04 16:58:19 +00:00
f8fde587a0 Removes unused dummy shader from decals rendering.
This was SVN commit r24828.
2021-02-04 00:00:55 +00:00
333f7b4fb4 Fixes building snapping for non-square foundations. Fixes #5976
Tested By: Freagarach, Langbart, Stan
Differential Revision: https://code.wildfiregames.com/D3510
This was SVN commit r24827.
2021-02-03 17:03:44 +00:00
30fc281a4c Significantly reduces number of OpenGL state changes for terrain rendering.
Tested By: Freagarach, Langbart, Stan
Differential Revision: https://code.wildfiregames.com/D3512
This was SVN commit r24826.
2021-02-03 17:01:38 +00:00
55f6eae7c5 Removes unused dummy shader from terrain rendering.
This was SVN commit r24822.
2021-02-02 15:34:52 +00:00
42b068d9c9 RL: Update template paths & remove debug-print.
debug-print was removed in 992d740a58, templates were changed in
b57abe806c

Patch by: irishninja
Differential Revision: https://code.wildfiregames.com/D3502
This was SVN commit r24816.
2021-02-01 14:53:40 +00:00
f76f557d5c Stops parsing a shader if an include has an error.
This was SVN commit r24815.
2021-02-01 14:12:30 +00:00
02f2be9272 Adds logging of a shader name on an error after reload.
Differential Revision: https://code.wildfiregames.com/D3462
This was SVN commit r24814.
2021-02-01 13:50:07 +00:00
e4ac538c91 Change ENSURE in BinarySerializer to try and get more debug data.
I'm hoping this will give us more information on what's going wrong.

Also remove comments which were outdated since 7460d0e56e

Refs #5987

Differential Revision: https://code.wildfiregames.com/D3501
This was SVN commit r24811.
2021-01-30 09:13:13 +00:00
48f72b0e17 Fix ranged unit chasing following 847f3a9995
D3230 / 847f3a9995 introduced range checking at turn start, and removed
a hack that made units predict the position of their target too far
ahead. This worked fine when in "straight movement" mode, unfortunately
I failed to recognise that ranged units would never use that mode. This
meant that ranged-unit chasing was broken.

There is a straightforward fix however, since we can simply change
TryGoingStraightToTarget to be used by ranged units. It fixes the issue
efficiently and improves movement for ranged units in general, so it
probably should have been done from the start.

Refs #5936

Differential Revision: https://code.wildfiregames.com/D3489
This was SVN commit r24803.
2021-01-27 21:55:49 +00:00
7b88b1a0f9 UnitMotion - Additional chasing fixes
- Because units slow down when turning, and JPS paths often begin with a
J-shape, chasers can fail to catch up to slower chasee, because the
latter don't recompute paths as often. To fix this, ignore the first
waypoint if it's close by and the next is accessible.
- Don't interpolate the target position when interpolation isn't
necessary (i.e. when not processing the MT_Update_Motion* message), as
that resulted in the "follow known bad path" hack to active
un-necessarily.
- Tweak PathingUpdateNeeded, it will return true when it has no path to
follow
- Remove the direct-range consideration in the "distance uncertainty"
calculation.

Refs #5936

Differential Revision: https://code.wildfiregames.com/D3485
This was SVN commit r24800.
2021-01-27 19:13:29 +00:00
6a66fb8205 Chasing fix - ignore the target's obstruction to avoid colliding with it.
Units movement is currently "all or nothing". This means that a chasing
entity that moves fast enough is likely to collide with its target, if
the latter is moving also. This means that it might fail to get in range
if the max range is smaller than the movement speed over a turn.
This happens to be very much the case in MP, as cavalry range is 4,
melee cav speed is ~20 and turns are 500ms.

This problem depends on which unit moves first (i.e. which unit is
lowest-ID).

To fix this, ignore the obstruction of the target, if it is moving, when
moving. This however means sometimes chasers will 'overshoot' and block
their target pathing, making the chase easier than it probably should
be.
Fleeing units don't suffer from this problem since they also ignore
their target (and their code handles it).

This new problem introduced in this diff is heavily dependent on the
exact speeds and ranges at play, and a further diff will improve the
situation to acceptable levels.

Reported by: FeldFeld
Refs #5936

Differential Revision: https://code.wildfiregames.com/D3482
This was SVN commit r24798.
2021-01-27 17:44:31 +00:00
847f3a9995 Check for movement success/failure on turn start.
Unit Motion currently checks if the unit is at destination during the
MT_Update_Motion* step, which happens late in the turn (notably, after
Timer.js) and moreover happens while entities are being moved (e.g.
entities with lower IDs have moved already, entities with higher IDs
have yet to do so).

This changes UnitMotion to instead check at turn start, which:
- benefits from in-turn path computations for more fluid movement
- ensure that distance checks aren't done against an entity that has
already moved for the turn.

The latter issue led to units failing to get in range of their target
when chasing them, in some situations.

As a side effect, this means that UnitAI move requests always take one
turn to succeed, so orders should be updated to check for range (or
they'll waste a turn). This is done for garrisoning, other orders were
already doing so.

Also includes a small tweak to avoid units rotating randomly when they
have no movement to accomplish.

Patch by: bb
Reviewed By: wraitii
Refs #5936

Differential Revision: https://code.wildfiregames.com/D3230
This was SVN commit r24797.
2021-01-27 15:11:57 +00:00
Angen
16a91c37e9 Limit possibility of brute force attacks when guessing password
As suggested by elexis, 1a8de6d2b8 should get some protection against
brute force attacks on password.

This is supposed to prevent attackers from getting connection data by
guessing the password.

Each failed attempt increases the counter.
XmppClient on the server side checks for the users with certain number
of failed attempts, determined in CNetServer, and refuses to check the
password, answering with banned message.
So they cant guess again in given match. Effect of this block will
dissapear after new match is created.

Differential revision: D3467
Comments by: wraitii, Stan
Tested by: Stan, Freagarach
Ref: #5913

This was SVN commit r24794.
2021-01-26 20:20:48 +00:00
804332e204 Fix NOPCH builds.
Caused by cd97df87e9

Differential Revision: https://code.wildfiregames.com/D3469
This was SVN commit r24785.
2021-01-25 11:12:11 +00:00
c640220cb2 Fix error when deserializing following f2b3c4d8ec
f2b3c4d8ec broke deserializing because it did not reset the mapsize on
Deserialize(), and thus the water renderer would not regenerate data.

Differential Revision: https://code.wildfiregames.com/D3461
This was SVN commit r24778.
2021-01-23 21:13:26 +00:00
ae18a5474c Reduces shadow biases for landscape shaders.
Tested By: Stan, wraitii
Differential Revision: https://code.wildfiregames.com/D3457
This was SVN commit r24777.
2021-01-23 19:40:58 +00:00
93a352ad16 Fix UnitAI range queries - allow queries to ignore sizes - partial revert of d0fc8ff67d
Units sometimes ignored targets that entered their LoS. The cause is
d0fc8ff67d: range queries returned units farther away, and those units
might actually be out of range if distance is computed center-to-center,
which both UnitAI and LOS do. This meant that code relying on range
query updates was possibly broken, and indeed units missed things (see
ticket).

This introduces a boolean to switch between pre-d0fc8ff67d behaviour
(entity-as-point, center-to-center range queries) and post-d0fc8ff67d
(entities-as-circumscribing-circle, edge-to-edge range queries).
The former is used for UnitAI (where the new behaviour bugged), auras
(where varying structure sizes made it awkward) and build
restrictions(which simply did not really need it).

Reverts 7f1ee23d88, 050c5401b1 (with the exception of the iber monument
footprint), and the template changes in d0fc8ff67d itself.

It also reduces alertRaiser ranges slightly, this was missed in the
original diff.

#3381 is not reopened as BuildingAI still uses the new range queries.

Reported by: Freagarach
Comments By: Angen
Fixes #5968

Differential Revision: https://code.wildfiregames.com/D3456
This was SVN commit r24776.
2021-01-23 18:57:46 +00:00
4cc824d620 Net Server: Verify password in Authenticate
Follows 1a8de6d2b8.
Validate the password when a client joins a game, so even a player that
knows the connection data cannot join.

Refs #3556, Refs #5913

Differential Revision: https://code.wildfiregames.com/D3438
This was SVN commit r24775.
2021-01-23 18:04:36 +00:00
e7e6fe139e Allows to override GL version for SDL.
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D3448
This was SVN commit r24768.
2021-01-22 19:40:02 +00:00
d92feab275 Fix target height computation when launching projectiles.
The Y coordinate at which to fire a projectile is currently assumed to
be the target's current Y, which is incorrect if the target is moving on
a slope.
This fixes that.

Note that this was purely visual, since projectiles still hit the target
regardless, as the height component is totally ignored, even if the
projectile is underground (in fact, the projectile's position is not
known in DelayedDamage::MissileHit, which just assumes it lands where it
said it would when fired).

As noted by bb in f737831167

Fixes #5939

Differential Revision: https://code.wildfiregames.com/D3425
This was SVN commit r24766.
2021-01-22 18:16:13 +00:00
e76745b0b2 Revert cf6aaf37a4, causing false OOS in visual replays.
cf6aaf37a4 fixed #5546, but it seems to cause some rare OOS in visual
replays, as reported in #5909. The culprit is likely that hashes aren't
computed at quite the same moment and onDestroy changes things.

Reverting for now before A24.

Reported by: Angen
Refs #5546.
Fixes #5909

This was SVN commit r24764.
2021-01-22 17:13:12 +00:00
3becf25fac Update bundle dist tools
- The MacOs script was not exporting the SVN revision properly.
- Rename the DMG to match the other's conventions.
- Clean up windows installer files ( Fixes #5955 )

Differential Revision: https://code.wildfiregames.com/D3370
This was SVN commit r24763.
2021-01-22 12:53:54 +00:00
ce74c41297 Fix audio leak that resulted in openAL errors after a while.
Sound items were only deleted after 'last play' when stopped, but they
could also be left in 'paused' or 'initial' states, and were then not
cleared until the game exits (effectively a memory leak). This affected
particularly music & ambient sounds, which also used the most
buffers(/memory).
On MacOS (at least), this resulted in OpenAL errors & sound failures
after a while playing the game, because MacOS has a max "in flight
buffers" of 1024.

Also clean up some control flow in CStreamItem

Reported by: Eszett
Thanks langbart for the consistent repro'.

Fixes #5265

Differential Revision: https://code.wildfiregames.com/D3445
This was SVN commit r24762.
2021-01-22 12:50:05 +00:00
f2b3c4d8ec Fix a crash in WaterRenderer.cpp
This fixes a rare crash at map generation.
The water renderer could be left in an invalid state when exiting a
game, and would then crash on the next map generation in some cases.

Tested by: Stan
Differential Revision: https://code.wildfiregames.com/D3447
This was SVN commit r24759.
2021-01-22 08:14:27 +00:00
065b03a3db Removes useless transparent pass before the water for lowest settings since the water is opaque there.
This was SVN commit r24756.
2021-01-21 22:38:11 +00:00
8c429b9a68 Fix unit-only Attack move.
attackmoveUnit is more specific than attackMove, so since d0a42f2f00
won't fire at the same time. However the GUI code expected that,
breaking it.

Instead, properly check for either attackmove or attackmoveUnit.

Also fix an issue with d0a42f2f00 where hotkeys would be release if
switching to a more specific combination of the same hotkey.

Reported by: snelius
Fixes #5944

Differential Revision: https://code.wildfiregames.com/D3436
This was SVN commit r24752.
2021-01-21 15:58:33 +00:00
37729586dc Don't pause music when pausing the game / Fix victory music in SP.
Victory music doesn't work in A24 SP. That's because the modal pauses
the game, and pausing the game pauses music.
This has been the case since c9a5d5cee5.

Auto-pausing the game (structree, ...) didn't really happen in the past,
but A24 makes it relatively common, and I think pausing the music is a
bit jarring then, so this simply removes that.

Reported by: Langbart
Fixes #5941

Differential Revision: https://code.wildfiregames.com/D3433
This was SVN commit r24744.
2021-01-21 09:34:20 +00:00
1877871be0 Fix issue with 5d2be02f68
std::string_views are created pointing to vector-owned strings, but
those strings can use Short String Optimisation (storing the data
inline, i.e. in vector memory). When the vector is resized, the strings
are moved and those string_views now point to invalid memory.

To fix it, use std::deque which does not invalidate pointers on
push_back.

Fixes 5d2be02f68.

Reviewed By: vladislavbelov
Fixes #5950

Differential Revision: https://code.wildfiregames.com/D3441
This was SVN commit r24742.
2021-01-21 08:42:05 +00:00
5d2be02f68 Optimization for include resolving in PreprocessorWrapper.
Reduces the number of copying and decreases the computational
complexity.

Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D3439
This was SVN commit r24740.
2021-01-20 23:05:15 +00:00
Angen
3991dd6c38 Fix incorrect user identifier used in 0342f01580
iq uses lowercased version of user name, but patch was saving raw one.
Found by: @Freagarach
This was SVN commit r24733.
2021-01-20 19:54:16 +00:00
9df127f9d1 Removes shader code duplication to calculate LOS.
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D3428
This was SVN commit r24732.
2021-01-20 18:46:32 +00:00
Angen
1a8de6d2b8 Hide ip and port from users until they want to join, add optional password
Current issue with the lobby, is that we make ips of hosts public for
anyone to read. This patch consists of 3 parts.
1.) Removing ips and ports from lobby javascript
2.) Removing need of script on the server to attach public ips to game
stanza by asking the host using xmppclient as proxy.
3.) Implementing password protected matches, to deny this information to
not trusted players.

Further description:
Do not send ports and stunip to the bots.

Removed from stanza.
Do not send ip to the lobby.

Removed from mapping gamelist from backend to gui (still on the backend
side, because it is done by script on 0ad server).
Get ip and ports on request when trying to connect.

On the host side, ask stun server what is host's public ip and remember
it.
On the client side, send iq through xmppclient to the hosting player and
ask for ip, port and if Stun is used, then if answer is success,
continue
   with connecting, else fail.
Add optional password for matches.

Add password required identifier to the stanza.
Allow host to setup password for the match. Hash it on the host side and
store inside Netserver. If no password is given, matches will behave
as it is not required.
On the client side, if password for the match is required, show
additional window before trying to connect and ask for password, then
hash it
and send with iq request for ip, port and stun.
Server will answer with ip, port and stun only if passwords matches,
else will asnwer with error string.
Some security:
Passwords are hashed before sending, so it is not easy to guess what
users typed. (per wraitii)
Hashes are using different salt as lobby hashing and not using usernames
as salt (as that is not doable), so they are different even typing the
same password as for the lobby account.
Client remembers which user was asked for connection data and iq's id of
request. If answer doesn't match these things, it is ignored. (thnx
user1)
Every request for connection data is logged with hostname of the
requester to the mainlog file (no ips).
If user gets iq to send connection data and is not hosting the match,
will respond with error string "not_server".
If server gets iq::result with connection data, request is ignored.

Differential revision: D3184
Reviewed by: @wraitii
Comments by: @Stan, @bb, @Imarok, @vladislavbelov
Tested in lobby

This was SVN commit r24728.
2021-01-20 18:31:39 +00:00
cd97df87e9 Fix instacrash when saving a game & serialization fails for "no Deserialize"
9fc6c3c897 stopped supporting components with a non-null Serialize() and
a null Deserialize().
Unfortunately, these throw exceptions and it appears we have codepaths
that don't handle these exceptions (possibly all of them). Since this
error is likely, and easily fixable, and doesn't actually _crash_, I'll
issue a LogError for now.

This will possibly help modders update to A24.

Differential Revision: https://code.wildfiregames.com/D3422
This was SVN commit r24720.
2021-01-20 08:16:34 +00:00
19eb21b647 Lower rolloff so that players that play from very high still hear sound.
Reported by: @ValihrAnt,  @Feldfeld
Discussed with: @Samulis
Refs: https://code.wildfiregames.com/D3108 / 876f6d5e50

This was SVN commit r24712.
2021-01-19 22:40:56 +00:00
7c3e885cef Implements binding a float array as a uniform input.
This was SVN commit r24711.
2021-01-19 19:57:31 +00:00
5cbf8f04ec Removes code duplications for binding shadows to shaders.
This was SVN commit r24710.
2021-01-19 19:19:04 +00:00
9d82ae15af [gameplay] Fix chasing range cavalry
This fixes chasing, particularly chasing ranged cavalry.

- Standardise the range of melee cav to 4.
- Decreases the speed of ranged cavalry slightly to make melee cavalry a
better counter & reduce the ability of ranged cavalry to dominate an
area.
- Fix UnitMotion to better chase units, by increasing direct-range
distance and making "from scratch" short paths recompute better paths
(by increasing the search range).
- Gives some free rotation time for slight angles to units. Angles below
30° take no time to rotate towards. Chasing units that recomputed a lot
of paths could be slowed down substantially by minute angle differences.

Fixes #5936

Differential Revision: https://code.wildfiregames.com/D3402
This was SVN commit r24708.
2021-01-19 19:09:55 +00:00